diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 78143868c3b4..27a2fbe420a1 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -45,7 +45,7 @@ jobs: ${{ runner.os }}-gradle- - name: Setup Maven - uses: s4u/setup-maven-action@v1.17.0 + uses: s4u/setup-maven-action@v1.18.0 with: java-version: ${{ matrix.java }} maven-version: 3.8.8 @@ -87,7 +87,7 @@ jobs: - name: Check out code uses: actions/checkout@v4 - name: Setup Maven - uses: s4u/setup-maven-action@v1.17.0 + uses: s4u/setup-maven-action@v1.18.0 with: java-version: 11 maven-version: 3.8.8 diff --git a/.github/workflows/samples-aspnet-fastenpoints-server.yaml b/.github/workflows/samples-aspnet-fastenpoints-server.yaml index 1b6e4eed457a..c7f102cecc48 100644 --- a/.github/workflows/samples-aspnet-fastenpoints-server.yaml +++ b/.github/workflows/samples-aspnet-fastenpoints-server.yaml @@ -26,7 +26,7 @@ jobs: - samples/server/petstore/aspnet/fastendpoints-useValidators steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4.1.0 + - uses: actions/setup-dotnet@v4.2.0 with: dotnet-version: '8.0.x' - name: Build diff --git a/.github/workflows/samples-dotnet-standard.yaml b/.github/workflows/samples-dotnet-standard.yaml index 13389ca6b316..7e9456d086c6 100644 --- a/.github/workflows/samples-dotnet-standard.yaml +++ b/.github/workflows/samples-dotnet-standard.yaml @@ -28,7 +28,7 @@ jobs: # - samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/ steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4.1.0 + - uses: actions/setup-dotnet@v4.2.0 with: dotnet-version: 3.1.* - name: Build diff --git a/.github/workflows/samples-dotnet.yaml b/.github/workflows/samples-dotnet.yaml deleted file mode 100644 index f5437863780a..000000000000 --- a/.github/workflows/samples-dotnet.yaml +++ /dev/null @@ -1,48 +0,0 @@ -name: Samples C# .Net 8 Clients - -on: - push: - paths: - - samples/client/petstore/csharp/generichost/latest/** - - samples/client/petstore/csharp/generichost/net8/** - - samples/client/petstore/csharp/httpclient/net8/** - - samples/client/petstore/csharp/restsharp/net8/** - - samples/client/petstore/csharp/unityWebRequest/net8/** - pull_request: - paths: - - samples/client/petstore/csharp/generichost/latest/** - - samples/client/petstore/csharp/generichost/net8/** - - samples/client/petstore/csharp/httpclient/net8/** - - samples/client/petstore/csharp/restsharp/net8/** - - samples/client/petstore/csharp/unityWebRequest/net8/** -jobs: - build: - name: Build .Net projects - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - sample: - - samples/client/petstore/csharp/generichost/latest/Tags - - samples/client/petstore/csharp/generichost/net8/AllOf - - samples/client/petstore/csharp/generichost/net8/AnyOf - - samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare - - samples/client/petstore/csharp/generichost/net8/FormModels - - samples/client/petstore/csharp/generichost/net8/ManualPetstoreTests - - samples/client/petstore/csharp/generichost/net8/ManualSourceGenerationTests - - samples/client/petstore/csharp/generichost/net8/NullReferenceTypes - - samples/client/petstore/csharp/generichost/net8/OneOf - - samples/client/petstore/csharp/generichost/net8/Petstore - - samples/client/petstore/csharp/generichost/net8/SourceGeneration - - samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4.1.0 - with: - dotnet-version: '8.0.x' - - name: Build - working-directory: ${{ matrix.sample }} - run: dotnet build Org.OpenAPITools.sln - - name: Test - working-directory: ${{ matrix.sample }} - run: dotnet test Org.OpenAPITools.sln diff --git a/.github/workflows/samples-dotnet6-client-echo-api.yaml b/.github/workflows/samples-dotnet6-client-echo-api.yaml deleted file mode 100644 index e384ef5b74b1..000000000000 --- a/.github/workflows/samples-dotnet6-client-echo-api.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: Samples C# .Net 6 Client Echo API - -on: - push: - paths: - - samples/client/echo_api/csharp-restsharp/** - pull_request: - paths: - - samples/client/echo_api/csharp-restsharp/** -jobs: - build: - name: Build .Net clients - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - sample: - # clients - - samples/client/echo_api/csharp-restsharp/ - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4.1.0 - with: - dotnet-version: '6.0.x' - - name: Run echo server - run: | - git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server - (cd http-echo-server && npm install && npm start &) - - name: Build - working-directory: ${{ matrix.sample }} - run: | - dotnet build Org.OpenAPITools.sln - dotnet test Org.OpenAPITools.sln diff --git a/.github/workflows/samples-dotnet6-client.yaml b/.github/workflows/samples-dotnet6-client.yaml deleted file mode 100644 index 87c099b4c17f..000000000000 --- a/.github/workflows/samples-dotnet6-client.yaml +++ /dev/null @@ -1,26 +0,0 @@ -name: Samples C# .Net 6 Client - -on: - push: - paths: - - samples/client/petstore/csharp/restsharp/net6/** - pull_request: - paths: - - samples/client/petstore/csharp/restsharp/net6/** -jobs: - build: - name: Build .Net clients - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - sample: - - samples/client/petstore/csharp/restsharp/net6/ParameterMappings/ - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4.1.0 - with: - dotnet-version: '6.0.x' - - name: Build - working-directory: ${{ matrix.sample }} - run: dotnet build Org.OpenAPITools.sln diff --git a/.github/workflows/samples-dotnet6-server.yaml b/.github/workflows/samples-dotnet6-server.yaml index 32b313ce7136..52482c065e9a 100644 --- a/.github/workflows/samples-dotnet6-server.yaml +++ b/.github/workflows/samples-dotnet6-server.yaml @@ -25,7 +25,7 @@ jobs: - samples/server/petstore/aspnetcore-6.0-useSwashBuckle steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4.1.0 + - uses: actions/setup-dotnet@v4.2.0 with: dotnet-version: '6.0.x' - name: Build diff --git a/.github/workflows/samples-dotnet8-client-echo-api.yaml b/.github/workflows/samples-dotnet8-client-echo-api.yaml new file mode 100644 index 000000000000..cba70044c353 --- /dev/null +++ b/.github/workflows/samples-dotnet8-client-echo-api.yaml @@ -0,0 +1,33 @@ +name: Samples C# .Net 8 Client Echo API + +on: + push: + paths: + - samples/client/echo_api/csharp/restsharp/net8/** + pull_request: + paths: + - samples/client/echo_api/csharp/restsharp/net8/** +jobs: + build: + name: Build .Net clients + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + # clients + - samples/client/echo_api/csharp/restsharp/net8/EchoApi + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4.2.0 + with: + dotnet-version: '8.0.x' + - name: Run echo server + run: | + git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server + (cd http-echo-server && npm install && npm start &) + - name: Build + working-directory: ${{ matrix.sample }} + run: | + dotnet build Org.OpenAPITools.sln + dotnet test Org.OpenAPITools.sln diff --git a/.github/workflows/samples-dotnet8-client.yaml b/.github/workflows/samples-dotnet8-client.yaml new file mode 100644 index 000000000000..f6708d0f6658 --- /dev/null +++ b/.github/workflows/samples-dotnet8-client.yaml @@ -0,0 +1,26 @@ +name: Samples C# .Net 8 Client + +on: + push: + paths: + - samples/client/petstore/csharp/restsharp/net8/** + pull_request: + paths: + - samples/client/petstore/csharp/restsharp/net8/** +jobs: + build: + name: Build .Net clients + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + - samples/client/petstore/csharp/restsharp/net8/ParameterMappings/ + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4.2.0 + with: + dotnet-version: '8.0.x' + - name: Build + working-directory: ${{ matrix.sample }} + run: dotnet build Org.OpenAPITools.sln diff --git a/.github/workflows/samples-dotnet8-server.yaml b/.github/workflows/samples-dotnet8-server.yaml index 0b8a9ac99d92..dd52b7efcd09 100644 --- a/.github/workflows/samples-dotnet8-server.yaml +++ b/.github/workflows/samples-dotnet8-server.yaml @@ -25,7 +25,7 @@ jobs: - samples/server/petstore/aspnetcore-8.0-useSwashBuckle steps: - uses: actions/checkout@v4 - - uses: actions/setup-dotnet@v4.1.0 + - uses: actions/setup-dotnet@v4.2.0 with: dotnet-version: '8.0.x' - name: Build diff --git a/.github/workflows/samples-dotnet8.yaml b/.github/workflows/samples-dotnet8.yaml new file mode 100644 index 000000000000..ff66725e3358 --- /dev/null +++ b/.github/workflows/samples-dotnet8.yaml @@ -0,0 +1,45 @@ +name: Samples C# .Net 8 Clients + +on: + push: + paths: + - samples/client/petstore/csharp/generichost/net8/** + - samples/client/petstore/csharp/httpclient/net8/** + - samples/client/petstore/csharp/restsharp/net8/** + - samples/client/petstore/csharp/unityWebRequest/net8/** + pull_request: + paths: + - samples/client/petstore/csharp/generichost/net8/** + - samples/client/petstore/csharp/httpclient/net8/** + - samples/client/petstore/csharp/restsharp/net8/** + - samples/client/petstore/csharp/unityWebRequest/net8/** +jobs: + build: + name: Build .Net projects + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + - samples/client/petstore/csharp/generichost/net8/AllOf + - samples/client/petstore/csharp/generichost/net8/AnyOf + - samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare + - samples/client/petstore/csharp/generichost/net8/FormModels + - samples/client/petstore/csharp/generichost/net8/ManualPetstoreTests + - samples/client/petstore/csharp/generichost/net8/ManualSourceGenerationTests + - samples/client/petstore/csharp/generichost/net8/NullReferenceTypes + - samples/client/petstore/csharp/generichost/net8/OneOf + - samples/client/petstore/csharp/generichost/net8/Petstore + - samples/client/petstore/csharp/generichost/net8/SourceGeneration + - samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4.2.0 + with: + dotnet-version: '8.0.x' + - name: Build + working-directory: ${{ matrix.sample }} + run: dotnet build Org.OpenAPITools.sln + - name: Test + working-directory: ${{ matrix.sample }} + run: dotnet test Org.OpenAPITools.sln diff --git a/.github/workflows/samples-dotnet9.yaml b/.github/workflows/samples-dotnet9.yaml new file mode 100644 index 000000000000..d9379569cccd --- /dev/null +++ b/.github/workflows/samples-dotnet9.yaml @@ -0,0 +1,48 @@ +name: Samples C# .Net 9 Clients + +on: + push: + paths: + - samples/client/petstore/csharp/generichost/latest/** + - samples/client/petstore/csharp/generichost/net9/** + - samples/client/petstore/csharp/httpclient/net9/** + - samples/client/petstore/csharp/restsharp/net9/** + - samples/client/petstore/csharp/unityWebRequest/net9/** + pull_request: + paths: + - samples/client/petstore/csharp/generichost/latest/** + - samples/client/petstore/csharp/generichost/net9/** + - samples/client/petstore/csharp/httpclient/net9/** + - samples/client/petstore/csharp/restsharp/net9/** + - samples/client/petstore/csharp/unityWebRequest/net9/** +jobs: + build: + name: Build .Net projects + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + sample: + - samples/client/petstore/csharp/generichost/latest/Tags + - samples/client/petstore/csharp/generichost/net9/AllOf + - samples/client/petstore/csharp/generichost/net9/AnyOf + - samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare + - samples/client/petstore/csharp/generichost/net9/FormModels + # - samples/client/petstore/csharp/generichost/net9/ManualPetstoreTests + # - samples/client/petstore/csharp/generichost/net9/ManualSourceGenerationTests + - samples/client/petstore/csharp/generichost/net9/NullReferenceTypes + - samples/client/petstore/csharp/generichost/net9/OneOf + - samples/client/petstore/csharp/generichost/net9/Petstore + - samples/client/petstore/csharp/generichost/net9/SourceGeneration + - samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4.2.0 + with: + dotnet-version: '9.0.101' + - name: Build + working-directory: ${{ matrix.sample }} + run: dotnet build Org.OpenAPITools.sln + - name: Test + working-directory: ${{ matrix.sample }} + run: dotnet test Org.OpenAPITools.sln diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml index b65448e8f1b9..5824c4cd90f8 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/windows.yaml @@ -39,7 +39,7 @@ jobs: ${{ runner.os }}-build-${{ env.cache-name }}- ${{ runner.os }}-build- - name: Setup Maven - uses: s4u/setup-maven-action@v1.17.0 + uses: s4u/setup-maven-action@v1.18.0 with: java-version: ${{ matrix.java }} maven-version: 3.8.8 diff --git a/README.md b/README.md index b50afb523659..1cf42af4539e 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se - [1.5 - Homebrew](#15---homebrew) - [1.6 - Docker](#16---docker) - [1.7 - NPM](#17---npm) + - [1.8 - pip](#18---pip) - [2 - Getting Started](#2---getting-started) - [3 - Usage](#3---usage) - [3.1 - Customization](#31---customization) @@ -141,7 +142,7 @@ OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0, 3.1 (beta support) For old releases, please refer to the [**Release**](https://github.com/OpenAPITools/openapi-generator/releases) page. -For decomissioned generators/libraries/frameworks, please refer to [the "Decommission" label](https://github.com/OpenAPITools/openapi-generator/issues?q=label%3ADecommission+is%3Amerged+) in the pull request page. +For decommissioned generators/libraries/frameworks, please refer to [the "Decommission" label](https://github.com/OpenAPITools/openapi-generator/issues?q=label%3ADecommission+is%3Amerged+) in the pull request page. ## [1.2 - Artifacts on Maven Central](#table-of-contents) @@ -449,6 +450,29 @@ npm install @openapitools/openapi-generator-cli -D You can use [locally built JARs](https://github.com/OpenAPITools/openapi-generator-cli?tab=readme-ov-file#use-locally-built-jar) or [`SNAPSHOT` versions](https://github.com/OpenAPITools/openapi-generator-cli?tab=readme-ov-file#use-nightly-snapshot-build) as well. +### [1.8 - pip](#table-of-contents) + + +> **Platform(s)**: Linux, macOS, Windows +**Install** via [PyPI](https://pypi.org/) (`java` executable is needed to run): + +``` +pip install openapi-generator-cli +``` + +To install a specific version +``` +pip install openapi-generator-cli==7.10.0 +``` + +You can also install with [jdk4py](https://github.com/activeviam/jdk4py) instead of java binary. (python>=3.10 is required) + +``` +pip install openapi-generator-cli[jdk4py] +``` + +Ref: https://github.com/openAPITools/openapi-generator-pip + ## [2 - Getting Started](#table-of-contents) To generate a PHP client for [petstore.yaml](https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml), please run the following @@ -944,6 +968,10 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2024-03-04 - [Generating TypeScript Types with OpenAPI for REST API Consumption](https://www.pullrequest.com/blog/generating-typescript-types-with-openapi-for-rest-api-consumption/) by [PullRequest](https://www.pullrequest.com/) - 2024-03-07 - [Fully typed Web Apps with OpenAPI (Part 1)](https://medium.com/@gfox1984/fully-typed-web-apps-with-openapi-part-1-595d55766670) by [Guillaume Renard](https://medium.com/@gfox1984) - 2024-03-08 - [Laravel OpenAPIによる "辛くない" スキーマ駆動開発](https://fortee.jp/phperkaigi-2024/proposal/9e2e6c38-d078-4efa-99b4-83ebf9033b34) by [KentarouTakeda](https://twitter.com/KentarouTakeda) +- 2024-04-04 - [Working with OpenAPI using Rust](https://www.shuttle.dev/blog/2024/04/04/using-openapi-rust) by [Joshua Mo](https://twitter.com/joshmo_dev) +- 2024-04-08 - [Implement API first strategy with OpenAPI generator plugin](https://medium.com/javarevisited/implement-api-first-strategy-with-openapi-generator-plugin-e4bbe7f0d778) by [Rui Zhou](https://medium.com/@wirelesser) +- 2024-05-06 - [OpenAPI Generator Custom Templates](https://www.javacodegeeks.com/openapi-generator-custom-templates.html) by [Mary Zheng](https://www.javacodegeeks.com/author/mary-zheng) + ## [6 - About Us](#table-of-contents) @@ -1182,7 +1210,7 @@ If you want to join the committee, please kindly apply by sending an email to te | Android | @jaz-ah (2017/09) | | Apex | | | Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) | -| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) | +| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) @eafer (2024/12) | | C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) | | C# | @mandrean (2017/08) @shibayan (2020/02) @Blackclaws (2021/03) @lucamazzanti (2021/05) @iBicha (2023/07) | | Clojure | | diff --git a/appveyor.yml b/appveyor.yml index ae17c012c1fc..29fcd12cd8df 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -43,6 +43,18 @@ build_script: #- dotnet build samples\client\petstore\csharp\OpenAPIClient-ConditionalSerialization\Org.OpenAPITools.sln test_script: + - dotnet test samples\client\petstore\csharp\generichost\net9\AllOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\generichost\net9\AnyOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\generichost\net9\AnyOfNoCompare\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\generichost\net9\FormModels\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + # - dotnet test samples\client\petstore\csharp\generichost\net9\ManualSourceGenerationTests\ManualTests.Latest.UseSourceGeneration\ManualTests.Latest.UseSourceGeneration.csproj + # - dotnet test samples\client\petstore\csharp\generichost\net9\ManualPetstoreTests\OpenAPIClient-generichost-manual-tests\OpenAPIClient-generichost-manual-tests.csproj + - dotnet test samples\client\petstore\csharp\generichost\net9\NullReferenceTypes\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\generichost\net9\OneOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\generichost\net9\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\generichost\net9\SourceGeneration\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\generichost\net9\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\generichost\net8\AllOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp\generichost\net8\AnyOf\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp\generichost\net8\AnyOfNoCompare\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj @@ -78,10 +90,10 @@ test_script: - dotnet test samples\client\petstore\csharp\restsharp\net4.7\MultipleFrameworks\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp\restsharp\net4.7\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp\restsharp\net4.8\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - - dotnet test samples\client\petstore\csharp\restsharp\net6\ParameterMappings\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - - dotnet test samples\client\petstore\csharp\restsharp\net7\EnumMappings\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - - dotnet test samples\client\petstore\csharp\restsharp\net7\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - - dotnet test samples\client\petstore\csharp\restsharp\net7\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\restsharp\net8\ParameterMappings\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\restsharp\net8\EnumMappings\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\restsharp\net8\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj + - dotnet test samples\client\petstore\csharp\restsharp\net8\UseDateTimeForDate\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp\restsharp\standard2.0\ConditionalSerialization\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp\restsharp\standard2.0\Petstore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj diff --git a/bin/configs/csharp-generichost-net9-allOf.yaml b/bin/configs/csharp-generichost-net9-allOf.yaml new file mode 100644 index 000000000000..9a527a5b9fb9 --- /dev/null +++ b/bin/configs/csharp-generichost-net9-allOf.yaml @@ -0,0 +1,15 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net9/AllOf +inputSpec: modules/openapi-generator/src/test/resources/3_0/allOf.yaml +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: true + disallowAdditionalPropertiesIfNotPresent: false + nullableReferenceTypes: true + equatable: true + targetFramework: net9.0 + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical diff --git a/bin/configs/csharp-generichost-net9-anyOf.yaml b/bin/configs/csharp-generichost-net9-anyOf.yaml new file mode 100644 index 000000000000..8a9f57a28724 --- /dev/null +++ b/bin/configs/csharp-generichost-net9-anyOf.yaml @@ -0,0 +1,15 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net9/AnyOf +inputSpec: modules/openapi-generator/src/test/resources/3_0/anyOf.yaml +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: true + disallowAdditionalPropertiesIfNotPresent: false + nullableReferenceTypes: true + equatable: true + targetFramework: net9.0 + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical diff --git a/bin/configs/csharp-generichost-net9-anyOfNoCompare.yaml b/bin/configs/csharp-generichost-net9-anyOfNoCompare.yaml new file mode 100644 index 000000000000..34ff5d48ee4a --- /dev/null +++ b/bin/configs/csharp-generichost-net9-anyOfNoCompare.yaml @@ -0,0 +1,15 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare +inputSpec: modules/openapi-generator/src/test/resources/3_0/anyOf.yaml +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: false + disallowAdditionalPropertiesIfNotPresent: false + nullableReferenceTypes: true + equatable: true + targetFramework: net9.0 + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical diff --git a/bin/configs/csharp-generichost-net9-formModels.yaml b/bin/configs/csharp-generichost-net9-formModels.yaml new file mode 100644 index 000000000000..5533854a06aa --- /dev/null +++ b/bin/configs/csharp-generichost-net9-formModels.yaml @@ -0,0 +1,18 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net9/FormModels +inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: true + disallowAdditionalPropertiesIfNotPresent: false + nullableReferenceTypes: false + equatable: true + targetFramework: net9.0 + skipFormModel: false + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical +inlineSchemaOptions: + RESOLVE_INLINE_ENUMS: true diff --git a/bin/configs/csharp-generichost-net9-nrt-useSourceGeneration.yaml b/bin/configs/csharp-generichost-net9-nrt-useSourceGeneration.yaml new file mode 100644 index 000000000000..0bbff72763a0 --- /dev/null +++ b/bin/configs/csharp-generichost-net9-nrt-useSourceGeneration.yaml @@ -0,0 +1,15 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net9/SourceGeneration +inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: true + disallowAdditionalPropertiesIfNotPresent: false + useSourceGeneration: true + equatable: true + targetFramework: net9.0 + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical diff --git a/bin/configs/csharp-generichost-net9-nrt.yaml b/bin/configs/csharp-generichost-net9-nrt.yaml new file mode 100644 index 000000000000..cf03312ee4c5 --- /dev/null +++ b/bin/configs/csharp-generichost-net9-nrt.yaml @@ -0,0 +1,15 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net9/NullReferenceTypes +inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: true + disallowAdditionalPropertiesIfNotPresent: false + nullableReferenceTypes: true + equatable: true + targetFramework: net9.0 + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical diff --git a/bin/configs/csharp-generichost-net9-oneOf.yaml b/bin/configs/csharp-generichost-net9-oneOf.yaml new file mode 100644 index 000000000000..af07b34b5c3c --- /dev/null +++ b/bin/configs/csharp-generichost-net9-oneOf.yaml @@ -0,0 +1,15 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net9/OneOf +inputSpec: modules/openapi-generator/src/test/resources/3_0/oneOf.yaml +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: true + disallowAdditionalPropertiesIfNotPresent: false + nullableReferenceTypes: true + equatable: true + targetFramework: net9.0 + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical diff --git a/bin/configs/csharp-generichost-net9-useDateTimeForDate.yaml b/bin/configs/csharp-generichost-net9-useDateTimeForDate.yaml new file mode 100644 index 000000000000..a5ed3faf5330 --- /dev/null +++ b/bin/configs/csharp-generichost-net9-useDateTimeForDate.yaml @@ -0,0 +1,12 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate +inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/dates-api.yaml +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}' + useDateTimeForDate: true + targetFramework: net9.0 + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical diff --git a/bin/configs/csharp-generichost-net9.yaml b/bin/configs/csharp-generichost-net9.yaml new file mode 100644 index 000000000000..3bcf2a5d5e0d --- /dev/null +++ b/bin/configs/csharp-generichost-net9.yaml @@ -0,0 +1,15 @@ +# for csharp generichost +generatorName: csharp +outputDir: samples/client/petstore/csharp/generichost/net9/Petstore +inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +library: generichost +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: true + disallowAdditionalPropertiesIfNotPresent: false + nullableReferenceTypes: false + equatable: true + targetFramework: net9.0 + modelPropertySorting: alphabetical + operationParameterSorting: alphabetical diff --git a/bin/configs/csharp-restsharp-echo-api.yaml b/bin/configs/csharp-restsharp-echo-api.yaml deleted file mode 100644 index 4d93a0d3562d..000000000000 --- a/bin/configs/csharp-restsharp-echo-api.yaml +++ /dev/null @@ -1,10 +0,0 @@ -generatorName: csharp -outputDir: samples/client/echo_api/csharp-restsharp -inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml -templateDir: modules/openapi-generator/src/main/resources/csharp -additionalProperties: - packageGuid: '{322C8CAF-0156-40C1-AE42-D59761FB9B6C}' - targetFramework: net6.0 - setCompareNetObjects: "true" - hideGenerationTimestamp: "true" - equatable: true diff --git a/bin/configs/csharp-restsharp-net6.0-name-mappings.yaml b/bin/configs/csharp-restsharp-net6.0-name-mappings.yaml deleted file mode 100644 index c2941292d22f..000000000000 --- a/bin/configs/csharp-restsharp-net6.0-name-mappings.yaml +++ /dev/null @@ -1,19 +0,0 @@ -generatorName: csharp -outputDir: samples/client/petstore/csharp/restsharp/net6/ParameterMappings -inputSpec: modules/openapi-generator/src/test/resources/3_0/name-parameter-mappings.yaml -templateDir: modules/openapi-generator/src/main/resources/csharp -nameMappings: - _type: UnderscoreType - type_: TypeWithUnderscore - http_debug_operation: HttpDebugOperation -parameterNameMappings: - _type: UnderscoreType - type_: TypeWithUnderscore - http_debug_operation: HttpDebugOperation -modelNameMappings: - Environment: Env -additionalProperties: - packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' - hideGenerationTimestamp: "true" - targetFramework: net6.0 - equatable: true diff --git a/bin/configs/csharp-restsharp-net7.0-compareNetObjects.yaml b/bin/configs/csharp-restsharp-net7.0-compareNetObjects.yaml deleted file mode 100644 index c50ee0e0eb8d..000000000000 --- a/bin/configs/csharp-restsharp-net7.0-compareNetObjects.yaml +++ /dev/null @@ -1,9 +0,0 @@ -generatorName: csharp -outputDir: samples/client/petstore/csharp/restsharp/net7/Petstore -inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml -templateDir: modules/openapi-generator/src/main/resources/csharp -additionalProperties: - packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' - targetFramework: net7.0 - useCompareNetObjects: "true" - equatable: true diff --git a/bin/configs/csharp-restsharp-net7.0-useDateTimeForDate.yaml b/bin/configs/csharp-restsharp-net7.0-useDateTimeForDate.yaml deleted file mode 100644 index d385a2431dc1..000000000000 --- a/bin/configs/csharp-restsharp-net7.0-useDateTimeForDate.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# for .net standard -generatorName: csharp -outputDir: samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate -inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/dates-api.yaml -templateDir: modules/openapi-generator/src/main/resources/csharp -additionalProperties: - packageGuid: '{D0A67E81-4061-48EB-B4B8-C73BDF8B2D95}' - targetFramework: net7.0 - useDateTimeForDate: true diff --git a/bin/configs/csharp-restsharp-net7.0.yaml b/bin/configs/csharp-restsharp-net7.0.yaml deleted file mode 100644 index 061827eb7f3b..000000000000 --- a/bin/configs/csharp-restsharp-net7.0.yaml +++ /dev/null @@ -1,14 +0,0 @@ -# for .net standard -generatorName: csharp -outputDir: samples/client/petstore/csharp/restsharp/net7/EnumMappings -inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml -templateDir: modules/openapi-generator/src/main/resources/csharp -additionalProperties: - packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' - useCompareNetObjects: true - disallowAdditionalPropertiesIfNotPresent: false - useOneOfDiscriminatorLookup: true - targetFramework: net7.0 - equatable: true -enumNameMappings: - delivered: Shipped diff --git a/bin/configs/csharp-restsharp-net8-compareNetObjects.yaml b/bin/configs/csharp-restsharp-net8-compareNetObjects.yaml new file mode 100644 index 000000000000..306bf6856496 --- /dev/null +++ b/bin/configs/csharp-restsharp-net8-compareNetObjects.yaml @@ -0,0 +1,9 @@ +generatorName: csharp +outputDir: samples/client/petstore/csharp/restsharp/net8/Petstore +inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + targetFramework: net8.0 + useCompareNetObjects: "true" + equatable: true diff --git a/bin/configs/csharp-restsharp-net8-echo-api.yaml b/bin/configs/csharp-restsharp-net8-echo-api.yaml new file mode 100644 index 000000000000..7f24b0c5f533 --- /dev/null +++ b/bin/configs/csharp-restsharp-net8-echo-api.yaml @@ -0,0 +1,10 @@ +generatorName: csharp +outputDir: samples/client/echo_api/csharp/restsharp/net8/EchoApi +inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{322C8CAF-0156-40C1-AE42-D59761FB9B6C}' + targetFramework: net8.0 + setCompareNetObjects: "true" + hideGenerationTimestamp: "true" + equatable: true diff --git a/bin/configs/csharp-restsharp-net8-name-mappings.yaml b/bin/configs/csharp-restsharp-net8-name-mappings.yaml new file mode 100644 index 000000000000..a46dc8620434 --- /dev/null +++ b/bin/configs/csharp-restsharp-net8-name-mappings.yaml @@ -0,0 +1,19 @@ +generatorName: csharp +outputDir: samples/client/petstore/csharp/restsharp/net8/ParameterMappings +inputSpec: modules/openapi-generator/src/test/resources/3_0/name-parameter-mappings.yaml +templateDir: modules/openapi-generator/src/main/resources/csharp +nameMappings: + _type: UnderscoreType + type_: TypeWithUnderscore + http_debug_operation: HttpDebugOperation +parameterNameMappings: + _type: UnderscoreType + type_: TypeWithUnderscore + http_debug_operation: HttpDebugOperation +modelNameMappings: + Environment: Env +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + hideGenerationTimestamp: "true" + targetFramework: net8.0 + equatable: true diff --git a/bin/configs/csharp-restsharp-net8-useDateTimeForDate.yaml b/bin/configs/csharp-restsharp-net8-useDateTimeForDate.yaml new file mode 100644 index 000000000000..f8b2102196ab --- /dev/null +++ b/bin/configs/csharp-restsharp-net8-useDateTimeForDate.yaml @@ -0,0 +1,9 @@ +# for .net standard +generatorName: csharp +outputDir: samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate +inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/dates-api.yaml +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{D0A67E81-4061-48EB-B4B8-C73BDF8B2D95}' + targetFramework: net8.0 + useDateTimeForDate: true diff --git a/bin/configs/csharp-restsharp-net8.yaml b/bin/configs/csharp-restsharp-net8.yaml new file mode 100644 index 000000000000..a99fb1acf095 --- /dev/null +++ b/bin/configs/csharp-restsharp-net8.yaml @@ -0,0 +1,14 @@ +# for .net standard +generatorName: csharp +outputDir: samples/client/petstore/csharp/restsharp/net8/EnumMappings +inputSpec: modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature-oneof-primitive-types.yaml +templateDir: modules/openapi-generator/src/main/resources/csharp +additionalProperties: + packageGuid: '{321C8C3F-0156-40C1-AE42-D59761FB9B6C}' + useCompareNetObjects: true + disallowAdditionalPropertiesIfNotPresent: false + useOneOfDiscriminatorLookup: true + targetFramework: net8.0 + equatable: true +enumNameMappings: + delivered: Shipped diff --git a/bin/configs/javascript-es6.yaml b/bin/configs/javascript-es6.yaml index bc9562f93e76..a88a20d55af3 100644 --- a/bin/configs/javascript-es6.yaml +++ b/bin/configs/javascript-es6.yaml @@ -5,6 +5,7 @@ inputSpec: modules/openapi-generator/src/test/resources/3_0/javascript/petstore- templateDir: modules/openapi-generator/src/main/resources/Javascript additionalProperties: appName: PetstoreClient + skipDefaultUserAgent: true modelNameMappings: HealthCheckResult: HealthCheckStatus parameterNameMappings: diff --git a/docs/3.0.0-release-note.md b/docs/3.0.0-release-note.md index b2127975817e..e61130b9fde7 100644 --- a/docs/3.0.0-release-note.md +++ b/docs/3.0.0-release-note.md @@ -10,7 +10,7 @@ sidebar_label: "Release Notes: 3.0.0" * e58dc2c77 Fix COPY in Dockerfile (#64) * 9d7feaaeb Fix online generator (docker push) (#58) * 9247cd01e Changes for Docker -* 64037ee59 update docker-related files to ues jdk8 +* 64037ee59 update docker-related files to use jdk8 * ## Plug-ins * b6b8c0db8 \[gradle-plugin] Initial implementation (#162) diff --git a/docs/customization.md b/docs/customization.md index f0026728d1c1..89b6a4e4bd51 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -266,7 +266,7 @@ Upon first code generation, you may also pass the CLI option `--ignore-file-over Editor support for `.openapi-generator-ignore` files is available in IntelliJ via the [.ignore plugin](https://plugins.jetbrains.com/plugin/7495--ignore). -One may want to pre-populate `.openapi-generator-ignore` with a list of entries during the code generation process and the global/general option `openapiGeneatorIgnoreList` (e.g. --openapi-generator-ignore-list in CLI) can do exactly that. For example, +One may want to pre-populate `.openapi-generator-ignore` with a list of entries during the code generation process and the global/general option `openapiGeneratorIgnoreList` (e.g. --openapi-generator-ignore-list in CLI) can do exactly that. For example, ``` java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g spring -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/spring --additional-properties useTags=true --openapi-generator-ignore-list "README.md,pom.xml,docs/*.md,src/main/java/org/openapitools/model/*" ``` @@ -434,9 +434,9 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat ``` will rename SOLD to UNAVAILABLE instead. -Not all generators support thess features yet. Please give it a try to confirm the behaviour and open an issue (ticket) to let us know which generators you would like to have this feature enabled and we'll prioritize accordingly. We also welcome PRs to add these features to generators. Related PRs for reference: #16209, #16234 (modelNameMappings), #16194, #16206 (nameMappings, parameterNameMappings), #17108 (enumNameMappings). +Not all generators support these features yet. Please give it a try to confirm the behaviour and open an issue (ticket) to let us know which generators you would like to have this feature enabled and we'll prioritize accordingly. We also welcome PRs to add these features to generators. Related PRs for reference: #16209, #16234 (modelNameMappings), #16194, #16206 (nameMappings, parameterNameMappings), #17108 (enumNameMappings). -NOTE: some generators use `baseName` (original name obtained direclty from OpenAPI spec, e.g. `shipping-date`) mustache tag in the templates so the mapping feature won't work. +NOTE: some generators use `baseName` (original name obtained directly from OpenAPI spec, e.g. `shipping-date`) mustache tag in the templates so the mapping feature won't work. To map `operationId` (used in method naming) to something else, use `operationIdNameMappings` option, e.g. @@ -480,7 +480,7 @@ paths: ## Inline Schema Naming -Inline schemas are created as separate schemas automatically and the auto-generated schema name may not look good to everyone. One can customize the name using the `title` field or the `inlineSchemaNameMapping` option. For exmaple, run the following, +Inline schemas are created as separate schemas automatically and the auto-generated schema name may not look good to everyone. One can customize the name using the `title` field or the `inlineSchemaNameMapping` option. For example, run the following, ``` java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/inline_model_resolver.yaml -o /tmp/java3/ --skip-validate-spec --inline-schema-name-mappings inline_object_2=SomethingMapped,inline_object_4=nothing_new @@ -503,7 +503,7 @@ Another useful option is `inlineSchemaOptions`, which allows you to customize ho - `ARRAY_ITEM_SUFFIX` sets the array item suffix - `MAP_ITEM_SUFFIX` set the map item suffix - `SKIP_SCHEMA_REUSE=true` is a special value to skip reusing inline schemas during refactoring -- `REFACTOR_ALLOF_INLINE_SCHEMAS=true` will restore the 6.x (or below) behaviour to refactor allOf inline schemas into $ref. (v7.0.0 will skip the refactoring of these allOf inline schmeas by default) +- `REFACTOR_ALLOF_INLINE_SCHEMAS=true` will restore the 6.x (or below) behaviour to refactor allOf inline schemas into $ref. (v7.0.0 will skip the refactoring of these allOf inline schemas by default) - `RESOLVE_INLINE_ENUMS=true` will refactor inline enum definitions into $ref ## OpenAPI Normalizer @@ -524,7 +524,7 @@ Example: java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g java -i modules/openapi-generator/src/test/resources/3_0/allOf_extension_parent.yaml -o /tmp/java-okhttp/ --openapi-normalizer REF_AS_PARENT_IN_ALLOF=true ``` -- `REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY`: when set to `true`, oneOf/anyOf schema with only required properies only in a schema with properties will be removed. [(example)](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml) +- `REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY`: when set to `true`, oneOf/anyOf schema with only required properties only in a schema with properties will be removed. [(example)](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml) Example: ``` diff --git a/docs/generators/csharp.md b/docs/generators/csharp.md index 4e07b6f4fc8d..48d3072ce725 100644 --- a/docs/generators/csharp.md +++ b/docs/generators/csharp.md @@ -47,7 +47,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |releaseNote|Release note, default to 'Minor update'.| |Minor update| |returnICollection|Return ICollection<T> instead of the concrete type.| |false| |sourceFolder|source folder for generated code| |src| -|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.1`|
**netstandard1.3**
.NET Standard 1.3
**netstandard1.4**
.NET Standard 1.4
**netstandard1.5**
.NET Standard 1.5
**netstandard1.6**
.NET Standard 1.6
**netstandard2.0**
.NET Standard 2.0
**netstandard2.1**
.NET Standard 2.1
**net47**
.NET Framework 4.7
**net48**
.NET Framework 4.8
**net6.0**
.NET 6.0 (End of Support 12 November 2024)
**net7.0**
.NET 7.0
**net8.0**
.NET 8.0
|net8.0| +|targetFramework|The target .NET framework version. To target multiple frameworks, use `;` as the separator, e.g. `netstandard2.1;netcoreapp3.1`|
**netstandard1.3**
.NET Standard 1.3
**netstandard1.4**
.NET Standard 1.4
**netstandard1.5**
.NET Standard 1.5
**netstandard1.6**
.NET Standard 1.6
**netstandard2.0**
.NET Standard 2.0
**netstandard2.1**
.NET Standard 2.1
**net47**
.NET Framework 4.7
**net48**
.NET Framework 4.8
**net6.0**
.NET 6.0 (End of Support 12 November 2024)
**net7.0**
.NET 7.0
**net8.0**
.NET 8.0
**net9.0**
.NET 9.0
|net9.0| |useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false| |useDateTimeForDate|Use DateTime to model date properties even if DateOnly supported. (.net 6.0+ only)| |false| |useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false| diff --git a/docs/generators/javascript.md b/docs/generators/javascript.md index a10b56ae084b..6921b32ca093 100644 --- a/docs/generators/javascript.md +++ b/docs/generators/javascript.md @@ -38,6 +38,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |projectDescription|description of the project (Default: using info.description or "Client library of <projectName>")| |null| |projectName|name of the project (Default: generated from info.title or "openapi-js-client")| |null| |projectVersion|version of the project (Default: using info.version or "1.0.0")| |null| +|skipDefaultUserAgent|Skip setting default user-agent in ApiClient.js| |false| |sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true| |sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| |sourceFolder|source folder for generated code| |src| diff --git a/docs/generators/swift5.md b/docs/generators/swift5.md index a46bd33730f3..9d565bf5993f 100644 --- a/docs/generators/swift5.md +++ b/docs/generators/swift5.md @@ -56,7 +56,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useCustomDateWithoutTime|Uses a custom type to decode and encode dates without time information to support OpenAPIs date format (default: false)| |false| |useJsonEncodable|Make models conform to JSONEncodable protocol (default: true)| |true| |useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: false).| |null| -|validatable|Make validation rules and validator for model properies (default: true)| |true| +|validatable|Make validation rules and validator for model properties (default: true)| |true| ## IMPORT MAPPING diff --git a/docs/generators/swift6.md b/docs/generators/swift6.md index b80a1d7996ab..a49865462eba 100644 --- a/docs/generators/swift6.md +++ b/docs/generators/swift6.md @@ -58,7 +58,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |useCustomDateWithoutTime|Uses a custom type to decode and encode dates without time information to support OpenAPIs date format (default: false)| |false| |useJsonEncodable|Make models conform to JSONEncodable protocol (default: true)| |true| |useSPMFileStructure|Use SPM file structure and set the source path to Sources/{{projectName}} (default: true).| |null| -|validatable|Make validation rules and validator for model properies (default: true)| |true| +|validatable|Make validation rules and validator for model properties (default: true)| |true| ## IMPORT MAPPING diff --git a/docs/installation.md b/docs/installation.md index 39e93a7d5298..fa62f6d98986 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -77,6 +77,22 @@ Then, **generate** a ruby client from a valid [petstore.yaml](https://raw.github openapi-generator-cli generate -i petstore.yaml -g ruby ``` +## PyPI + +> **Platform(s)**: Linux, macOS, Windows + +**Install** via [PyPI](https://pypi.org/) (`java` executable is needed to run): + +``` +pip install openapi-generator-cli +``` + +You can also install with [jdk4py](https://github.com/activeviam/jdk4py) instead of java binary. (python>=3.10 is required) + +``` +pip install openapi-generator-cli[jdk4py] +``` + ## Docker > **Platform(s)**: Linux, macOS, Windows diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties index 5e866d418582..6af9e93d25d9 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties @@ -1,3 +1,3 @@ # RELEASE_VERSION -openApiGeneratorVersion=7.10.0-SNAPSHOT +openApiGeneratorVersion=7.11.0-SNAPSHOT # /RELEASE_VERSION 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 7fa87c399681..792ca0dda2c0 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 @@ -865,7 +865,7 @@ public void execute() throws MojoExecutionException { } // Apply Parameter Name Mappings - if (parameterNameMappings != null && (configOptions == null || !configOptions.containsKey("paramter-name-mappings"))) { + if (parameterNameMappings != null && (configOptions == null || !configOptions.containsKey("parameter-name-mappings"))) { applyParameterNameMappingsKvpList(parameterNameMappings, configurator); } 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 d8b577c93cae..a015dee2a21b 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 @@ -1942,9 +1942,9 @@ public String toInstantiationType(Schema schema) { if (ModelUtils.isMapSchema(schema)) { Schema additionalProperties = ModelUtils.getAdditionalProperties(schema); String inner = getSchemaType(additionalProperties); - String mapInstantion = instantiationTypes.get("map"); - if (mapInstantion != null) { - return mapInstantion + ""; + String mapInstantiation = instantiationTypes.get("map"); + if (mapInstantiation != null) { + return mapInstantiation + ""; } return inner; } else if (ModelUtils.isArraySchema(schema)) { @@ -2217,7 +2217,7 @@ public String toDefaultValueWithParam(String name, Schema schema) { * @return string presentation of the default value of the property */ public String toDefaultValue(CodegenProperty codegenProperty, Schema schema) { - // use toDefaultValue(schema) if generator has not overriden this method + // use toDefaultValue(schema) if generator has not overridden this method return toDefaultValue(schema); } @@ -3149,7 +3149,7 @@ protected void setAddProps(Schema schema, IJsonSchemaValidationProperties proper // if we are trying to set additionalProperties on an empty schema stop recursing return; } - // Note: This flag is set to true if additioanl properties + // Note: This flag is set to true if additional properties // is set (any type, free form object, boolean true, string, etc). // The variable name may be renamed later to avoid confusion. boolean additionalPropertiesIsAnyType = false; @@ -3989,7 +3989,7 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo property._enum = new ArrayList<>(); for (Object i : _enum) { // raw null values in enums are unions for nullable - // atttributes, not actual enum values, so we remove them here + // attributes, not actual enum values, so we remove them here if (i == null) { property.isNullable = true; continue; @@ -4001,7 +4001,7 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required, boo Map allowableValues = new HashMap<>(); allowableValues.put("values", _enum); - if (allowableValues.size() > 0) { + if (!allowableValues.isEmpty()) { property.allowableValues = allowableValues; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java index a54542c1243c..8cdf045a4249 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/InlineModelResolver.java @@ -629,7 +629,7 @@ private void flattenComponentResponses() { * breed: * type: string * - * @param key a unique name ofr the composed schema. + * @param key a unique name for the composed schema. * @param children the list of nested schemas within a composed schema (allOf, anyOf, oneOf). * @param skipAllOfInlineSchemas true if allOf inline schemas need to be skipped. */ diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java index 44fa54695702..25265ef0f548 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/OpenAPINormalizer.java @@ -836,7 +836,7 @@ private Schema normalizeComplexComposedSchema(Schema schema, Set visited } // ===================== a list of rules ===================== - // all rules (fuctions) start with the word "process" + // all rules (functions ) start with the word "process" /** * Child schemas in `allOf` is considered a parent if it's a `$ref` (instead of inline schema). 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 399134bfcd6a..960a5c8d71a2 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 @@ -936,7 +936,7 @@ private boolean startsWithTwoUppercaseLetters(String name) { @Override public String toParamName(String name) { - // obtain the name from paramterNameMapping directly if provided + // obtain the name from parameterNameMapping directly if provided if (parameterNameMapping.containsKey(name)) { return parameterNameMapping.get(name); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJuliaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJuliaCodegen.java index 81cee1d2786c..b8a628ed5271 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJuliaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJuliaCodegen.java @@ -173,7 +173,7 @@ protected static String dropDots(String str) { /** * Escapes a reserved word as defined in the `reservedWords` array. Handle escaping - * those terms here. This logic is only called if a variable matches the reseved words + * those terms here. This logic is only called if a variable matches the reserved words * * @return the escaped term */ diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java index 6c49ce78fd74..f6813081563c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java @@ -1185,7 +1185,7 @@ private String getModelNameFromDataType(CodegenProperty cp) { } /** - * Update set of imports from codegen model recursivly + * Update set of imports from codegen model recursively * * @param modelName model name * @param cm codegen model @@ -1362,7 +1362,7 @@ public void postProcessPattern(String pattern, Map vendorExtensi if (pattern != null) { int i = pattern.lastIndexOf('/'); - // TOOD update the check below follow python convention + // TODO update the check below follow python convention //Must follow Perl /pattern/modifiers convention if (pattern.charAt(0) != '/' || i < 2) { throw new IllegalArgumentException("Pattern must follow the Perl " diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java index 58808b6b01a1..c697bc8f2346 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java @@ -1687,7 +1687,7 @@ private String getModelNameFromDataType(CodegenProperty cp) { } /** - * Update set of imports from codegen model recursivly + * Update set of imports from codegen model recursively * * @param modelName model name * @param cm codegen model @@ -1896,7 +1896,7 @@ public void postProcessPattern(String pattern, Map vendorExtensi if (pattern != null) { int i = pattern.lastIndexOf('/'); - // TOOD update the check below follow python convention + // TODO update the check below follow python convention //Must follow Perl /pattern/modifiers convention if (pattern.charAt(0) != '/' || i < 2) { throw new IllegalArgumentException("Pattern must follow the Perl " diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java index f260a33dd32b..2ed30b2f8136 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java @@ -75,6 +75,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { protected static final String NET_60_OR_LATER = "net60OrLater"; protected static final String NET_70_OR_LATER = "net70OrLater"; protected static final String NET_80_OR_LATER = "net80OrLater"; + protected static final String NET_90_OR_LATER = "net90OrLater"; @SuppressWarnings("hiding") private final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class); @@ -89,7 +90,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { FrameworkStrategy.NETFRAMEWORK_4_8, FrameworkStrategy.NET_6_0, FrameworkStrategy.NET_7_0, - FrameworkStrategy.NET_8_0 + FrameworkStrategy.NET_8_0, + FrameworkStrategy.NET_9_0 ); private static FrameworkStrategy latestFramework = frameworkStrategies.get(frameworkStrategies.size() - 1); protected final Map frameworks; @@ -1432,6 +1434,8 @@ private static abstract class FrameworkStrategy { }; static FrameworkStrategy NET_8_0 = new FrameworkStrategy("net8.0", ".NET 8.0", "net8.0", Boolean.FALSE) { }; + static FrameworkStrategy NET_9_0 = new FrameworkStrategy("net9.0", ".NET 9.0", "net9.0", Boolean.FALSE) { + }; protected String name; protected String description; protected String testTargetFramework; @@ -1550,6 +1554,18 @@ protected void configureAdditionalPropertiesForFrameworks(final Map "net9.0".equals(p.name))) { + properties.put(NET_STANDARD_14_OR_LATER, true); + properties.put(NET_STANDARD_15_OR_LATER, true); + properties.put(NET_STANDARD_16_OR_LATER, true); + properties.put(NET_STANDARD_20_OR_LATER, true); + properties.put(NET_STANDARD_21_OR_LATER, true); + properties.put(NET_47_OR_LATER, true); + properties.put(NET_48_OR_LATER, true); + properties.put(NET_60_OR_LATER, true); + properties.put(NET_70_OR_LATER, true); + properties.put(NET_80_OR_LATER, true); + properties.put(NET_90_OR_LATER, true); } else { throw new RuntimeException("Unhandled case"); } 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 25588dfa7eac..bf1ca99b64f1 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 @@ -335,7 +335,7 @@ public String apiFileFolder() { } /** - * Location of created model files (it can be overriden using --additional-properties in openapi-generator-cli + * Location of created model files (it can be overridden using --additional-properties in openapi-generator-cli */ @Override public String modelFileFolder() { 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 d56f102f7e0c..726a05d1a615 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 @@ -320,7 +320,7 @@ public void processOpts() { dateLibrary = "legacy"; } super.processOpts(); - // default jackson unless overriden by setSerializationLibrary + // default jackson unless overridden by setSerializationLibrary this.jackson = !additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY) || SERIALIZATION_LIBRARY_JACKSON.equals(additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY)); convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ONEOF_DISCRIMINATOR_LOOKUP, this::setUseOneOfDiscriminatorLookup); 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 3fbe56e863d5..83c7550546f8 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 @@ -58,30 +58,44 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo public static final String USE_ES6 = "useES6"; public static final String NPM_REPOSITORY = "npmRepository"; public static final String USE_URL_SEARCH_PARAMS = "useURLSearchParams"; + public static final String SKIP_DEFAULT_USER_AGENT = "skipDefaultUserAgent"; public static final String LIBRARY_JAVASCRIPT = "javascript"; public static final String LIBRARY_APOLLO = "apollo"; - @Setter protected String projectName; - @Setter protected String moduleName; - @Setter protected String projectDescription; - @Setter protected String projectVersion; - @Setter protected String licenseName; - - @Getter @Setter + @Setter + protected String projectName; + @Setter + protected String moduleName; + @Setter + protected String projectDescription; + @Setter + protected String projectVersion; + @Setter + protected String licenseName; + + @Getter + @Setter protected String invokerPackage; - @Setter protected String sourceFolder = "src"; - @Setter protected boolean usePromises; - @Setter protected boolean emitModelMethods; - @Setter protected boolean emitJSDoc = true; + @Setter + protected String sourceFolder = "src"; + @Setter + protected boolean usePromises; + @Setter + protected boolean emitModelMethods; + @Setter + protected boolean emitJSDoc = true; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; protected String apiTestPath = "api/"; protected String modelTestPath = "model/"; protected boolean useES6 = true; // default is ES6 - @Setter protected String npmRepository = null; - @Getter private String modelPropertyNaming = "camelCase"; - @Setter protected boolean useURLSearchParams = true; + @Setter + protected String npmRepository = null; + @Getter + private String modelPropertyNaming = "camelCase"; + @Setter + protected boolean useURLSearchParams = true; public JavascriptClientCodegen() { super(); @@ -196,6 +210,9 @@ public JavascriptClientCodegen() { "use JS build-in UrlSearchParams, instead of deprecated npm lib 'querystring'") .defaultValue(Boolean.TRUE.toString()) ); + cliOptions.add(new CliOption(SKIP_DEFAULT_USER_AGENT, + "Skip setting default user-agent in ApiClient.js") + .defaultValue(Boolean.FALSE.toString())); supportedLibraries.put(LIBRARY_JAVASCRIPT, "JavaScript client library"); supportedLibraries.put(LIBRARY_APOLLO, "Apollo REST DataSource"); @@ -1186,7 +1203,7 @@ public void postProcessFile(File file, String fileType) { // only process files with js extension if ("js".equals(FilenameUtils.getExtension(file.toString()))) { - this.executePostProcessor(new String[] {jsPostProcessFile, file.toString()}); + this.executePostProcessor(new String[]{jsPostProcessFile, file.toString()}); } } 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 c9b6d6dc23d0..7d31d780511f 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 @@ -793,7 +793,7 @@ private void processJVMOkHttpLibrary(final String infrastructureFolder) { supportingFiles.add(new SupportingFile("infrastructure/ApiResponse.kt.mustache", infrastructureFolder, "ApiResponse.kt")); } - private void proccessJvmSpring(final String infrastructureFolder) { + private void processJvmSpring(final String infrastructureFolder) { if (getSerializationLibrary() != SERIALIZATION_LIBRARY_TYPE.jackson) { throw new RuntimeException("This library currently only supports jackson serialization. Try adding '--additional-properties serializationLibrary=jackson' to your command."); } @@ -806,7 +806,7 @@ private void proccessJvmSpring(final String infrastructureFolder) { } private void processJvmSpringWebClientLibrary(final String infrastructureFolder) { - proccessJvmSpring(infrastructureFolder); + processJvmSpring(infrastructureFolder); additionalProperties.put(JVM_SPRING_WEBCLIENT, true); } @@ -815,7 +815,7 @@ private void processJvmSpringRestClientLibrary(final String infrastructureFolder throw new RuntimeException("This library must use Spring Boot 3. Try adding '--additional-properties useSpringBoot3=true' to your command."); } - proccessJvmSpring(infrastructureFolder); + processJvmSpring(infrastructureFolder); additionalProperties.put(JVM_SPRING_RESTCLIENT, true); } 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 05e56b0facf2..6a483ca6e8d3 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 @@ -639,6 +639,14 @@ public void processOpts() { supportingFiles.add(new SupportingFile("buildGradleKts.mustache", "", "build.gradle.kts")); } supportingFiles.add(new SupportingFile("settingsGradle.mustache", "", "settings.gradle")); + + String gradleWrapperPackage = "gradle.wrapper"; + supportingFiles.add(new SupportingFile("gradlew.mustache", "", "gradlew")); + supportingFiles.add(new SupportingFile("gradlew.bat.mustache", "", "gradlew.bat")); + supportingFiles.add(new SupportingFile("gradle-wrapper.properties.mustache", + gradleWrapperPackage.replace(".", File.separator), "gradle-wrapper.properties")); + supportingFiles.add(new SupportingFile("gradle-wrapper.jar", + gradleWrapperPackage.replace(".", File.separator), "gradle-wrapper.jar")); } if (!this.interfaceOnly) { @@ -677,6 +685,14 @@ public void processOpts() { supportingFiles.add(new SupportingFile("buildGradleKts.mustache", "build.gradle.kts")); } supportingFiles.add(new SupportingFile("settingsGradle.mustache", "settings.gradle")); + + String gradleWrapperPackage = "gradle.wrapper"; + supportingFiles.add(new SupportingFile("gradlew.mustache", "", "gradlew")); + supportingFiles.add(new SupportingFile("gradlew.bat.mustache", "", "gradlew.bat")); + supportingFiles.add(new SupportingFile("gradle-wrapper.properties.mustache", + gradleWrapperPackage.replace(".", File.separator), "gradle-wrapper.properties")); + supportingFiles.add(new SupportingFile("gradle-wrapper.jar", + gradleWrapperPackage.replace(".", File.separator), "gradle-wrapper.jar")); } // @RequestMapping not supported with spring cloud openfeign. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java index 6f79932b56fe..43ea920fe504 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpNextgenClientCodegen.java @@ -34,11 +34,7 @@ import org.slf4j.LoggerFactory; import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.EnumSet; -import java.util.List; -import java.util.Map; +import java.util.*; public class PhpNextgenClientCodegen extends AbstractPhpCodegen { @SuppressWarnings("hiding") @@ -189,21 +185,40 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List phpReturnTypeOptions = new LinkedHashSet<>(); + Set docReturnTypeOptions = new LinkedHashSet<>(); + + for (CodegenResponse response : operation.responses) { + if (response.dataType != null) { + String returnType = response.dataType; + if (response.isArray || response.isMap) { + // PHP does not understand array type hinting so we strip it + // The phpdoc will still contain the array type hinting + returnType = "array"; + } + + phpReturnTypeOptions.add(returnType); + docReturnTypeOptions.add(response.dataType); + } + } + + if (phpReturnTypeOptions.isEmpty()) { operation.vendorExtensions.putIfAbsent("x-php-return-type", "void"); + operation.vendorExtensions.putIfAbsent("x-php-doc-return-type", "void"); } else { - if (operation.returnProperty.isContainer) { // array or map - operation.vendorExtensions.putIfAbsent("x-php-return-type", "array"); - } else { - operation.vendorExtensions.putIfAbsent("x-php-return-type", operation.returnType); - } + operation.vendorExtensions.putIfAbsent("x-php-return-type", String.join("|", phpReturnTypeOptions)); + operation.vendorExtensions.putIfAbsent("x-php-doc-return-type", String.join("|", docReturnTypeOptions)); } for (CodegenParameter param : operation.allParams) { if (param.isArray || param.isMap) { param.vendorExtensions.putIfAbsent("x-php-param-type", "array"); } else { - param.vendorExtensions.putIfAbsent("x-php-param-type", param.dataType); + String paramType = param.dataType; + if ((!param.required || param.isNullable) && !paramType.equals("mixed")) { // optional or nullable but not mixed + paramType = "?" + paramType; + } + param.vendorExtensions.putIfAbsent("x-php-param-type", paramType); } } } 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 c0d3accc11a1..76c4c51ca7c1 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 @@ -1226,7 +1226,7 @@ public CodegenModel fromModel(String name, Schema model) { } } - // Do we suppport doing ToString/FromStr conversions for query parameters? + // Do we support doing ToString/FromStr conversions for query parameters? boolean toStringSupport = true; boolean isString = "String".equals(mdl.dataType); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java index b257e2eba22d..9339370f286e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaCaskServerCodegen.java @@ -1179,7 +1179,7 @@ private static String queryArgs(final CodegenOperation op) { *

* The data variant can have nulls and other non-scala things, but they know how to create validated model objects. *

- * This 'asScalaDataType' is used to ensure the type hierarchy is correct for both the model and data varients. + * This 'asScalaDataType' is used to ensure the type hierarchy is correct for both the model and data variants. *

* e.g. consider this example: * ``` 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 2b359ebc521b..9a613c3bb67b 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 @@ -1079,7 +1079,7 @@ private Set reformatProvideArgsParams(Operation operation) { if (argObj instanceof List) { List provideArgs = (List) argObj; if (!provideArgs.isEmpty()) { - List formatedArgs = new ArrayList<>(); + List formattedArgs = new ArrayList<>(); for (String oneArg : provideArgs) { if (StringUtils.isNotEmpty(oneArg)) { String regexp = "(?@)?(?(?(\\w+\\.)*)(?\\w+))(?\\(.*?\\))?\\s?"; @@ -1101,10 +1101,10 @@ private Set reformatProvideArgsParams(Operation operation) { } String newArg = String.join(" ", newArgs); LOGGER.trace("new arg {} {}", newArg); - formatedArgs.add(newArg); + formattedArgs.add(newArg); } } - operation.getExtensions().put("x-spring-provide-args", formatedArgs); + operation.getExtensions().put("x-spring-provide-args", formattedArgs); } } return provideArgsClassSet; 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 16ce68597cbb..b39fdf1e52b7 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 @@ -84,25 +84,43 @@ public class Swift5ClientCodegen extends DefaultCodegen implements CodegenConfig protected static final String RESPONSE_LIBRARY_COMBINE = "Combine"; protected static final String RESPONSE_LIBRARY_ASYNC_AWAIT = "AsyncAwait"; protected static final String[] RESPONSE_LIBRARIES = {RESPONSE_LIBRARY_PROMISE_KIT, RESPONSE_LIBRARY_RX_SWIFT, RESPONSE_LIBRARY_RESULT, RESPONSE_LIBRARY_COMBINE, RESPONSE_LIBRARY_ASYNC_AWAIT}; - @Setter protected String projectName = "OpenAPIClient"; - @Setter protected boolean nonPublicApi = false; - @Setter protected boolean objcCompatible = false; - @Setter protected boolean readonlyProperties = false; - @Setter protected boolean swiftUseApiNamespace = false; - @Setter protected boolean useSPMFileStructure = false; - @Setter protected String swiftPackagePath = "Classes" + File.separator + "OpenAPIs"; - @Setter protected boolean oneOfUnknownDefaultCase = false; - @Setter protected boolean useClasses = false; - @Setter protected boolean useBacktickEscapes = false; - @Setter protected boolean generateModelAdditionalProperties = true; - @Setter protected boolean hashableModels = true; - @Setter protected boolean identifiableModels = true; - @Setter protected boolean useJsonEncodable = true; - @Getter @Setter + @Setter + protected String projectName = "OpenAPIClient"; + @Setter + protected boolean nonPublicApi = false; + @Setter + protected boolean objcCompatible = false; + @Setter + protected boolean readonlyProperties = false; + @Setter + protected boolean swiftUseApiNamespace = false; + @Setter + protected boolean useSPMFileStructure = false; + @Setter + protected String swiftPackagePath = "Classes" + File.separator + "OpenAPIs"; + @Setter + protected boolean oneOfUnknownDefaultCase = false; + @Setter + protected boolean useClasses = false; + @Setter + protected boolean useBacktickEscapes = false; + @Setter + protected boolean generateModelAdditionalProperties = true; + @Setter + protected boolean hashableModels = true; + @Setter + protected boolean identifiableModels = true; + @Setter + protected boolean useJsonEncodable = true; + @Getter + @Setter protected boolean mapFileBinaryToData = false; - @Setter protected boolean useCustomDateWithoutTime = false; - @Setter protected boolean validatable = true; - @Setter protected String[] responseAs = new String[0]; + @Setter + protected boolean useCustomDateWithoutTime = false; + @Setter + protected boolean validatable = true; + @Setter + protected String[] responseAs = new String[0]; protected String sourceFolder = swiftPackagePath; protected HashSet objcReservedWords; protected String apiDocPath = "docs/"; @@ -322,7 +340,7 @@ public Swift5ClientCodegen() { .defaultValue(Boolean.FALSE.toString())); cliOptions.add(new CliOption(VALIDATABLE, - "Make validation rules and validator for model properies (default: true)") + "Make validation rules and validator for model properties (default: true)") .defaultValue(Boolean.TRUE.toString())); supportedLibraries.put(LIBRARY_URLSESSION, "[DEFAULT] HTTP client: URLSession"); @@ -1189,7 +1207,7 @@ public void postProcessFile(File file, String fileType) { } // only process files with swift extension if ("swift".equals(FilenameUtils.getExtension(file.toString()))) { - this.executePostProcessor(new String[] {swiftPostProcessFile, file.toString()}); + this.executePostProcessor(new String[]{swiftPostProcessFile, file.toString()}); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java index 8c1bb2e0ffc7..5c665e8e3974 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift6ClientCodegen.java @@ -86,27 +86,48 @@ public class Swift6ClientCodegen extends DefaultCodegen implements CodegenConfig protected static final String RESPONSE_LIBRARY_COMBINE = "Combine"; protected static final String RESPONSE_LIBRARY_ASYNC_AWAIT = "AsyncAwait"; protected static final String RESPONSE_LIBRARY_OBJC_BLOCK = "ObjcBlock"; - protected static final String[] RESPONSE_LIBRARIES = { RESPONSE_LIBRARY_ASYNC_AWAIT, RESPONSE_LIBRARY_COMBINE, RESPONSE_LIBRARY_RESULT, RESPONSE_LIBRARY_RX_SWIFT, RESPONSE_LIBRARY_OBJC_BLOCK, RESPONSE_LIBRARY_PROMISE_KIT }; - @Setter protected String projectName = "OpenAPIClient"; - @Setter protected boolean nonPublicApi = false; - @Setter protected boolean objcCompatible = false; - @Setter protected boolean readonlyProperties = false; - @Setter protected boolean swiftUseApiNamespace = false; - @Setter protected boolean useSPMFileStructure = true; - @Setter protected String swiftPackagePath = "Sources" + File.separator + projectName; - @Setter protected boolean oneOfUnknownDefaultCase = false; - @Setter protected boolean useClasses = false; - @Setter protected boolean useBacktickEscapes = false; - @Setter protected boolean generateModelAdditionalProperties = true; - @Setter protected boolean hashableModels = true; - @Setter protected boolean identifiableModels = true; - @Setter protected boolean useJsonEncodable = true; - @Getter @Setter protected boolean mapFileBinaryToData = false; - @Setter protected boolean useCustomDateWithoutTime = false; - @Setter protected boolean validatable = true; - @Setter protected boolean apiStaticMethod = true; - @Setter protected boolean combineDeferred = true; - @Setter protected String[] responseAs = { RESPONSE_LIBRARY_ASYNC_AWAIT }; + protected static final String[] RESPONSE_LIBRARIES = {RESPONSE_LIBRARY_ASYNC_AWAIT, RESPONSE_LIBRARY_COMBINE, RESPONSE_LIBRARY_RESULT, RESPONSE_LIBRARY_RX_SWIFT, RESPONSE_LIBRARY_OBJC_BLOCK, RESPONSE_LIBRARY_PROMISE_KIT}; + @Setter + protected String projectName = "OpenAPIClient"; + @Setter + protected boolean nonPublicApi = false; + @Setter + protected boolean objcCompatible = false; + @Setter + protected boolean readonlyProperties = false; + @Setter + protected boolean swiftUseApiNamespace = false; + @Setter + protected boolean useSPMFileStructure = true; + @Setter + protected String swiftPackagePath = "Sources" + File.separator + projectName; + @Setter + protected boolean oneOfUnknownDefaultCase = false; + @Setter + protected boolean useClasses = false; + @Setter + protected boolean useBacktickEscapes = false; + @Setter + protected boolean generateModelAdditionalProperties = true; + @Setter + protected boolean hashableModels = true; + @Setter + protected boolean identifiableModels = true; + @Setter + protected boolean useJsonEncodable = true; + @Getter + @Setter + protected boolean mapFileBinaryToData = false; + @Setter + protected boolean useCustomDateWithoutTime = false; + @Setter + protected boolean validatable = true; + @Setter + protected boolean apiStaticMethod = true; + @Setter + protected boolean combineDeferred = true; + @Setter + protected String[] responseAs = {RESPONSE_LIBRARY_ASYNC_AWAIT}; protected String sourceFolder = swiftPackagePath; protected HashSet objcReservedWords; protected String apiDocPath = "docs/"; @@ -326,7 +347,7 @@ public Swift6ClientCodegen() { .defaultValue(Boolean.FALSE.toString())); cliOptions.add(new CliOption(VALIDATABLE, - "Make validation rules and validator for model properies (default: true)") + "Make validation rules and validator for model properties (default: true)") .defaultValue(Boolean.TRUE.toString())); cliOptions.add(new CliOption(API_STATIC_METHOD, @@ -1222,7 +1243,7 @@ public void postProcessFile(File file, String fileType) { } // only process files with swift extension if ("swift".equals(FilenameUtils.getExtension(file.toString()))) { - this.executePostProcessor(new String[] {swiftPostProcessFile, file.toString()}); + this.executePostProcessor(new String[]{swiftPostProcessFile, file.toString()}); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftCombineClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftCombineClientCodegen.java index 95bd6c3b0bb7..0985f0c3364f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftCombineClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftCombineClientCodegen.java @@ -746,8 +746,8 @@ protected void addVendorExtensions(CodegenParameter cp, CodegenOperation operati CodegenModel baseModel = modelMaps.get(cp.items.dataType); boolean isBaseTypeEnum = cp.items.isEnum || cp.isEnum || (baseModel != null && baseModel.isEnum); cp.vendorExtensions.put("x-swift-is-base-type-enum", isBaseTypeEnum); - boolean isBaseTypeUdid = cp.items.isUuid || cp.isUuid; - cp.vendorExtensions.put("x-swift-is-base-type-udid", isBaseTypeUdid); + boolean isBaseTypeUuid = cp.items.isUuid || cp.isUuid; + cp.vendorExtensions.put("x-swift-is-base-type-uuid", isBaseTypeUuid); boolean useEncoder = !isBaseTypeEnum && !cp.items.isString || (baseModel != null && !baseModel.isString); cp.vendorExtensions.put("x-swift-use-encoder", useEncoder); diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache index ae635d276b75..fa59c65e07ba 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/CMakeLists.txt.mustache @@ -6,6 +6,7 @@ cmake_policy(SET CMP0063 NEW) set(CMAKE_C_VISIBILITY_PRESET default) set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(CMAKE_C_FLAGS "-Werror=implicit-function-declaration -Werror=missing-declarations -Werror=int-conversion") option(BUILD_SHARED_LIBS "Build using shared libraries" ON) @@ -14,7 +15,7 @@ find_package(OpenSSL) if (OPENSSL_FOUND) message (STATUS "OPENSSL found") - set(CMAKE_C_FLAGS "-DOPENSSL") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL") if(CMAKE_VERSION VERSION_LESS 3.4) include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIRS}) 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 185e8c845a0a..cb01a7f9763a 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 @@ -5,11 +5,6 @@ #define MAX_NUMBER_LENGTH 16 #define MAX_BUFFER_LENGTH 4096 -#define intToStr(dst, src) \ - do {\ - char dst[256];\ - snprintf(dst, 256, "%ld", (long int)(src));\ -}while(0) {{#operations}} {{#operation}} @@ -140,7 +135,7 @@ end: snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{baseName}}"); char localVarBuff_{{paramName}}[256]; - intToStr(localVarBuff_{{paramName}}, {{paramName}}); + snprintf(localVarBuff_{{paramName}}, sizeof localVarBuff_{{paramName}}, "%ld", (long){{paramName}}); localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}}); @@ -153,7 +148,7 @@ end: snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{baseName}}"); char localVarBuff_{{paramName}}[256]; - intToStr(localVarBuff_{{paramName}}, *{{paramName}}); + snprintf(localVarBuff_{{paramName}}, sizeof localVarBuff_{{paramName}}, "%ld", (long)*{{paramName}}); localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}}); @@ -166,7 +161,7 @@ end: snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{baseName}}"); char localVarBuff_{{paramName}}[256]; - intToStr(localVarBuff_{{paramName}}, {{paramName}}); + snprintf(localVarBuff_{{paramName}}, sizeof localVarBuff_{{paramName}}, "%ld", (long){{paramName}}); localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}}); @@ -179,7 +174,7 @@ end: snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{baseName}}"); char localVarBuff_{{paramName}}[256]; - intToStr(localVarBuff_{{paramName}}, {{paramName}}); + snprintf(localVarBuff_{{paramName}}, sizeof localVarBuff_{{paramName}}, "%ld", {{paramName}}); localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}}); @@ -275,7 +270,7 @@ end: {{/isFile}} {{^isFile}} char *keyForm_{{paramName}} = NULL; - {{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}{{dataType}}{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}} *{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueForm_{{paramName}} = 0; + {{#isPrimitiveType}}{{#isNumber}}{{{dataType}}}{{/isNumber}}{{#isLong}}{{{dataType}}}{{/isLong}}{{#isInteger}}{{{dataType}}}{{/isInteger}}{{#isDouble}}{{{dataType}}}{{/isDouble}}{{#isFloat}}{{{dataType}}}{{/isFloat}}{{#isBoolean}}char *{{/isBoolean}}{{#isEnum}}{{#isString}}{{projectName}}_{{operationId}}_{{baseName}}_e{{/isString}}{{/isEnum}}{{^isEnum}}{{#isString}}{{{dataType}}} *{{/isString}}{{/isEnum}}{{#isByteArray}}{{{dataType}}} *{{/isByteArray}}{{#isDate}}{{{dataType}}}{{/isDate}}{{#isDateTime}}{{{dataType}}}{{/isDateTime}}{{#isFile}}{{{dataType}}}{{/isFile}}{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{^isEnum}}{{{dataType}}}_t *{{/isEnum}}{{/isModel}}{{^isModel}}{{#isEnum}}{{datatypeWithEnum}}_e{{/isEnum}}{{/isModel}}{{#isUuid}}{{dataType}} *{{/isUuid}}{{#isEmail}}{{dataType}}{{/isEmail}}{{/isPrimitiveType}} valueForm_{{paramName}} = 0; keyValuePair_t *keyPairForm_{{paramName}} = 0; {{/isFile}} if ({{paramName}} != {{^isEnum}}NULL{{/isEnum}}{{#isEnum}}0{{/isEnum}}) @@ -301,7 +296,7 @@ end: valueForm_{{paramName}} = {{#isString}}{{^isEnum}}strdup({{/isEnum}}{{/isString}}({{{paramName}}}){{#isString}}{{^isEnum}}){{/isEnum}}{{/isString}}; {{/isBoolean}} {{/isInteger}} - keyPairForm_{{paramName}} = keyValuePair_create(keyForm_{{paramName}},{{#isString}}{{#isEnum}}(void *){{/isEnum}}{{/isString}}{{^isString}}&{{/isString}}valueForm_{{paramName}}); + keyPairForm_{{paramName}} = keyValuePair_create(keyForm_{{paramName}},{{#isString}}{{#isEnum}}(void *){{/isEnum}}{{/isString}}{{^isString}}{{^isBoolean}}&{{/isBoolean}}{{/isString}}valueForm_{{paramName}}); list_addElement(localVarFormParameters,keyPairForm_{{paramName}}); {{/isFile}} } diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache index 899cb22ef7aa..d032b5de1fa8 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/apiClient.c.mustache @@ -173,7 +173,7 @@ void sslConfig_free(sslConfig_t *sslConfig) { free(sslConfig); } -void replaceSpaceWithPlus(char *stringToProcess) { +static void replaceSpaceWithPlus(char *stringToProcess) { for(int i = 0; i < strlen(stringToProcess); i++) { if(stringToProcess[i] == ' ') { stringToProcess[i] = '+'; @@ -181,9 +181,9 @@ void replaceSpaceWithPlus(char *stringToProcess) { } } -char *assembleTargetUrl(const char *basePath, - const char *operationParameter, - list_t *queryParameters) { +static char *assembleTargetUrl(const char *basePath, + const char *operationParameter, + list_t *queryParameters) { int neededBufferSizeForQueryParameters = 0; listEntry_t *listEntry; @@ -234,7 +234,7 @@ char *assembleTargetUrl(const char *basePath, return targetUrl; } -char *assembleHeaderField(char *key, char *value) { +static char *assembleHeaderField(char *key, char *value) { char *header = malloc(strlen(key) + strlen(value) + 3); strcpy(header, key), @@ -244,13 +244,13 @@ char *assembleHeaderField(char *key, char *value) { return header; } -void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { +static void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)bodyParametersLength); } -int lengthOfKeyPair(keyValuePair_t *keyPair) { +static int lengthOfKeyPair(keyValuePair_t *keyPair) { long length = 0; if((keyPair->key != NULL) && (keyPair->value != NULL) ) diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache index ebf15d178911..0cfe0541be17 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/model-body.mustache @@ -119,7 +119,7 @@ char* {{classname}}_{{name}}_ToString({{projectName}}_{{classVarName}}_{{enumNam {{/isContainer}} {{/vars}} -{{classname}}_t *{{classname}}_create( +static {{classname}}_t *{{classname}}_create_internal( {{#vars}} {{^isContainer}} {{^isPrimitiveType}} @@ -205,14 +205,103 @@ char* {{classname}}_{{name}}_ToString({{projectName}}_{{classVarName}}_{{enumNam {{classname}}_local_var->{{{name}}} = {{{name}}}; {{/vars}} + {{classname}}_local_var->_library_owned = 1; return {{classname}}_local_var; } +__attribute__((deprecated)) {{classname}}_t *{{classname}}_create( + {{#vars}} + {{^isContainer}} + {{^isPrimitiveType}} + {{#isModel}} + {{#isEnum}} + {{projectName}}_{{classVarName}}_{{enumName}}_e {{name}}{{^-last}},{{/-last}} + {{/isEnum}} + {{^isEnum}} + {{datatype}}_t *{{name}}{{^-last}},{{/-last}} + {{/isEnum}} + {{/isModel}} + {{^isModel}} + {{^isFreeFormObject}} + {{^isEnum}} + {{datatype}}_t *{{name}}{{^-last}},{{/-last}} + {{/isEnum}} + {{#isEnum}} + {{projectName}}_{{dataType}}_{{enumName}}_e {{name}}{{^-last}},{{/-last}} + {{/isEnum}} + {{/isFreeFormObject}} + {{/isModel}} + {{#isUuid}} + {{datatype}} *{{name}}{{^-last}},{{/-last}} + {{/isUuid}} + {{#isEmail}} + {{datatype}} *{{name}}{{^-last}},{{/-last}} + {{/isEmail}} + {{#isFreeFormObject}} + {{datatype}}_t *{{name}}{{^-last}},{{/-last}} + {{/isFreeFormObject}} + {{/isPrimitiveType}} + {{#isPrimitiveType}} + {{#isNumeric}} + {{datatype}} {{name}}{{^-last}},{{/-last}} + {{/isNumeric}} + {{#isBoolean}} + {{datatype}} {{name}}{{^-last}},{{/-last}} + {{/isBoolean}} + {{#isEnum}} + {{#isString}} + {{projectName}}_{{classVarName}}_{{enumName}}_e {{name}}{{^-last}},{{/-last}} + {{/isString}} + {{/isEnum}} + {{^isEnum}} + {{#isString}} + {{datatype}} *{{name}}{{^-last}},{{/-last}} + {{/isString}} + {{/isEnum}} + {{#isByteArray}} + {{datatype}} *{{name}}{{^-last}},{{/-last}} + {{/isByteArray}} + {{#isBinary}} + {{datatype}} {{name}}{{^-last}},{{/-last}} + {{/isBinary}} + {{#isDate}} + {{datatype}} *{{name}}{{^-last}},{{/-last}} + {{/isDate}} + {{#isDateTime}} + {{datatype}} *{{name}}{{^-last}},{{/-last}} + {{/isDateTime}} + {{/isPrimitiveType}} + {{/isContainer}} + {{#isContainer}} + {{#isArray}} + {{#isPrimitiveType}} + {{datatype}}_t *{{name}}{{^-last}},{{/-last}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + {{datatype}}_t *{{name}}{{^-last}},{{/-last}} + {{/isPrimitiveType}} + {{/isArray}} + {{#isMap}} + {{datatype}} {{name}}{{^-last}},{{/-last}} + {{/isMap}} + {{/isContainer}} + {{/vars}} + ) { + return {{classname}}_create_internal ( + {{#vars}} + {{name}}{{^-last}},{{/-last}} + {{/vars}} + ); +} void {{classname}}_free({{classname}}_t *{{classname}}) { if(NULL == {{classname}}){ return ; } + if({{classname}}->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "{{classname}}_free"); + return ; + } listEntry_t *listEntry; {{#vars}} {{^isContainer}} @@ -376,7 +465,7 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) { {{/isBoolean}} {{#isEnum}} {{#isString}} - if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{{name}}}{{classname}}_ToString({{{classname}}}->{{{name}}})) == NULL) + if(cJSON_AddStringToObject(item, "{{{baseName}}}", {{classname}}_{{name}}_ToString({{{classname}}}->{{{name}}})) == NULL) { goto fail; //Enum } @@ -859,7 +948,7 @@ fail: {{/vars}} - {{classname}}_local_var = {{classname}}_create ( + {{classname}}_local_var = {{classname}}_create_internal ( {{#vars}} {{^isContainer}} {{^isPrimitiveType}} diff --git a/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache b/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache index d69dc8d5cd34..236d9e8c3cba 100644 --- a/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/C-libcurl/model-header.mustache @@ -154,9 +154,10 @@ typedef struct {{classname}}_t { {{/isContainer}} {{/vars}} + int _library_owned; // Is the library responsible for freeing this object? } {{classname}}_t; -{{classname}}_t *{{classname}}_create( +__attribute__((deprecated)) {{classname}}_t *{{classname}}_create( {{#vars}} {{^isContainer}} {{^isPrimitiveType}} diff --git a/modules/openapi-generator/src/main/resources/Java/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/JSON.mustache index 1d0a8138787b..5ef02660d746 100644 --- a/modules/openapi-generator/src/main/resources/Java/JSON.mustache +++ b/modules/openapi-generator/src/main/resources/Java/JSON.mustache @@ -31,9 +31,11 @@ import java.lang.reflect.Type; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +{{#jsr310}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; +{{/jsr310}} import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache index 59896d820f43..4fefd6db233e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom.mustache @@ -223,7 +223,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 {{#useBeanValidation}} 3.0.2 {{/useBeanValidation}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom_3.0.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom_3.0.mustache index e4ab3b15ec86..9462e0d9236b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom_3.0.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/microprofile/pom_3.0.mustache @@ -223,7 +223,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 {{#useBeanValidation}} 3.0.1 {{/useBeanValidation}} 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 ef6e35600998..519b37ed2eca 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 @@ -47,9 +47,11 @@ import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.text.DateFormat; +{{#jsr310}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; +{{/jsr310}} import java.util.*; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache index 6cf7ec7898c4..eee7773c4cc0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/JSON.mustache @@ -28,9 +28,11 @@ import java.lang.reflect.Type; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +{{#jsr310}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; +{{/jsr310}} import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache index 077e8d6924b9..c05159d4e0a0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/ApiClient.mustache @@ -46,7 +46,9 @@ import java.io.IOException; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.text.DateFormat; +{{#jsr310}} import java.time.format.DateTimeFormatter; +{{/jsr310}} import java.util.LinkedHashMap; import java.util.Map; import java.util.HashMap; diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/JSON.mustache index 2ff8b1cb739c..2e986485fcd8 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/JSON.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/JSON.mustache @@ -30,9 +30,11 @@ import java.lang.reflect.Type; import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; +{{#jsr310}} import java.time.LocalDate; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; +{{/jsr310}} import java.util.Date; import java.util.Locale; import java.util.Map; diff --git a/modules/openapi-generator/src/main/resources/JavaInflector/pom.mustache b/modules/openapi-generator/src/main/resources/JavaInflector/pom.mustache index 3e5ed936625f..67af2ce5e31a 100644 --- a/modules/openapi-generator/src/main/resources/JavaInflector/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaInflector/pom.mustache @@ -162,7 +162,7 @@ 1.0.0 1.0.14 9.2.9.v20150224 - 1.2.12 + 1.5.13 {{#useJakartaEe}} 2.1.1 {{/useJakartaEe}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache index a4477b5a0aa3..7decc4e441d6 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/api_test.mustache @@ -8,6 +8,7 @@ import org.junit.Test; import org.junit.Before; import static org.junit.Assert.*; +import {{javaxPackage}}.validation.Valid; import {{javaxPackage}}.ws.rs.core.MediaType; import {{javaxPackage}}.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pom.mustache index 4900c6d27ded..71b5f42a18df 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/pom.mustache @@ -220,7 +220,7 @@ for this project used jakarta.validation-api --> 1.5.22 9.2.9.v20150224 4.13.2 - 1.4.14 + 1.5.13 {{#useBeanValidation}} 2.0.2 {{/useBeanValidation}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/pom.mustache index dc1d394348d7..d744472a18f3 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext/server/pom.mustache @@ -342,7 +342,7 @@ for this project used jakarta.validation-api --> {{/generateSpringApplication}} {{^generateSpringBootApplication}} 4.13.2 - 1.2.12 + 1.5.13 {{/generateSpringBootApplication}} 3.5.9 2.17.1 diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/api_test.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/api_test.mustache index 8606cf7fb63d..bbaf8e4d9997 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/api_test.mustache @@ -8,6 +8,7 @@ import org.junit.Test; import org.junit.Before; import static org.junit.Assert.*; +import {{javaxPackage}}.validation.Valid; import {{javaxPackage}}.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pom.mustache index cbee86960906..35a5954ebb74 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pom.mustache @@ -241,7 +241,7 @@ for this project used jakarta.validation-api --> 1.5.18 9.2.9.v20150224 4.13.2 - 1.4.14 + 1.5.13 {{#useBeanValidation}} 2.0.2 {{/useBeanValidation}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/server/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/server/pom.mustache index 961cd74d1579..f6c85b652eae 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/server/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/server/pom.mustache @@ -292,7 +292,7 @@ for this project used jakarta.validation-api --> 1.5.22 9.2.9.v20150224 4.13.2 - 1.4.14 + 1.5.13 {{#useBeanValidation}} 2.0.2 {{/useBeanValidation}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pom.mustache index 5734fc17ddf4..bfc62eb8ae3e 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey3/pom.mustache @@ -222,7 +222,7 @@ 3.1.3 2.17.1 4.13.2 - 1.4.14 + 1.5.13 5.0.0 UTF-8 diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/pom.mustache index 3b2a9f2dc3e1..954fc7cae4f2 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/pom.mustache @@ -222,7 +222,7 @@ for this project used jakarta.validation-api --> 2.35 2.17.1 4.13.2 - 1.4.14 + 1.5.13 4.0.4 UTF-8 diff --git a/modules/openapi-generator/src/main/resources/Javascript/libraries/javascript/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Javascript/libraries/javascript/ApiClient.mustache index 77bdd5ff1eab..6aa25b8ee9dd 100644 --- a/modules/openapi-generator/src/main/resources/Javascript/libraries/javascript/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript/libraries/javascript/ApiClient.mustache @@ -55,15 +55,20 @@ class ApiClient { } - <={{ }}=>{{#emitJSDoc}}/** + <={{ }}=> + {{^skipDefaultUserAgent}} + {{#emitJSDoc}} + /** * The default HTTP headers to be included for all API calls. * @type {Array.} * @default {} - */{{/emitJSDoc}} + */ + {{/emitJSDoc}} this.defaultHeaders = { 'User-Agent': '{{{httpUserAgent}}}{{^httpUserAgent}}OpenAPI-Generator/{{projectVersion}}/Javascript{{/httpUserAgent}}' }; + {{/skipDefaultUserAgent}} /** * The default HTTP timeout for all API calls. * @type {Number} @@ -79,11 +84,13 @@ class ApiClient { */ this.cache = true; - {{#emitJSDoc}}/** + {{#emitJSDoc}} + /** * If set to true, the client will save the cookies from each server * response, and return them in the next request. * @default false - */{{/emitJSDoc}} + */ + {{/emitJSDoc}} this.enableCookies = false; /* diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache index 04c578517981..b97a7ad8da5f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache @@ -229,7 +229,7 @@ web::json::value ModelBase::toJson( const std::vector& value ) template web::json::value ModelBase::toJson( const std::set& value ) { - // There's no protoype web::json::value::array(...) taking a std::set parameter. Converting to std::vector to get an array. + // There's no prototype web::json::value::array(...) taking a std::set parameter. Converting to std::vector to get an array. std::vector ret; for ( const auto& x : value ) { diff --git a/modules/openapi-generator/src/main/resources/csharp-functions/HttpSigningConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp-functions/HttpSigningConfiguration.mustache index f5cc312c6fe5..58c9cf6dba32 100644 --- a/modules/openapi-generator/src/main/resources/csharp-functions/HttpSigningConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-functions/HttpSigningConfiguration.mustache @@ -59,7 +59,7 @@ namespace {{packageName}}.Client public string SigningAlgorithm { get; set; } ///

- /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache index 91ea70055b06..ec45cbab3c56 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache @@ -384,6 +384,14 @@ namespace {{packageName}}.Client } } + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + return request; } diff --git a/modules/openapi-generator/src/main/resources/csharp/HttpSigningConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp/HttpSigningConfiguration.mustache index faca675944a3..3105952c2473 100644 --- a/modules/openapi-generator/src/main/resources/csharp/HttpSigningConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/HttpSigningConfiguration.mustache @@ -389,7 +389,7 @@ namespace {{packageName}}.Client } /// - /// Convert ANS1 format to DER format. Not recommended to use because it generate inavlid signature occationally. + /// Convert ANS1 format to DER format. Not recommended to use because it generate invalid signature occasionally. /// /// /// diff --git a/modules/openapi-generator/src/main/resources/csharp/api.mustache b/modules/openapi-generator/src/main/resources/csharp/api.mustache index fae106702fd5..527434ba1abe 100644 --- a/modules/openapi-generator/src/main/resources/csharp/api.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/api.mustache @@ -290,6 +290,7 @@ namespace {{packageName}}.{{apiPackage}} }; var localVarContentType = {{packageName}}.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -375,7 +376,7 @@ namespace {{packageName}}.{{apiPackage}} {{/isArray}} {{/isFile}} {{^isFile}} - localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter + localVarRequestOptions.FormParameters.Add("{{baseName}}", {{#isPrimitiveType}}{{packageName}}.Client.ClientUtils.ParameterToString({{paramName}}){{/isPrimitiveType}}{{^isPrimitiveType}}localVarMultipartFormData ? {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}}) : {{packageName}}.Client.ClientUtils.Serialize({{paramName}}){{/isPrimitiveType}}); // form parameter {{/isFile}} {{/required}} {{^required}} @@ -397,7 +398,7 @@ namespace {{packageName}}.{{apiPackage}} {{/isArray}} {{/isFile}} {{^isFile}} - localVarRequestOptions.FormParameters.Add("{{baseName}}", {{packageName}}.Client.ClientUtils.{{#isPrimitiveType}}ParameterToString{{/isPrimitiveType}}{{^isPrimitiveType}}Serialize{{/isPrimitiveType}}({{paramName}})); // form parameter + localVarRequestOptions.FormParameters.Add("{{baseName}}", {{#isPrimitiveType}}{{packageName}}.Client.ClientUtils.ParameterToString({{paramName}}){{/isPrimitiveType}}{{^isPrimitiveType}}localVarMultipartFormData ? {{packageName}}.Client.ClientUtils.ParameterToString({{paramName}}) : {{packageName}}.Client.ClientUtils.Serialize({{paramName}}){{/isPrimitiveType}}); // form parameter {{/isFile}} } {{/required}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ExceptionEventArgs.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ExceptionEventArgs.mustache index 016ef7c697f2..b74fcfa0a1de 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ExceptionEventArgs.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ExceptionEventArgs.mustache @@ -13,7 +13,7 @@ namespace {{packageName}}.{{clientPackage}} public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningConfiguration.mustache index 5e0f7739df06..357626fcc6c2 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/HttpSigningConfiguration.mustache @@ -65,7 +65,7 @@ namespace {{packageName}}.{{clientPackage}} public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache b/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache index 5769512aa877..ade2832cd1c3 100644 --- a/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/netcore_project.mustache @@ -36,13 +36,13 @@ {{/useRestSharp}} {{#useGenericHost}} - - + + {{#supportsRetry}} - + {{/supportsRetry}} {{#net80OrLater}} - + {{/net80OrLater}} {{^net60OrLater}} diff --git a/modules/openapi-generator/src/main/resources/csharp/netcore_testproject.mustache b/modules/openapi-generator/src/main/resources/csharp/netcore_testproject.mustache index eb8bd548d1e0..90434b77e297 100644 --- a/modules/openapi-generator/src/main/resources/csharp/netcore_testproject.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/netcore_testproject.mustache @@ -9,8 +9,8 @@ - - + + diff --git a/modules/openapi-generator/src/main/resources/java-pkmst/pom.mustache b/modules/openapi-generator/src/main/resources/java-pkmst/pom.mustache index a71a194d56bf..77ffeef5254f 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/pom.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/pom.mustache @@ -25,8 +25,8 @@ 2.6.0 1.7.25 4.11 - 1.4.13 - 1.4.13 + 1.5.13 + 1.5.13 2.3.0 2.2.4 3.2.2 diff --git a/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache b/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache index a082fc34eb9d..5d9b6b553ae1 100644 --- a/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache +++ b/modules/openapi-generator/src/main/resources/java-undertow-server/pom.mustache @@ -26,7 +26,7 @@ 1.10 1.2 3.1.2 - 1.4.13 + 1.5.13 4.13.2 2.1.0-beta.124 2.3.17.Final diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/gradle.properties b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/gradle.properties index fb877a9edd28..1fb076431bba 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/gradle.properties +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/gradle.properties @@ -1,4 +1,4 @@ kotlin.code.style=official ktor_version=3.0.2 kotlin_version=2.0.20 -logback_version=1.4.14 \ No newline at end of file +logback_version=1.5.13 diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/gradle.properties b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/gradle.properties index d507b58c1c87..126ddfe69da1 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/gradle.properties +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor2/gradle.properties @@ -1,4 +1,4 @@ kotlin.code.style=official ktor_version=2.3.12 kotlin_version=2.0.20 -logback_version=1.4.14 \ No newline at end of file +logback_version=1.5.13 diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradle-wrapper.jar b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradle-wrapper.jar differ diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradle-wrapper.properties.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradle-wrapper.properties.mustache new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradle-wrapper.properties.mustache @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradlew.bat.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradlew.bat.mustache new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradlew.bat.mustache @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradlew.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradlew.mustache new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/gradlew.mustache @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradle-wrapper.jar b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradle-wrapper.jar differ diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradle-wrapper.properties.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradle-wrapper.properties.mustache new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradle-wrapper.properties.mustache @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradlew.bat.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradlew.bat.mustache new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradlew.bat.mustache @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradlew.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradlew.mustache new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/gradlew.mustache @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache index 6110545eda62..757c79827c25 100644 --- a/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache +++ b/modules/openapi-generator/src/main/resources/php-nextgen/api.mustache @@ -164,7 +164,7 @@ use {{invokerPackage}}\ObjectSerializer; * * @throws ApiException on non-2xx response or if the response body is not in the expected format * @throws InvalidArgumentException - * @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}} + * @return {{{vendorExtensions.x-php-doc-return-type}}} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -172,7 +172,7 @@ use {{invokerPackage}}\ObjectSerializer; public function {{operationId}}( {{^vendorExtensions.x-group-parameters}} {{#allParams}} - {{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}} {{#servers}} {{#-first}} @@ -247,7 +247,7 @@ use {{invokerPackage}}\ObjectSerializer; public function {{operationId}}WithHttpInfo( {{^vendorExtensions.x-group-parameters}} {{#allParams}} - {{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}} {{#servers}} {{#-first}} @@ -446,7 +446,7 @@ use {{invokerPackage}}\ObjectSerializer; public function {{operationId}}Async( {{^vendorExtensions.x-group-parameters}} {{#allParams}} - {{^required}}?{{/required}}{{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}} {{#servers}} {{#-first}} @@ -524,7 +524,7 @@ use {{invokerPackage}}\ObjectSerializer; public function {{operationId}}AsyncWithHttpInfo( {{^vendorExtensions.x-group-parameters}} {{#allParams}} - ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}} {{#servers}} {{#-first}} @@ -630,7 +630,7 @@ use {{invokerPackage}}\ObjectSerializer; public function {{operationId}}Request( {{^vendorExtensions.x-group-parameters}} {{#allParams}} - ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, + {{vendorExtensions.x-php-param-type}} ${{paramName}}{{^required}} = {{#defaultValue}}{{{.}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}{{/required}}, {{/allParams}} {{#servers}} {{#-first}} diff --git a/modules/openapi-generator/src/main/resources/php-nextgen/model_generic.mustache b/modules/openapi-generator/src/main/resources/php-nextgen/model_generic.mustache index f79f51908882..c81f28e4190c 100644 --- a/modules/openapi-generator/src/main/resources/php-nextgen/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/php-nextgen/model_generic.mustache @@ -190,6 +190,12 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par return self::$openAPIModelName; } +{{#discriminator}} +{{#discriminator.mappedModels}} + public const {{#lambda.uppercase}}{{discriminator.propertyName}}_{{#lambda.snakecase}}{{mappingName}}{{/lambda.snakecase}}{{/lambda.uppercase}} = '{{mappingName}}'; +{{/discriminator.mappedModels}} +{{/discriminator}} +{{^discriminator}} {{#vars}} {{#isEnum}} {{#allowableValues}} @@ -199,6 +205,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par {{/allowableValues}} {{/isEnum}} {{/vars}} +{{/discriminator}} {{#vars}} {{#isEnum}} @@ -210,8 +217,15 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par public function {{getter}}AllowableValues() { return [ +{{#discriminator}} +{{#discriminator.mappedModels}} + self::{{#lambda.uppercase}}{{discriminator.propertyName}}_{{#lambda.snakecase}}{{mappingName}}{{/lambda.snakecase}}{{/lambda.uppercase}},{{^-last}} +{{/-last}}{{/discriminator.mappedModels}} +{{/discriminator}} +{{^discriminator}} {{#allowableValues}}{{#enumVars}}self::{{enumName}}_{{{name}}},{{^-last}} {{/-last}}{{/enumVars}}{{/allowableValues}} +{{/discriminator}} ]; } @@ -233,6 +247,11 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par */ public function __construct(array $data = null) { + {{#discriminator}} + // Initialize discriminator property with the model name. + $this->container['{{discriminatorName}}'] = static::$openAPIModelName; + + {{/discriminator}} {{#parentSchema}} parent::__construct($data); @@ -240,11 +259,6 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^par {{#vars}} $this->setIfExists('{{name}}', $data ?? [], {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}null{{/defaultValue}}); {{/vars}} - {{#discriminator}} - - // Initialize discriminator property with the model name. - $this->container['{{discriminatorName}}'] = static::$openAPIModelName; - {{/discriminator}} } /** diff --git a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache index 5ec833183d46..7b286d94d034 100644 --- a/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/libraries/psr-18/api.mustache @@ -181,7 +181,7 @@ use function sprintf; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. {{/-first}} * URL: {{{url}}} {{#-last}} @@ -219,7 +219,7 @@ use function sprintf; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. {{/-first}} * URL: {{{url}}} {{#-last}} @@ -342,7 +342,7 @@ use function sprintf; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. {{/-first}} * URL: {{{url}}} {{#-last}} @@ -383,7 +383,7 @@ use function sprintf; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. {{/-first}} * URL: {{{url}}} {{#-last}} @@ -448,7 +448,7 @@ use function sprintf; {{/vendorExtensions.x-group-parameters}} {{#servers}} {{#-first}} - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. {{/-first}} * URL: {{{url}}} {{#-last}} diff --git a/modules/openapi-generator/src/main/resources/python-fastapi/README.mustache b/modules/openapi-generator/src/main/resources/python-fastapi/README.mustache index b9289fdb7e24..5380fa1e1691 100644 --- a/modules/openapi-generator/src/main/resources/python-fastapi/README.mustache +++ b/modules/openapi-generator/src/main/resources/python-fastapi/README.mustache @@ -19,7 +19,7 @@ To run the server, please execute the following from the root directory: ```bash pip3 install -r requirements.txt -PYTHONPATH=src uvicorn openapi_server.main:app --host 0.0.0.0 --port {{serverPort}} +PYTHONPATH=src uvicorn {{packageName}}.main:app --host 0.0.0.0 --port {{serverPort}} ``` and open your browser at `http://localhost:{{serverPort}}/docs/` to see the docs. diff --git a/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_test.mustache b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_test.mustache index 10a4d3ed5aa0..a758be5210a7 100644 --- a/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/python-pydantic-v1/api_test.mustache @@ -15,14 +15,14 @@ class {{#operations}}Test{{classname}}(unittest.{{#asyncio}}IsolatedAsyncio{{/as self.api = {{classname}}() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() {{/asyncio}} {{^asyncio}} def setUp(self) -> None: self.api = {{classname}}() def tearDown(self) -> None: - pass + self.api.api_client.close() {{/asyncio}} {{#operation}} diff --git a/modules/openapi-generator/src/main/resources/python/api_test.mustache b/modules/openapi-generator/src/main/resources/python/api_test.mustache index 963d085af18e..2febe56956cf 100644 --- a/modules/openapi-generator/src/main/resources/python/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_test.mustache @@ -15,7 +15,7 @@ class {{#operations}}Test{{classname}}(unittest.{{#asyncio}}IsolatedAsyncio{{/as self.api = {{classname}}() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() {{/asyncio}} {{^asyncio}} def setUp(self) -> None: diff --git a/modules/openapi-generator/src/main/resources/python/exceptions.mustache b/modules/openapi-generator/src/main/resources/python/exceptions.mustache index a690ceb926cb..fb2ebae0eefa 100644 --- a/modules/openapi-generator/src/main/resources/python/exceptions.mustache +++ b/modules/openapi-generator/src/main/resources/python/exceptions.mustache @@ -140,6 +140,13 @@ class ApiException(OpenApiException): if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -178,6 +185,16 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/modules/openapi-generator/src/main/resources/r/api_client.mustache b/modules/openapi-generator/src/main/resources/r/api_client.mustache index b1844f4686b0..72287876e969 100644 --- a/modules/openapi-generator/src/main/resources/r/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/r/api_client.mustache @@ -29,7 +29,7 @@ {{#authMethods}} {{#isOAuth}} #' @field oauth_flow_type OAuth flow type -#' @field oauth_authorization_url Authoriziation URL +#' @field oauth_authorization_url Authorization URL #' @field oauth_token_url Token URL #' @field oauth_pkce Boolean flag to enable PKCE {{/isOAuth}} @@ -73,7 +73,7 @@ ApiClient <- R6::R6Class( {{#isOAuth}} # Flow type oauth_flow_type = "{{flow}}", - # Authoriziation URL + # Authorization URL oauth_authorization_url = "{{authorizationUrl}}", # Token URL oauth_token_url = "{{tokenUrl}}", @@ -105,7 +105,7 @@ ApiClient <- R6::R6Class( #' @param bearer_token Bearer token. #' @param timeout Timeout. #' @param retry_status_codes Status codes for retry. - #' @param max_retry_attempts Maxmium number of retry. + #' @param max_retry_attempts Maximum number of retry. #' @export initialize = function(base_path = NULL, user_agent = NULL, default_headers = NULL, diff --git a/modules/openapi-generator/src/main/resources/r/libraries/httr2/api_client.mustache b/modules/openapi-generator/src/main/resources/r/libraries/httr2/api_client.mustache index f2e95e679465..194083b2d38c 100644 --- a/modules/openapi-generator/src/main/resources/r/libraries/httr2/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/r/libraries/httr2/api_client.mustache @@ -29,7 +29,7 @@ {{#authMethods}} {{#isOAuth}} #' @field oauth_flow_type OAuth flow type -#' @field oauth_authorization_url Authoriziation URL +#' @field oauth_authorization_url Authorization URL #' @field oauth_token_url Token URL #' @field oauth_pkce Boolean flag to enable PKCE #' @field oauth_scopes OAuth scopes @@ -73,7 +73,7 @@ ApiClient <- R6::R6Class( {{#isOAuth}} # Flow type oauth_flow_type = "{{flow}}", - # Authoriziation URL + # Authorization URL oauth_authorization_url = "{{authorizationUrl}}", # Token URL oauth_token_url = "{{tokenUrl}}", @@ -107,7 +107,7 @@ ApiClient <- R6::R6Class( #' @param bearer_token Bearer token. #' @param timeout Timeout. #' @param retry_status_codes Status codes for retry. - #' @param max_retry_attempts Maxmium number of retry. + #' @param max_retry_attempts Maximum number of retry. #' @export initialize = function(base_path = NULL, user_agent = NULL, default_headers = NULL, @@ -306,7 +306,7 @@ ApiClient <- R6::R6Class( req <- req %>% req_oauth_auth_code(client, scope = req_oauth_scopes, pkce = self$oauth_pkce, - auth_url = self$oauth_authoriziation_url) + auth_url = self$oauth_authorization_url) } {{/hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/rust-server/auth.mustache b/modules/openapi-generator/src/main/resources/rust-server/auth.mustache index cbaba3dca7c6..d2b1481eeb81 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/auth.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/auth.mustache @@ -34,7 +34,7 @@ fn dummy_authorization() -> Authorization { // However, if you want to use it anyway this can not be unimplemented, so dummy implementation added. // unimplemented!() Authorization{ - subject: "Dummmy".to_owned(), + subject: "Dummy".to_owned(), scopes: Scopes::Some(BTreeSet::new()), // create an empty scope, as this should not be used issuer: None } diff --git a/modules/openapi-generator/src/main/resources/rust-server/server-request-body-multipart-form.mustache b/modules/openapi-generator/src/main/resources/rust-server/server-request-body-multipart-form.mustache index c5022acf84bb..f563459396a8 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/server-request-body-multipart-form.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/server-request-body-multipart-form.mustache @@ -39,7 +39,7 @@ return Ok(Response::builder() .status(StatusCode::INTERNAL_SERVER_ERROR) .body(Body::from("Failed to process message part due an internal error".to_string())) - .expect("Unable to create Internal Server Error response due to an internal errror")) + .expect("Unable to create Internal Server Error response due to an internal error")) }, SaveResult::Error(e) => { return Ok(Response::builder() diff --git a/modules/openapi-generator/src/main/resources/swift-combine/api.mustache b/modules/openapi-generator/src/main/resources/swift-combine/api.mustache index db49e368692d..187ab989a8d9 100644 --- a/modules/openapi-generator/src/main/resources/swift-combine/api.mustache +++ b/modules/openapi-generator/src/main/resources/swift-combine/api.mustache @@ -74,7 +74,7 @@ open class {{classname}} { /// - defaultResponse: {{.}}{{/defaultResponse}} {{#authMethods}} /// - {{#isBasicBasic}}BASIC{{/isBasicBasic}}{{#isOAuth}}OAuth{{/isOAuth}}{{#isApiKey}}API Key{{/isApiKey}}: - /// - type: {{type}}{{#keyParamName}} {{keyParamName}} {{#isKeyInQuery}}(QUERY){{/isKeyInQuery}}{{#isKeyInHeaer}}(HEADER){{/isKeyInHeaer}}{{/keyParamName}} + /// - type: {{type}}{{#keyParamName}} {{keyParamName}} {{#isKeyInQuery}}(QUERY){{/isKeyInQuery}}{{#isKeyInHeader}}(HEADER){{/isKeyInHeader}}{{/keyParamName}} /// - name: {{name}} {{/authMethods}} {{#hasResponseHeaders}} @@ -212,4 +212,4 @@ open class {{classname}} { } {{/operation}} } -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/swift-combine/toString.mustache b/modules/openapi-generator/src/main/resources/swift-combine/toString.mustache index 5535cae98f1b..53ffae5b3b66 100644 --- a/modules/openapi-generator/src/main/resources/swift-combine/toString.mustache +++ b/modules/openapi-generator/src/main/resources/swift-combine/toString.mustache @@ -1 +1 @@ -{{#isDateTime}}OpenISO8601DateFormatter.shared.string(from: {{paramName}}){{/isDateTime}}{{#vendorExtensions.x-swift-use-encoder}}String(data: try self.encoder.encode({{paramName}}), encoding: .utf8) ?? ""{{/vendorExtensions.x-swift-use-encoder}}{{^vendorExtensions.x-swift-use-encoder}}{{#isArray}}{{paramName}}{{#vendorExtensions.x-swift-is-base-type-udid}}.map { $0.uuidString }{{/vendorExtensions.x-swift-is-base-type-udid}}{{#vendorExtensions.x-swift-is-base-type-enum}}.map { $0.rawValue }{{/vendorExtensions.x-swift-is-base-type-enum}}.joined(separator: ","){{/isArray}}{{^isArray}}{{#vendorExtensions.x-swift-is-enum-type}}{{paramName}}.rawValue{{/vendorExtensions.x-swift-is-enum-type}}{{^isEnum}}{{#isString}}{{#isUuid}}{{paramName}}.uuidString{{/isUuid}}{{^isUuid}}{{paramName}}{{/isUuid}}{{/isString}}{{#isInteger}}"\({{paramName}})"{{/isInteger}}{{#isDouble}}"\({{paramName}})"{{/isDouble}}{{#isFloat}}"\({{paramName}})"{{/isFloat}}{{#isNumber}}"\({{paramName}})"{{/isNumber}}{{#isLong}}"\({{paramName}})"{{/isLong}}{{#isBoolean}}{{paramName}} ? "true" : "false"{{/isBoolean}}{{/isEnum}}{{/isArray}}{{/vendorExtensions.x-swift-use-encoder}} \ No newline at end of file +{{#isDateTime}}OpenISO8601DateFormatter.shared.string(from: {{paramName}}){{/isDateTime}}{{#vendorExtensions.x-swift-use-encoder}}String(data: try self.encoder.encode({{paramName}}), encoding: .utf8) ?? ""{{/vendorExtensions.x-swift-use-encoder}}{{^vendorExtensions.x-swift-use-encoder}}{{#isArray}}{{paramName}}{{#vendorExtensions.x-swift-is-base-type-uuid}}.map { $0.uuidString }{{/vendorExtensions.x-swift-is-base-type-uuid}}{{#vendorExtensions.x-swift-is-base-type-enum}}.map { $0.rawValue }{{/vendorExtensions.x-swift-is-base-type-enum}}.joined(separator: ","){{/isArray}}{{^isArray}}{{#vendorExtensions.x-swift-is-enum-type}}{{paramName}}.rawValue{{/vendorExtensions.x-swift-is-enum-type}}{{^isEnum}}{{#isString}}{{#isUuid}}{{paramName}}.uuidString{{/isUuid}}{{^isUuid}}{{paramName}}{{/isUuid}}{{/isString}}{{#isInteger}}"\({{paramName}})"{{/isInteger}}{{#isDouble}}"\({{paramName}})"{{/isDouble}}{{#isFloat}}"\({{paramName}})"{{/isFloat}}{{#isNumber}}"\({{paramName}})"{{/isNumber}}{{#isLong}}"\({{paramName}})"{{/isLong}}{{#isBoolean}}{{paramName}} ? "true" : "false"{{/isBoolean}}{{/isEnum}}{{/isArray}}{{/vendorExtensions.x-swift-use-encoder}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/swift5/Validation.mustache b/modules/openapi-generator/src/main/resources/swift5/Validation.mustache index 70e3abfb5057..91bbcf788555 100644 --- a/modules/openapi-generator/src/main/resources/swift5/Validation.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/Validation.mustache @@ -77,11 +77,11 @@ import Foundation /// - Throws: `ValidationError` if the numeric is invalid against the rule. {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ import Foundation /// - Throws: `ValidationError` if the numeric is invalid against the rule. {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache index b045c18c66b5..3f60f35560ea 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache index 71025d946997..cdc954502fd6 100644 --- a/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/modelObject.mustache @@ -11,13 +11,13 @@ {{#validatable}} {{#hasValidation}} {{#isString}} - static let {{{name}}}Rule = StringRule(minLength: {{#minLength}}{{{.}}}{{/minLength}}{{^minLength}}nil{{/minLength}}, maxLength: {{#maxLength}}{{{.}}}{{/maxLength}}{{^maxLength}}nil{{/maxLength}}, pattern: {{#pattern}}"{{{.}}}"{{/pattern}}{{^pattern}}nil{{/pattern}}) + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let {{{name}}}Rule = StringRule(minLength: {{#minLength}}{{{.}}}{{/minLength}}{{^minLength}}nil{{/minLength}}, maxLength: {{#maxLength}}{{{.}}}{{/maxLength}}{{^maxLength}}nil{{/maxLength}}, pattern: {{#pattern}}"{{{.}}}"{{/pattern}}{{^pattern}}nil{{/pattern}}) {{/isString}} {{#isNumeric}} - static let {{{name}}}Rule = NumericRule<{{{dataType}}}>(minimum: {{#minimum}}{{{.}}}{{/minimum}}{{^minimum}}nil{{/minimum}}, exclusiveMinimum: {{#exclusiveMinimum}}true{{/exclusiveMinimum}}{{^exclusiveMinimum}}false{{/exclusiveMinimum}}, maximum: {{#maximum}}{{{.}}}{{/maximum}}{{^maximum}}nil{{/maximum}}, exclusiveMaximum: {{#exclusiveMaximum}}true{{/exclusiveMaximum}}{{^exclusiveMaximum}}false{{/exclusiveMaximum}}, multipleOf: {{#multipleOf}}{{{.}}}{{/multipleOf}}{{^multipleOf}}nil{{/multipleOf}}) + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let {{{name}}}Rule = NumericRule<{{{dataType}}}>(minimum: {{#minimum}}{{{.}}}{{/minimum}}{{^minimum}}nil{{/minimum}}, exclusiveMinimum: {{#exclusiveMinimum}}true{{/exclusiveMinimum}}{{^exclusiveMinimum}}false{{/exclusiveMinimum}}, maximum: {{#maximum}}{{{.}}}{{/maximum}}{{^maximum}}nil{{/maximum}}, exclusiveMaximum: {{#exclusiveMaximum}}true{{/exclusiveMaximum}}{{^exclusiveMaximum}}false{{/exclusiveMaximum}}, multipleOf: {{#multipleOf}}{{{.}}}{{/multipleOf}}{{^multipleOf}}nil{{/multipleOf}}) {{/isNumeric}} {{#isArray}} - static let {{{name}}}Rule = ArrayRule(minItems: {{#minItems}}{{{.}}}{{/minItems}}{{^minItems}}nil{{/minItems}}, maxItems: {{#maxItems}}{{{.}}}{{/maxItems}}{{^maxItems}}nil{{/maxItems}}, uniqueItems: {{#uniqueItems}}true{{/uniqueItems}}{{^uniqueItems}}false{{/uniqueItems}}) + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let {{{name}}}Rule = ArrayRule(minItems: {{#minItems}}{{{.}}}{{/minItems}}{{^minItems}}nil{{/minItems}}, maxItems: {{#maxItems}}{{{.}}}{{/maxItems}}{{^maxItems}}nil{{/maxItems}}, uniqueItems: {{#uniqueItems}}true{{/uniqueItems}}{{^uniqueItems}}false{{/uniqueItems}}) {{/isArray}} {{/hasValidation}} {{/validatable}} diff --git a/modules/openapi-generator/src/main/resources/swift6/Validation.mustache b/modules/openapi-generator/src/main/resources/swift6/Validation.mustache index 148a5123760d..2a2dab67d0c4 100644 --- a/modules/openapi-generator/src/main/resources/swift6/Validation.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/Validation.mustache @@ -78,11 +78,11 @@ extension NumericRule: Sendable where T: Sendable {} /// - Throws: `ValidationError` if the numeric is invalid against the rule. {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ extension NumericRule: Sendable where T: Sendable {} /// - Throws: `ValidationError` if the numeric is invalid against the rule. {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache index a20f72804cd7..94fde0e7e582 100644 --- a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache b/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache index c00584f6e57f..fa2f3c7c32d6 100644 --- a/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/modelObject.mustache @@ -11,13 +11,13 @@ {{#validatable}} {{#hasValidation}} {{#isString}} - static let {{{name}}}Rule = StringRule(minLength: {{#minLength}}{{{.}}}{{/minLength}}{{^minLength}}nil{{/minLength}}, maxLength: {{#maxLength}}{{{.}}}{{/maxLength}}{{^maxLength}}nil{{/maxLength}}, pattern: {{#pattern}}"{{{.}}}"{{/pattern}}{{^pattern}}nil{{/pattern}}) + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let {{{name}}}Rule = StringRule(minLength: {{#minLength}}{{{.}}}{{/minLength}}{{^minLength}}nil{{/minLength}}, maxLength: {{#maxLength}}{{{.}}}{{/maxLength}}{{^maxLength}}nil{{/maxLength}}, pattern: {{#pattern}}"{{{.}}}"{{/pattern}}{{^pattern}}nil{{/pattern}}) {{/isString}} {{#isNumeric}} - static let {{{name}}}Rule = NumericRule<{{{dataType}}}>(minimum: {{#minimum}}{{{.}}}{{/minimum}}{{^minimum}}nil{{/minimum}}, exclusiveMinimum: {{#exclusiveMinimum}}true{{/exclusiveMinimum}}{{^exclusiveMinimum}}false{{/exclusiveMinimum}}, maximum: {{#maximum}}{{{.}}}{{/maximum}}{{^maximum}}nil{{/maximum}}, exclusiveMaximum: {{#exclusiveMaximum}}true{{/exclusiveMaximum}}{{^exclusiveMaximum}}false{{/exclusiveMaximum}}, multipleOf: {{#multipleOf}}{{{.}}}{{/multipleOf}}{{^multipleOf}}nil{{/multipleOf}}) + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let {{{name}}}Rule = NumericRule<{{{dataType}}}>(minimum: {{#minimum}}{{{.}}}{{/minimum}}{{^minimum}}nil{{/minimum}}, exclusiveMinimum: {{#exclusiveMinimum}}true{{/exclusiveMinimum}}{{^exclusiveMinimum}}false{{/exclusiveMinimum}}, maximum: {{#maximum}}{{{.}}}{{/maximum}}{{^maximum}}nil{{/maximum}}, exclusiveMaximum: {{#exclusiveMaximum}}true{{/exclusiveMaximum}}{{^exclusiveMaximum}}false{{/exclusiveMaximum}}, multipleOf: {{#multipleOf}}{{{.}}}{{/multipleOf}}{{^multipleOf}}nil{{/multipleOf}}) {{/isNumeric}} {{#isArray}} - static let {{{name}}}Rule = ArrayRule(minItems: {{#minItems}}{{{.}}}{{/minItems}}{{^minItems}}nil{{/minItems}}, maxItems: {{#maxItems}}{{{.}}}{{/maxItems}}{{^maxItems}}nil{{/maxItems}}, uniqueItems: {{#uniqueItems}}true{{/uniqueItems}}{{^uniqueItems}}false{{/uniqueItems}}) + {{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}public{{/nonPublicApi}} static let {{{name}}}Rule = ArrayRule(minItems: {{#minItems}}{{{.}}}{{/minItems}}{{^minItems}}nil{{/minItems}}, maxItems: {{#maxItems}}{{{.}}}{{/maxItems}}{{^maxItems}}nil{{/maxItems}}, uniqueItems: {{#uniqueItems}}true{{/uniqueItems}}{{^uniqueItems}}false{{/uniqueItems}}) {{/isArray}} {{/hasValidation}} {{/validatable}} diff --git a/modules/openapi-generator/src/main/resources/typescript/package.mustache b/modules/openapi-generator/src/main/resources/typescript/package.mustache index 34c324c08453..704e3a515a5c 100644 --- a/modules/openapi-generator/src/main/resources/typescript/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/package.mustache @@ -71,12 +71,10 @@ {{#useInversify}} "inversify": "^6.0.1", {{/useInversify}} - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" }{{#npmRepository}},{{/npmRepository}} {{#npmRepository}} "publishConfig":{ diff --git a/modules/openapi-generator/src/main/resources/xojo-client/README.mustache b/modules/openapi-generator/src/main/resources/xojo-client/README.mustache index 2853be362675..027695ee135e 100644 --- a/modules/openapi-generator/src/main/resources/xojo-client/README.mustache +++ b/modules/openapi-generator/src/main/resources/xojo-client/README.mustache @@ -33,7 +33,7 @@ This project depends on [Xoson](https://github.com/Topheee/xoson) `v2.2.0` (and git clone 'https://github.com/Topheee/xoson.git' ``` -Open the `Xoson.xojo_project` from the cloned git repository with Xojo and copy the `Xoson` module to your project. Similarily, open the `{{{projectName}}}.xojo_project` file with Xojo and copy `{{{projectName}}}` to your project. +Open the `Xoson.xojo_project` from the cloned git repository with Xojo and copy the `Xoson` module to your project. Similarly, open the `{{{projectName}}}.xojo_project` file with Xojo and copy `{{{projectName}}}` to your project. > Since Xojo currently has no package manager, you need to manually copy both the `Xoson` and the `{{{projectName}}}` modules to your Xojo project. diff --git a/modules/openapi-generator/src/main/resources/zapier/authentication.mustache b/modules/openapi-generator/src/main/resources/zapier/authentication.mustache index 8294e5fc99a6..8a1bf2e76b5e 100644 --- a/modules/openapi-generator/src/main/resources/zapier/authentication.mustache +++ b/modules/openapi-generator/src/main/resources/zapier/authentication.mustache @@ -1,4 +1,4 @@ module.exports = { - // TODO: autentication logic + // TODO: authentication logic // https://platform.zapier.com/cli_tutorials/getting-started#adding-authentication }; \ No newline at end of file diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java index 4e297f5b0af1..507d272c8e1e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/InlineModelResolverTest.java @@ -869,7 +869,7 @@ public void inheritanceWithInlineDiscriminator() { // Contact ComposedSchema contact = (ComposedSchema) openAPI.getComponents().getSchemas().get("Contact"); - Schema contactAllOf = contact.getAllOf().get(1); // use the inline child scheam directly + Schema contactAllOf = contact.getAllOf().get(1); // use the inline child schema directly assertEquals(contact.getExtensions().get("x-discriminator-value"), "contact"); assertEquals(contact.getAllOf().get(0).get$ref(), "#/components/schemas/Party"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java index 21f36c1ee6a9..8bed0f7382eb 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/OpenAPINormalizerTest.java @@ -99,7 +99,7 @@ public void testOpenAPINormalizerEnableKeepOnlyFirstTagInOperation() { @Test public void testOpenAPINormalizerRemoveAnyOfOneOfAndKeepPropertiesOnly() { - // to test the rule REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIIES_ONLY + // to test the rule REMOVE_ANYOF_ONEOF_AND_KEEP_PROPERTIES_ONLY OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml"); Schema schema = openAPI.getComponents().getSchemas().get("Person"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinSpringServerCodegenTest.java new file mode 100644 index 000000000000..26f857c2d1e9 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/KotlinSpringServerCodegenTest.java @@ -0,0 +1,63 @@ +package org.openapitools.codegen.kotlin; + +import org.openapitools.codegen.ClientOptInput; +import org.openapitools.codegen.DefaultGenerator; +import org.openapitools.codegen.TestUtils; +import org.openapitools.codegen.languages.KotlinSpringServerCodegen; +import org.testng.annotations.Test; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import static org.testng.Assert.*; + +public class KotlinSpringServerCodegenTest { + + @Test + public void gradleWrapperIsGenerated() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + + KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + + codegen.setOutputDir(output.getAbsolutePath()); + new DefaultGenerator().opts( + new ClientOptInput().openAPI(TestUtils.parseSpec("src/test/resources/3_0/petstore.yaml")) + .config(codegen) + ).generate(); + String outputPath = output.getAbsolutePath(); + Path gradleWrapperProperties = Paths.get(outputPath + "/gradle/wrapper/gradle-wrapper.properties"); + Path gradleWrapperJar = Paths.get(outputPath + "/gradle/wrapper/gradle-wrapper.jar"); + Path gradleWrapper = Paths.get(outputPath + "/gradlew"); + Path gradleWrapperBat = Paths.get(outputPath + "/gradlew.bat"); + TestUtils.assertFileExists(gradleWrapperProperties); + TestUtils.assertFileExists(gradleWrapper); + TestUtils.assertFileExists(gradleWrapperBat); + //Different because file is not a text file + assertTrue(Files.exists(gradleWrapperJar)); + + //Spring Cloud + File outputCloud = Files.createTempDirectory("testCloud").toFile().getCanonicalFile(); + outputCloud.deleteOnExit(); + codegen.setLibrary(KotlinSpringServerCodegen.SPRING_CLOUD_LIBRARY); + codegen.setOutputDir(outputCloud.getAbsolutePath()); + new DefaultGenerator().opts( + new ClientOptInput().openAPI(TestUtils.parseSpec("src/test/resources/3_0/petstore.yaml")) + .config(codegen) + ).generate(); + + String outputPathCloud = outputCloud.getAbsolutePath(); + Path gradleWrapperPropertiesCloud = Paths.get(outputPathCloud + "/gradle/wrapper/gradle-wrapper.properties"); + Path gradleWrapperJarCloud = Paths.get(outputPathCloud + "/gradle/wrapper/gradle-wrapper.jar"); + Path gradleWrapperCloud = Paths.get(outputPathCloud + "/gradlew"); + Path gradleWrapperBatCloud = Paths.get(outputPathCloud + "/gradlew.bat"); + TestUtils.assertFileExists(gradleWrapperPropertiesCloud); + TestUtils.assertFileExists(gradleWrapperCloud); + TestUtils.assertFileExists(gradleWrapperBatCloud); + //Different because file is not a text file + assertTrue(Files.exists(gradleWrapperJarCloud)); + } +} diff --git a/modules/openapi-generator/src/test/resources/2_0/c/petstore.yaml b/modules/openapi-generator/src/test/resources/2_0/c/petstore.yaml index f20f1569b6db..d8d01947081c 100644 --- a/modules/openapi-generator/src/test/resources/2_0/c/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/c/petstore.yaml @@ -395,6 +395,25 @@ paths: schema: type: string description: Thank you message + '/store/recommend': + post: + tags: + - store + summary: Would you recommend our service to a friend? + description: '' + operationId: sendRecommend + parameters: + - in: formData + name: recommend + description: Would you recommend us or not? + required: no + type: boolean + responses: + '200': + description: successful operation + schema: + type: string + description: Thank you message /store/daysWithoutIncident: get: tags: diff --git a/modules/openapi-generator/src/test/resources/3_0/jetbrains/github.json b/modules/openapi-generator/src/test/resources/3_0/jetbrains/github.json index 1fee47e06241..ed62ce62b1e6 100644 --- a/modules/openapi-generator/src/test/resources/3_0/jetbrains/github.json +++ b/modules/openapi-generator/src/test/resources/3_0/jetbrains/github.json @@ -94117,7 +94117,7 @@ "nullable": true }, "idle_timeout_notice": { - "description": "Text to show user when codespace idle timeout minutes has been overriden by an organization policy", + "description": "Text to show user when codespace idle timeout minutes has been overridden by an organization policy", "type": "string", "nullable": true }, @@ -116606,7 +116606,7 @@ "nullable": true }, "idle_timeout_notice": { - "description": "Text to show user when codespace idle timeout minutes has been overriden by an organization policy", + "description": "Text to show user when codespace idle timeout minutes has been overridden by an organization policy", "type": "string", "nullable": true }, diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/.editorconfig b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/.editorconfig deleted file mode 100644 index 5ad6921484a1..000000000000 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/.editorconfig +++ /dev/null @@ -1,2 +0,0 @@ -[*.cs] -dotnet_diagnostic.xUnit1031.severity = none diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/BodyApiTests.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/BodyApiTests.cs deleted file mode 100644 index 06da198a3efa..000000000000 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/BodyApiTests.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Echo Server API - * - * Echo Server API - * - * The version of the OpenAPI document: 0.1.0 - * Contact: team@openapitools.org - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.IO; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Reflection; -using RestSharp; -using Xunit; - -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -// uncomment below to import models -//using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Test.Api -{ - /// - /// Class for testing BodyApi - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the API endpoint. - /// - public class BodyApiTests : IDisposable - { - private BodyApi instance; - - public BodyApiTests() - { - instance = new BodyApi(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of BodyApi - /// - [Fact] - public void InstanceTest() - { - // TODO uncomment below to test 'IsType' BodyApi - //Assert.IsType(instance); - } - - /// - /// Test TestBinaryGif - /// - [Fact] - public void TestBinaryGifTest() - { - // TODO uncomment below to test the method and replace null with proper value - //var response = instance.TestBinaryGif(); - //Assert.IsType(response); - } - - /// - /// Test TestBodyApplicationOctetstreamBinary - /// - [Fact] - public void TestBodyApplicationOctetstreamBinaryTest() - { - // TODO uncomment below to test the method and replace null with proper value - //System.IO.Stream? body = null; - //var response = instance.TestBodyApplicationOctetstreamBinary(body); - //Assert.IsType(response); - } - - /// - /// Test TestEchoBodyFreeFormObjectResponseString - /// - [Fact] - public void TestEchoBodyFreeFormObjectResponseStringTest() - { - // TODO uncomment below to test the method and replace null with proper value - //Object? body = null; - //var response = instance.TestEchoBodyFreeFormObjectResponseString(body); - //Assert.IsType(response); - } - - /// - /// Test TestEchoBodyPet - /// - [Fact] - public void TestEchoBodyPetTest() - { - Pet? pet = new Pet(123, "cat", new Category() { Id = 12, Name = "Test" }, new List(){"http://google.com"},null, null); - var response = instance.TestEchoBodyPet(pet); - Assert.IsType(response); - } - - /// - /// Test TestEchoBodyPetResponseString - /// - [Fact] - public void TestEchoBodyPetResponseStringTest() - { - // TODO uncomment below to test the method and replace null with proper value - //Pet? pet = null; - //var response = instance.TestEchoBodyPetResponseString(pet); - //Assert.IsType(response); - } - - /// - /// Test TestEchoBodyTagResponseString - /// - [Fact] - public void TestEchoBodyTagResponseStringTest() - { - // TODO uncomment below to test the method and replace null with proper value - //Tag? tag = null; - //var response = instance.TestEchoBodyTagResponseString(tag); - //Assert.IsType(response); - } - } -} diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/FormApiTests.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/FormApiTests.cs deleted file mode 100644 index d5bc490bddeb..000000000000 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/FormApiTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Echo Server API - * - * Echo Server API - * - * The version of the OpenAPI document: 0.1.0 - * Contact: team@openapitools.org - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.IO; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Reflection; -using RestSharp; -using Xunit; - -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Api; - -namespace Org.OpenAPITools.Test.Api -{ - /// - /// Class for testing FormApi - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the API endpoint. - /// - public class FormApiTests : IDisposable - { - private FormApi instance; - - public FormApiTests() - { - instance = new FormApi(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of FormApi - /// - [Fact] - public void InstanceTest() - { - // TODO uncomment below to test 'IsType' FormApi - //Assert.IsType(instance); - } - - /// - /// Test TestFormIntegerBooleanString - /// - [Fact] - public void TestFormIntegerBooleanStringTest() - { - // TODO uncomment below to test the method and replace null with proper value - //int? integerForm = null; - //bool? booleanForm = null; - //string? stringForm = null; - //var response = instance.TestFormIntegerBooleanString(integerForm, booleanForm, stringForm); - //Assert.IsType(response); - } - } -} diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/CustomTest.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/CustomTest.cs deleted file mode 100644 index 06b930205b5c..000000000000 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/CustomTest.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Newtonsoft.Json.Linq; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Xml; -using Xunit; - -namespace Org.OpenAPITools.Test -{ - public class CustomTest - { - private QueryApi api = new QueryApi(); - private BodyApi bodyApi = new BodyApi(); - - [Fact] - public void TestEchoBodyPet() - { - Pet queryObject = new Pet(12345L, "Hello World", new Category(987L, "new category"), new List { "http://a.com", "http://b.com" }); - Pet p = bodyApi.TestEchoBodyPet(queryObject); - Assert.NotNull(p); - Assert.Equal("Hello World", p.Name); - Assert.Equal(12345L, p.Id); - - // response is empty body - Pet p2 = bodyApi.TestEchoBodyPet(null); - Assert.Null(p2); - } - - /** - * Test query parameter(s) - *

- * Test query parameter(s) - * - * @throws ApiException if the Api call fails - */ - [Fact] - public void TestQueryStyleFormExplodeTrueObjectTest() - { - Pet queryObject = new Pet(12345L, "Hello World", new Category(987L, "new category"), new List { "http://a.com", "http://b.com" }); - String response = api.TestQueryStyleFormExplodeTrueObject(queryObject); - EchoServerResponseParser p = new EchoServerResponseParser(response); - Assert.Equal("/query/style_form/explode_true/object?query_object=class%20Pet%20%7b%0a%20%20Id%3a%2012345%0a%20%20Name%3a%20Hello%20World%0a%20%20Category%3a%20class%20Category%20%7b%0a%20%20Id%3a%20987%0a%20%20Name%3a%20new%20category%0a%7d%0a%0a%20%20PhotoUrls%3a%20System.Collections.Generic.List%601%5bSystem.String%5d%0a%20%20Tags%3a%20%0a%20%20Status%3a%20%0a%7d%0a", p.path); - } - - [Fact] - public void testQueryStyleDeepObjectExplodeTrueObjectTest() - { - Pet queryObject = new Pet(12345L, "Hello World", new Category(987L, "new category"), new List { "http://a.com", "http://b.com" }); - String response = api.TestQueryStyleDeepObjectExplodeTrueObject(queryObject); - EchoServerResponseParser p = new EchoServerResponseParser(response); - Assert.Equal("/query/style_deepObject/explode_true/object?queryObject%5bid%5d=12345&queryObject%5bname%5d=Hello%20World&queryObject%5bcategory%5d=class%20Category%20%7b%0a%20%20Id%3a%20987%0a%20%20Name%3a%20new%20category%0a%7d%0a&queryObject%5bphotoUrls%5d=http%3a%2f%2fa.com%2chttp%3a%2f%2fb.com", p.path); - } - - - [Fact] - public void testQueryStyleDeepObjectExplodeTrueObjectAsyncTest() - { - Pet queryObject = new Pet(12345L, "Hello World", new Category(987L, "new category"), new List { "http://a.com", "http://b.com" }); - Task responseTask = api.TestQueryStyleDeepObjectExplodeTrueObjectAsync(queryObject); - EchoServerResponseParser p = new EchoServerResponseParser(responseTask.Result); - Assert.Equal("/query/style_deepObject/explode_true/object?queryObject%5bid%5d=12345&queryObject%5bname%5d=Hello%20World&queryObject%5bcategory%5d=class%20Category%20%7b%0a%20%20Id%3a%20987%0a%20%20Name%3a%20new%20category%0a%7d%0a&queryObject%5bphotoUrls%5d=http%3a%2f%2fa.com%2chttp%3a%2f%2fb.com", p.path); - } - } -} diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/EchoServerResponseParser.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/EchoServerResponseParser.cs deleted file mode 100644 index f87dae4ed12e..000000000000 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/EchoServerResponseParser.cs +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using static System.Net.Mime.MediaTypeNames; - -namespace Org.OpenAPITools.Test -{ - public class EchoServerResponseParser - { - public String method; // e.g. GET - public String path; // e.g. /query/style_form/explode_true/object?id=12345 - public String protocol; // e.g. HTTP/1.1 - public Dictionary headers = new Dictionary(); - public String body; // e.g. Hello World! - - public EchoServerResponseParser(String response) - { - if (response == null) - { - throw new SystemException("Echo server response cannot be null"); - } - - String[] lines = Regex.Split(response, "\r\n|\r|\n"); - bool firstLine = true; - bool bodyStart = false; - StringBuilder bodyBuilder = new StringBuilder(); - - foreach (String line in lines) - { - if (firstLine) - { - String[] items = line.Split(" "); - this.method = items[0]; - this.path = items[1]; - this.protocol = items[2]; - firstLine = false; - continue; - } - - if (bodyStart) - { - bodyBuilder.Append(line); - bodyBuilder.Append("\n"); - } - - if (String.IsNullOrEmpty(line)) - { - bodyStart = true; - continue; - } - - // store the header key-value pair in headers - String[] keyValue = line.Split(": "); - if (keyValue.Length == 2) - { // skip blank line, non key-value pair - this.headers.Add(keyValue[0], keyValue[1]); - } - } - - body = bodyBuilder.ToString(); - } - } -} diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj deleted file mode 100644 index a381e6a2f3cf..000000000000 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - Org.OpenAPITools.Test - Org.OpenAPITools.Test - net6.0 - false - annotations - - - - - - - - - - - - diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs deleted file mode 100644 index 655b101ecf78..000000000000 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiClient.cs +++ /dev/null @@ -1,815 +0,0 @@ -/* - * Echo Server API - * - * Echo Server API - * - * The version of the OpenAPI document: 0.1.0 - * Contact: team@openapitools.org - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters; -using System.Text; -using System.Threading; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using RestSharp; -using RestSharp.Serializers; -using RestSharpMethod = RestSharp.Method; -using FileIO = System.IO.File; -using Polly; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Client -{ - ///

- /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. - /// - internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer - { - private readonly IReadableConfiguration _configuration; - private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - public CustomJsonCodec(IReadableConfiguration configuration) - { - _configuration = configuration; - } - - public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) - { - _serializerSettings = serializerSettings; - _configuration = configuration; - } - - /// - /// Serialize the object into a JSON string. - /// - /// Object to be serialized. - /// A JSON string. - public string Serialize(object obj) - { - if (obj != null && obj is AbstractOpenAPISchema) - { - // the object to be serialized is an oneOf/anyOf schema - return ((AbstractOpenAPISchema)obj).ToJson(); - } - else - { - return JsonConvert.SerializeObject(obj, _serializerSettings); - } - } - - public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); - - public T Deserialize(RestResponse response) - { - var result = (T)Deserialize(response, typeof(T)); - return result; - } - - /// - /// Deserialize the JSON string into a proper object. - /// - /// The HTTP response. - /// Object type. - /// Object representation of the JSON string. - internal object Deserialize(RestResponse response, Type type) - { - if (type == typeof(byte[])) // return byte array - { - return response.RawBytes; - } - - // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) - if (type == typeof(Stream)) - { - var bytes = response.RawBytes; - if (response.Headers != null) - { - var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) - ? global::System.IO.Path.GetTempPath() - : _configuration.TempFolderPath; - var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); - foreach (var header in response.Headers) - { - var match = regex.Match(header.ToString()); - if (match.Success) - { - string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); - FileIO.WriteAllBytes(fileName, bytes); - return new FileStream(fileName, FileMode.Open); - } - } - } - var stream = new MemoryStream(bytes); - return stream; - } - - if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object - { - return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); - } - - if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type - { - return Convert.ChangeType(response.Content, type); - } - - // at this point, it must be a model (json) - try - { - return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); - } - catch (Exception e) - { - throw new ApiException(500, e.Message); - } - } - - public ISerializer Serializer => this; - public IDeserializer Deserializer => this; - - public string[] AcceptedContentTypes => ContentType.JsonAccept; - - public SupportsContentType SupportsContentType => contentType => - contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || - contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); - - public ContentType ContentType { get; set; } = ContentType.Json; - - public DataFormat DataFormat => DataFormat.Json; - } - /// - /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), - /// encapsulating general REST accessor use cases. - /// - public partial class ApiClient : ISynchronousClient, IAsynchronousClient - { - private readonly string _baseUrl; - - /// - /// Specifies the settings on a object. - /// These settings can be adjusted to accommodate custom serialization rules. - /// - public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - /// - /// Allows for extending request processing for generated code. - /// - /// The RestSharp request object - partial void InterceptRequest(RestRequest request); - - /// - /// Allows for extending response processing for generated code. - /// - /// The RestSharp request object - /// The RestSharp response object - partial void InterceptResponse(RestRequest request, RestResponse response); - - /// - /// Initializes a new instance of the , defaulting to the global configurations' base url. - /// - public ApiClient() - { - _baseUrl = GlobalConfiguration.Instance.BasePath; - } - - /// - /// Initializes a new instance of the - /// - /// The target service's base path in URL format. - /// - public ApiClient(string basePath) - { - if (string.IsNullOrEmpty(basePath)) - throw new ArgumentException("basePath cannot be empty"); - - _baseUrl = basePath; - } - - /// - /// Constructs the RestSharp version of an http method - /// - /// Swagger Client Custom HttpMethod - /// RestSharp's HttpMethod instance. - /// - private RestSharpMethod Method(HttpMethod method) - { - RestSharpMethod other; - switch (method) - { - case HttpMethod.Get: - other = RestSharpMethod.Get; - break; - case HttpMethod.Post: - other = RestSharpMethod.Post; - break; - case HttpMethod.Put: - other = RestSharpMethod.Put; - break; - case HttpMethod.Delete: - other = RestSharpMethod.Delete; - break; - case HttpMethod.Head: - other = RestSharpMethod.Head; - break; - case HttpMethod.Options: - other = RestSharpMethod.Options; - break; - case HttpMethod.Patch: - other = RestSharpMethod.Patch; - break; - default: - throw new ArgumentOutOfRangeException("method", method, null); - } - - return other; - } - - /// - /// Provides all logic for constructing a new RestSharp . - /// At this point, all information for querying the service is known. - /// Here, it is simply mapped into the RestSharp request. - /// - /// The http verb. - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// [private] A new RestRequest instance. - /// - private RestRequest NewRequest( - HttpMethod method, - string path, - RequestOptions options, - IReadableConfiguration configuration) - { - if (path == null) throw new ArgumentNullException("path"); - if (options == null) throw new ArgumentNullException("options"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - RestRequest request = new RestRequest(path, Method(method)); - - if (options.PathParameters != null) - { - foreach (var pathParam in options.PathParameters) - { - request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); - } - } - - if (options.QueryParameters != null) - { - foreach (var queryParam in options.QueryParameters) - { - foreach (var value in queryParam.Value) - { - request.AddQueryParameter(queryParam.Key, value); - } - } - } - - if (configuration.DefaultHeaders != null) - { - foreach (var headerParam in configuration.DefaultHeaders) - { - request.AddHeader(headerParam.Key, headerParam.Value); - } - } - - if (options.HeaderParameters != null) - { - foreach (var headerParam in options.HeaderParameters) - { - foreach (var value in headerParam.Value) - { - request.AddHeader(headerParam.Key, value); - } - } - } - - if (options.FormParameters != null) - { - foreach (var formParam in options.FormParameters) - { - request.AddParameter(formParam.Key, formParam.Value); - } - } - - if (options.Data != null) - { - if (options.Data is Stream stream) - { - var contentType = "application/octet-stream"; - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - contentType = contentTypes[0]; - } - - var bytes = ClientUtils.ReadAsBytes(stream); - request.AddParameter(contentType, bytes, ParameterType.RequestBody); - } - else - { - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) - { - request.RequestFormat = DataFormat.Json; - } - else - { - // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. - } - } - else - { - // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. - request.RequestFormat = DataFormat.Json; - } - - request.AddJsonBody(options.Data); - } - } - - if (options.FileParameters != null) - { - foreach (var fileParam in options.FileParameters) - { - foreach (var file in fileParam.Value) - { - var bytes = ClientUtils.ReadAsBytes(file); - var fileStream = file as FileStream; - if (fileStream != null) - request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); - else - request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); - } - } - } - - return request; - } - - /// - /// Transforms a RestResponse instance into a new ApiResponse instance. - /// At this point, we have a concrete http response from the service. - /// Here, it is simply mapped into the [public] ApiResponse object. - /// - /// The RestSharp response object - /// A new ApiResponse instance. - private ApiResponse ToApiResponse(RestResponse response) - { - T result = response.Data; - string rawContent = response.Content; - - var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) - { - ErrorText = response.ErrorMessage, - Cookies = new List() - }; - - if (response.Headers != null) - { - foreach (var responseHeader in response.Headers) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.ContentHeaders != null) - { - foreach (var responseHeader in response.ContentHeaders) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.Cookies != null) - { - foreach (var responseCookies in response.Cookies.Cast()) - { - transformed.Cookies.Add( - new Cookie( - responseCookies.Name, - responseCookies.Value, - responseCookies.Path, - responseCookies.Domain) - ); - } - } - - return transformed; - } - - /// - /// Executes the HTTP request for the current service. - /// Based on functions received it can be async or sync. - /// - /// Local function that executes http request and returns http response. - /// Local function to specify options for the service. - /// The RestSharp request object - /// The RestSharp options object - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// A new ApiResponse instance. - private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; - var clientOptions = new RestClientOptions(baseUrl) - { - ClientCertificates = configuration.ClientCertificates, - Timeout = configuration.Timeout, - Proxy = configuration.Proxy, - UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials, - RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback - }; - setOptions(clientOptions); - - using (RestClient client = new RestClient(clientOptions, - configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) - { - InterceptRequest(request); - - RestResponse response = await getResponse(client); - - // if the response type is oneOf/anyOf, call FromJSON to deserialize the data - if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) - { - try - { - response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); - } - catch (Exception ex) - { - throw ex.InnerException != null ? ex.InnerException : ex; - } - } - else if (typeof(T).Name == "Stream") // for binary response - { - response.Data = (T)(object)new MemoryStream(response.RawBytes); - } - else if (typeof(T).Name == "Byte[]") // for byte response - { - response.Data = (T)(object)response.RawBytes; - } - else if (typeof(T).Name == "String") // for string response - { - response.Data = (T)(object)response.Content; - } - - InterceptResponse(request, response); - - var result = ToApiResponse(response); - if (response.ErrorMessage != null) - { - result.ErrorText = response.ErrorMessage; - } - - if (response.Cookies != null && response.Cookies.Count > 0) - { - if (result.Cookies == null) result.Cookies = new List(); - foreach (var restResponseCookie in response.Cookies.Cast()) - { - var cookie = new Cookie( - restResponseCookie.Name, - restResponseCookie.Value, - restResponseCookie.Path, - restResponseCookie.Domain - ) - { - Comment = restResponseCookie.Comment, - CommentUri = restResponseCookie.CommentUri, - Discard = restResponseCookie.Discard, - Expired = restResponseCookie.Expired, - Expires = restResponseCookie.Expires, - HttpOnly = restResponseCookie.HttpOnly, - Port = restResponseCookie.Port, - Secure = restResponseCookie.Secure, - Version = restResponseCookie.Version - }; - - result.Cookies.Add(cookie); - } - } - return result; - } - } - - private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) - { - if (policyResult.Outcome == OutcomeType.Successful) - { - return await client.Deserialize(policyResult.Result, cancellationToken); - } - else - { - return new RestResponse(request) - { - ErrorException = policyResult.FinalException - }; - } - } - - private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - Action setOptions = (clientOptions) => - { - var cookies = new CookieContainer(); - - if (options.Cookies != null && options.Cookies.Count > 0) - { - foreach (var cookie in options.Cookies) - { - cookies.Add(new Cookie(cookie.Name, cookie.Value)); - } - } - clientOptions.CookieContainer = cookies; - }; - - Func>> getResponse = (client) => - { - if (RetryConfiguration.RetryPolicy != null) - { - var policy = RetryConfiguration.RetryPolicy; - var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); - return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); - } - else - { - return Task.FromResult(client.Execute(request)); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); - } - - private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) - { - Action setOptions = (clientOptions) => - { - //no extra options - }; - - Func>> getResponse = async (client) => - { - if (RetryConfiguration.AsyncRetryPolicy != null) - { - var policy = RetryConfiguration.AsyncRetryPolicy; - var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); - return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); - } - else - { - return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration); - } - - #region IAsynchronousClient - /// - /// Make a HTTP GET request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP POST request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PUT request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP DELETE request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP HEAD request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP OPTION request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PATCH request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); - } - #endregion IAsynchronousClient - - #region ISynchronousClient - /// - /// Make a HTTP GET request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); - } - - /// - /// Make a HTTP POST request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); - } - - /// - /// Make a HTTP PUT request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); - } - - /// - /// Make a HTTP DELETE request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); - } - - /// - /// Make a HTTP HEAD request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); - } - - /// - /// Make a HTTP OPTION request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); - } - - /// - /// Make a HTTP PATCH request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); - } - #endregion ISynchronousClient - } -} diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Org.OpenAPITools.csproj deleted file mode 100644 index a5a6bf6200b9..000000000000 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - false - net6.0 - Org.OpenAPITools - Org.OpenAPITools - Library - OpenAPI - OpenAPI - OpenAPI Library - A library generated from a OpenAPI doc - No Copyright - Org.OpenAPITools - 1.0.0 - bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml - https://github.com/GIT_USER_ID/GIT_REPO_ID.git - git - Minor update - annotations - false - - - - - - - - - - - - - - diff --git a/samples/client/echo_api/csharp-restsharp/.gitignore b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/.gitignore similarity index 100% rename from samples/client/echo_api/csharp-restsharp/.gitignore rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/.gitignore diff --git a/samples/client/echo_api/csharp-restsharp/.openapi-generator-ignore b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/.openapi-generator-ignore similarity index 100% rename from samples/client/echo_api/csharp-restsharp/.openapi-generator-ignore rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/.openapi-generator-ignore diff --git a/samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/.openapi-generator/FILES similarity index 100% rename from samples/client/echo_api/csharp-restsharp/.openapi-generator/FILES rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/.openapi-generator/FILES diff --git a/samples/client/echo_api/csharp-restsharp/.openapi-generator/VERSION b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/.openapi-generator/VERSION similarity index 100% rename from samples/client/echo_api/csharp-restsharp/.openapi-generator/VERSION rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/.openapi-generator/VERSION diff --git a/samples/client/echo_api/csharp-restsharp/Org.OpenAPITools.sln b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/Org.OpenAPITools.sln similarity index 100% rename from samples/client/echo_api/csharp-restsharp/Org.OpenAPITools.sln rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/Org.OpenAPITools.sln diff --git a/samples/client/echo_api/csharp-restsharp/README.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/README.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/README.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/README.md diff --git a/samples/client/echo_api/csharp-restsharp/api/openapi.yaml b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/api/openapi.yaml similarity index 100% rename from samples/client/echo_api/csharp-restsharp/api/openapi.yaml rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/api/openapi.yaml diff --git a/samples/client/echo_api/csharp-restsharp/appveyor.yml b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/appveyor.yml similarity index 100% rename from samples/client/echo_api/csharp-restsharp/appveyor.yml rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/appveyor.yml diff --git a/samples/client/echo_api/csharp-restsharp/docs/AuthApi.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/AuthApi.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/AuthApi.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/AuthApi.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/Bird.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Bird.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/Bird.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Bird.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/BodyApi.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/BodyApi.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/BodyApi.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/BodyApi.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/Category.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Category.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/Category.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Category.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/DataQuery.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/DataQuery.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/DataQuery.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/DataQuery.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/DefaultValue.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/DefaultValue.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/DefaultValue.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/DefaultValue.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/FormApi.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/FormApi.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/FormApi.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/FormApi.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/HeaderApi.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/HeaderApi.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/HeaderApi.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/HeaderApi.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/NumberPropertiesOnly.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/NumberPropertiesOnly.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/NumberPropertiesOnly.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/NumberPropertiesOnly.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/PathApi.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/PathApi.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/PathApi.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/PathApi.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/Pet.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Pet.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/Pet.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Pet.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/Query.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Query.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/Query.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Query.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/QueryApi.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/QueryApi.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/QueryApi.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/QueryApi.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/StringEnumRef.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/StringEnumRef.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/StringEnumRef.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/StringEnumRef.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/Tag.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Tag.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/Tag.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/Tag.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/TestFormObjectMultipartRequestMarker.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/TestFormObjectMultipartRequestMarker.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/TestFormObjectMultipartRequestMarker.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/TestFormObjectMultipartRequestMarker.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.md diff --git a/samples/client/echo_api/csharp-restsharp/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md similarity index 100% rename from samples/client/echo_api/csharp-restsharp/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md diff --git a/samples/client/echo_api/csharp-restsharp/git_push.sh b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/git_push.sh similarity index 100% rename from samples/client/echo_api/csharp-restsharp/git_push.sh rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/git_push.sh diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/AuthApiTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/AuthApiTests.cs similarity index 82% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/AuthApiTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/AuthApiTests.cs index 456245d7bab6..7aee0fb1720e 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/AuthApiTests.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/AuthApiTests.cs @@ -63,5 +63,16 @@ public void TestAuthHttpBasicTest() //var response = instance.TestAuthHttpBasic(); //Assert.IsType(response); } + + /// + /// Test TestAuthHttpBearer + /// + [Fact] + public void TestAuthHttpBearerTest() + { + // TODO uncomment below to test the method and replace null with proper value + //var response = instance.TestAuthHttpBearer(); + //Assert.IsType(response); + } } } diff --git a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/BodyApiTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/BodyApiTests.cs new file mode 100644 index 000000000000..44f3129559b7 --- /dev/null +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/BodyApiTests.cs @@ -0,0 +1,177 @@ +/* + * Echo Server API + * + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +// uncomment below to import models +//using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing BodyApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class BodyApiTests : IDisposable + { + private BodyApi instance; + + public BodyApiTests() + { + instance = new BodyApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of BodyApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsType' BodyApi + //Assert.IsType(instance); + } + + /// + /// Test TestBinaryGif + /// + [Fact] + public void TestBinaryGifTest() + { + // TODO uncomment below to test the method and replace null with proper value + //var response = instance.TestBinaryGif(); + //Assert.IsType(response); + } + + /// + /// Test TestBodyApplicationOctetstreamBinary + /// + [Fact] + public void TestBodyApplicationOctetstreamBinaryTest() + { + // TODO uncomment below to test the method and replace null with proper value + //System.IO.Stream? body = null; + //var response = instance.TestBodyApplicationOctetstreamBinary(body); + //Assert.IsType(response); + } + + /// + /// Test TestBodyMultipartFormdataArrayOfBinary + /// + [Fact] + public void TestBodyMultipartFormdataArrayOfBinaryTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List files = null; + //var response = instance.TestBodyMultipartFormdataArrayOfBinary(files); + //Assert.IsType(response); + } + + /// + /// Test TestBodyMultipartFormdataSingleBinary + /// + [Fact] + public void TestBodyMultipartFormdataSingleBinaryTest() + { + // TODO uncomment below to test the method and replace null with proper value + //System.IO.Stream? myFile = null; + //var response = instance.TestBodyMultipartFormdataSingleBinary(myFile); + //Assert.IsType(response); + } + + /// + /// Test TestEchoBodyAllOfPet + /// + [Fact] + public void TestEchoBodyAllOfPetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Pet? pet = null; + //var response = instance.TestEchoBodyAllOfPet(pet); + //Assert.IsType(response); + } + + /// + /// Test TestEchoBodyFreeFormObjectResponseString + /// + [Fact] + public void TestEchoBodyFreeFormObjectResponseStringTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Object? body = null; + //var response = instance.TestEchoBodyFreeFormObjectResponseString(body); + //Assert.IsType(response); + } + + /// + /// Test TestEchoBodyPet + /// + [Fact] + public void TestEchoBodyPetTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Pet? pet = null; + //var response = instance.TestEchoBodyPet(pet); + //Assert.IsType(response); + } + + /// + /// Test TestEchoBodyPetResponseString + /// + [Fact] + public void TestEchoBodyPetResponseStringTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Pet? pet = null; + //var response = instance.TestEchoBodyPetResponseString(pet); + //Assert.IsType(response); + } + + /// + /// Test TestEchoBodyStringEnum + /// + [Fact] + public void TestEchoBodyStringEnumTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string? body = null; + //var response = instance.TestEchoBodyStringEnum(body); + //Assert.IsType(response); + } + + /// + /// Test TestEchoBodyTagResponseString + /// + [Fact] + public void TestEchoBodyTagResponseStringTest() + { + // TODO uncomment below to test the method and replace null with proper value + //Tag? tag = null; + //var response = instance.TestEchoBodyTagResponseString(tag); + //Assert.IsType(response); + } + } +} diff --git a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/FormApiTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/FormApiTests.cs new file mode 100644 index 000000000000..00b610e43f03 --- /dev/null +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/FormApiTests.cs @@ -0,0 +1,101 @@ +/* + * Echo Server API + * + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Reflection; +using RestSharp; +using Xunit; + +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +// uncomment below to import models +//using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing FormApi + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the API endpoint. + /// + public class FormApiTests : IDisposable + { + private FormApi instance; + + public FormApiTests() + { + instance = new FormApi(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FormApi + /// + [Fact] + public void InstanceTest() + { + // TODO uncomment below to test 'IsType' FormApi + //Assert.IsType(instance); + } + + /// + /// Test TestFormIntegerBooleanString + /// + [Fact] + public void TestFormIntegerBooleanStringTest() + { + // TODO uncomment below to test the method and replace null with proper value + //int? integerForm = null; + //bool? booleanForm = null; + //string? stringForm = null; + //var response = instance.TestFormIntegerBooleanString(integerForm, booleanForm, stringForm); + //Assert.IsType(response); + } + + /// + /// Test TestFormObjectMultipart + /// + [Fact] + public void TestFormObjectMultipartTest() + { + // TODO uncomment below to test the method and replace null with proper value + //TestFormObjectMultipartRequestMarker marker = null; + //var response = instance.TestFormObjectMultipart(marker); + //Assert.IsType(response); + } + + /// + /// Test TestFormOneof + /// + [Fact] + public void TestFormOneofTest() + { + // TODO uncomment below to test the method and replace null with proper value + //string? form1 = null; + //int? form2 = null; + //string? form3 = null; + //bool? form4 = null; + //long? id = null; + //string? name = null; + //var response = instance.TestFormOneof(form1, form2, form3, form4, id, name); + //Assert.IsType(response); + } + } +} diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/HeaderApiTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/HeaderApiTests.cs similarity index 81% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/HeaderApiTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/HeaderApiTests.cs index a2e6d2032ede..4f2fbcffaf9f 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/HeaderApiTests.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/HeaderApiTests.cs @@ -19,6 +19,8 @@ using Org.OpenAPITools.Client; using Org.OpenAPITools.Api; +// uncomment below to import models +//using Org.OpenAPITools.Model; namespace Org.OpenAPITools.Test.Api { @@ -54,16 +56,18 @@ public void InstanceTest() } /// - /// Test TestHeaderIntegerBooleanString + /// Test TestHeaderIntegerBooleanStringEnums /// [Fact] - public void TestHeaderIntegerBooleanStringTest() + public void TestHeaderIntegerBooleanStringEnumsTest() { // TODO uncomment below to test the method and replace null with proper value //int? integerHeader = null; //bool? booleanHeader = null; //string? stringHeader = null; - //var response = instance.TestHeaderIntegerBooleanString(integerHeader, booleanHeader, stringHeader); + //string? enumNonrefStringHeader = null; + //StringEnumRef? enumRefStringHeader = null; + //var response = instance.TestHeaderIntegerBooleanStringEnums(integerHeader, booleanHeader, stringHeader, enumNonrefStringHeader, enumRefStringHeader); //Assert.IsType(response); } } diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/PathApiTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/PathApiTests.cs similarity index 76% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/PathApiTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/PathApiTests.cs index f2879c217dfb..bb27fd798dec 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/PathApiTests.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/PathApiTests.cs @@ -19,6 +19,8 @@ using Org.OpenAPITools.Client; using Org.OpenAPITools.Api; +// uncomment below to import models +//using Org.OpenAPITools.Model; namespace Org.OpenAPITools.Test.Api { @@ -54,15 +56,17 @@ public void InstanceTest() } /// - /// Test TestsPathStringPathStringIntegerPathInteger + /// Test TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath /// [Fact] - public void TestsPathStringPathStringIntegerPathIntegerTest() + public void TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathTest() { // TODO uncomment below to test the method and replace null with proper value //string pathString = null; //int pathInteger = null; - //var response = instance.TestsPathStringPathStringIntegerPathInteger(pathString, pathInteger); + //string enumNonrefStringPath = null; + //StringEnumRef enumRefStringPath = null; + //var response = instance.TestsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath(pathString, pathInteger, enumNonrefStringPath, enumRefStringPath); //Assert.IsType(response); } } diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/QueryApiTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/QueryApiTests.cs similarity index 81% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/QueryApiTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/QueryApiTests.cs index d551bb07dbc1..7c5e580130de 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Api/QueryApiTests.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Api/QueryApiTests.cs @@ -62,8 +62,9 @@ public void InstanceTest() public void TestEnumRefStringTest() { // TODO uncomment below to test the method and replace null with proper value + //string? enumNonrefStringQuery = null; //StringEnumRef? enumRefStringQuery = null; - //var response = instance.TestEnumRefString(enumRefStringQuery); + //var response = instance.TestEnumRefString(enumNonrefStringQuery, enumRefStringQuery); //Assert.IsType(response); } @@ -75,7 +76,7 @@ public void TestQueryDatetimeDateStringTest() { // TODO uncomment below to test the method and replace null with proper value //DateTime? datetimeQuery = null; - //DateTime? dateQuery = null; + //DateOnly? dateQuery = null; //string? stringQuery = null; //var response = instance.TestQueryDatetimeDateString(datetimeQuery, dateQuery, stringQuery); //Assert.IsType(response); @@ -119,6 +120,30 @@ public void TestQueryStyleDeepObjectExplodeTrueObjectAllOfTest() //Assert.IsType(response); } + /// + /// Test TestQueryStyleFormExplodeFalseArrayInteger + /// + [Fact] + public void TestQueryStyleFormExplodeFalseArrayIntegerTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List? queryObject = null; + //var response = instance.TestQueryStyleFormExplodeFalseArrayInteger(queryObject); + //Assert.IsType(response); + } + + /// + /// Test TestQueryStyleFormExplodeFalseArrayString + /// + [Fact] + public void TestQueryStyleFormExplodeFalseArrayStringTest() + { + // TODO uncomment below to test the method and replace null with proper value + //List? queryObject = null; + //var response = instance.TestQueryStyleFormExplodeFalseArrayString(queryObject); + //Assert.IsType(response); + } + /// /// Test TestQueryStyleFormExplodeTrueArrayString /// diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/BirdTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/BirdTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/BirdTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/BirdTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/CategoryTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/CategoryTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/CategoryTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/DataQueryTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/DataQueryTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/DataQueryTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/DataQueryTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/DefaultValueTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/DefaultValueTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/DefaultValueTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/DefaultValueTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/NumberPropertiesOnlyTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/NumberPropertiesOnlyTests.cs similarity index 87% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/NumberPropertiesOnlyTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/NumberPropertiesOnlyTests.cs index e889f6a7a2c1..300daf5c40fa 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/NumberPropertiesOnlyTests.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/NumberPropertiesOnlyTests.cs @@ -65,21 +65,21 @@ public void NumberTest() } /// - /// Test the property 'VarFloat' + /// Test the property 'Float' /// [Fact] - public void VarFloatTest() + public void FloatTest() { - // TODO unit test for the property 'VarFloat' + // TODO unit test for the property 'Float' } /// - /// Test the property 'VarDouble' + /// Test the property 'Double' /// [Fact] - public void VarDoubleTest() + public void DoubleTest() { - // TODO unit test for the property 'VarDouble' + // TODO unit test for the property 'Double' } } } diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/PetTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/PetTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/PetTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/QueryTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/QueryTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/QueryTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/QueryTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/StringEnumRefTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/StringEnumRefTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/StringEnumRefTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/StringEnumRefTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/TagTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TagTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/TagTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/TestFormObjectMultipartRequestMarkerTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterTests.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTests.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTests.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools.Test/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTests.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterTests.cs diff --git a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..64ebed26518e --- /dev/null +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net8.0 + false + annotations + + + + + + + + + + + + diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/AuthApi.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/AuthApi.cs similarity index 99% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/AuthApi.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/AuthApi.cs index 2b34a89ac857..649e8375cfe4 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/AuthApi.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/AuthApi.cs @@ -274,6 +274,7 @@ public Org.OpenAPITools.Client.ApiResponse TestAuthHttpBasicWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -412,6 +413,7 @@ public Org.OpenAPITools.Client.ApiResponse TestAuthHttpBearerWithHttpInf }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/BodyApi.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/BodyApi.cs similarity index 99% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/BodyApi.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/BodyApi.cs index 159ebbd2542f..4b91b3612e5f 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/BodyApi.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/BodyApi.cs @@ -663,6 +663,7 @@ public System.IO.Stream TestBinaryGif(int operationIndex = 0) }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -792,6 +793,7 @@ public System.IO.Stream TestBinaryGif(int operationIndex = 0) }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -932,6 +934,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyMultipartFormdataArra }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1078,6 +1081,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyMultipartFormdataArra }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1218,6 +1222,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyMultipartFormdataArra }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1352,6 +1357,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyMultipartFormdataArra }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1486,6 +1492,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyMultipartFormdataArra }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1620,6 +1627,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyMultipartFormdataArra }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1754,6 +1762,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyMultipartFormdataArra }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1888,6 +1897,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyMultipartFormdataArra }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/FormApi.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/FormApi.cs similarity index 99% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/FormApi.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/FormApi.cs index 03ef6de434e1..45025c63f81d 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/FormApi.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/FormApi.cs @@ -366,6 +366,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -532,6 +533,7 @@ public Org.OpenAPITools.Client.ApiResponse TestFormObjectMultipartWithHt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -543,7 +545,7 @@ public Org.OpenAPITools.Client.ApiResponse TestFormObjectMultipartWithHt localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); } - localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter + localVarRequestOptions.FormParameters.Add("marker", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(marker) : Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter localVarRequestOptions.Operation = "FormApi.TestFormObjectMultipart"; localVarRequestOptions.OperationIndex = operationIndex; @@ -682,6 +684,7 @@ public Org.OpenAPITools.Client.ApiResponse TestFormObjectMultipartWithHt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/HeaderApi.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/HeaderApi.cs similarity index 99% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/HeaderApi.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/HeaderApi.cs index 41b07bcf1fca..ad1e9009e3c6 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/HeaderApi.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/HeaderApi.cs @@ -261,6 +261,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/PathApi.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/PathApi.cs similarity index 99% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/PathApi.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/PathApi.cs index a1ae25b575a6..a4a1ff7fc105 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/PathApi.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/PathApi.cs @@ -267,6 +267,7 @@ public Org.OpenAPITools.Client.ApiResponse TestsPathStringPathStringInte }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/QueryApi.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/QueryApi.cs similarity index 99% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/QueryApi.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/QueryApi.cs index 5b5dd8318d56..7c25c5d572f5 100644 --- a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Api/QueryApi.cs +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Api/QueryApi.cs @@ -691,6 +691,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -843,6 +844,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1005,6 +1007,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1163,6 +1166,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1347,6 +1351,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1483,6 +1488,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1621,6 +1627,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1759,6 +1766,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1897,6 +1905,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2035,6 +2044,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiClient.cs new file mode 100644 index 000000000000..8fab398a3f83 --- /dev/null +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiClient.cs @@ -0,0 +1,823 @@ +/* + * Echo Server API + * + * Echo Server API + * + * The version of the OpenAPI document: 0.1.0 + * Contact: team@openapitools.org + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp; +using RestSharp.Serializers; +using RestSharpMethod = RestSharp.Method; +using FileIO = System.IO.File; +using Polly; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer + { + private readonly IReadableConfiguration _configuration; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); + + public T Deserialize(RestResponse response) + { + var result = (T)Deserialize(response, typeof(T)); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(RestResponse response, Type type) + { + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = response.RawBytes; + if (response.Headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? global::System.IO.Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in response.Headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + FileIO.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public ISerializer Serializer => this; + public IDeserializer Deserializer => this; + + public string[] AcceptedContentTypes => ContentType.JsonAccept; + + public SupportsContentType SupportsContentType => contentType => + contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || + contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); + + public ContentType ContentType { get; set; } = ContentType.Json; + + public DataFormat DataFormat => DataFormat.Json; + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(RestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(RestRequest request, RestResponse response); + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = GlobalConfiguration.Instance.BasePath; + } + + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + _baseUrl = basePath; + } + + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.Get; + break; + case HttpMethod.Post: + other = RestSharpMethod.Post; + break; + case HttpMethod.Put: + other = RestSharpMethod.Put; + break; + case HttpMethod.Delete: + other = RestSharpMethod.Delete; + break; + case HttpMethod.Head: + other = RestSharpMethod.Head; + break; + case HttpMethod.Options: + other = RestSharpMethod.Options; + break; + case HttpMethod.Patch: + other = RestSharpMethod.Patch; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + + return other; + } + + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. + /// Here, it is simply mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + RestRequest request = new RestRequest(path, Method(method)); + + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.AddHeader(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + + if (options.Data != null) + { + if (options.Data is Stream stream) + { + var contentType = "application/octet-stream"; + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes[0]; + } + + var bytes = ClientUtils.ReadAsBytes(stream); + request.AddParameter(contentType, bytes, ParameterType.RequestBody); + } + else + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + + request.AddJsonBody(options.Data); + } + } + + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var bytes = ClientUtils.ReadAsBytes(file); + var fileStream = file as FileStream; + if (fileStream != null) + request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); + else + request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); + } + } + } + + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + + return request; + } + + /// + /// Transforms a RestResponse instance into a new ApiResponse instance. + /// At this point, we have a concrete http response from the service. + /// Here, it is simply mapped into the [public] ApiResponse object. + /// + /// The RestSharp response object + /// A new ApiResponse instance. + private ApiResponse ToApiResponse(RestResponse response) + { + T result = response.Data; + string rawContent = response.Content; + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.ContentHeaders != null) + { + foreach (var responseHeader in response.ContentHeaders) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies.Cast()) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + + return transformed; + } + + /// + /// Executes the HTTP request for the current service. + /// Based on functions received it can be async or sync. + /// + /// Local function that executes http request and returns http response. + /// Local function to specify options for the service. + /// The RestSharp request object + /// The RestSharp options object + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// A new ApiResponse instance. + private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; + var clientOptions = new RestClientOptions(baseUrl) + { + ClientCertificates = configuration.ClientCertificates, + Timeout = configuration.Timeout, + Proxy = configuration.Proxy, + UserAgent = configuration.UserAgent, + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback + }; + setOptions(clientOptions); + + using (RestClient client = new RestClient(clientOptions, + configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) + { + InterceptRequest(request); + + RestResponse response = await getResponse(client); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + try + { + response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + catch (Exception ex) + { + throw ex.InnerException != null ? ex.InnerException : ex; + } + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + else if (typeof(T).Name == "Byte[]") // for byte response + { + response.Data = (T)(object)response.RawBytes; + } + else if (typeof(T).Name == "String") // for string response + { + response.Data = (T)(object)response.Content; + } + + InterceptResponse(request, response); + + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies.Cast()) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + } + + private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) + { + if (policyResult.Outcome == OutcomeType.Successful) + { + return await client.Deserialize(policyResult.Result, cancellationToken); + } + else + { + return new RestResponse(request) + { + ErrorException = policyResult.FinalException + }; + } + } + + private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + Action setOptions = (clientOptions) => + { + var cookies = new CookieContainer(); + + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + cookies.Add(new Cookie(cookie.Name, cookie.Value)); + } + } + clientOptions.CookieContainer = cookies; + }; + + Func>> getResponse = (client) => + { + if (RetryConfiguration.RetryPolicy != null) + { + var policy = RetryConfiguration.RetryPolicy; + var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); + return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); + } + else + { + return Task.FromResult(client.Execute(request)); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); + } + + private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) + { + Action setOptions = (clientOptions) => + { + //no extra options + }; + + Func>> getResponse = async (client) => + { + if (RetryConfiguration.AsyncRetryPolicy != null) + { + var policy = RetryConfiguration.AsyncRetryPolicy; + var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); + return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); + } + else + { + return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration); + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); + } + #endregion ISynchronousClient + } +} diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiException.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiException.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiException.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiResponse.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiResponse.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ApiResponse.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ApiResponse.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ClientUtils.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ClientUtils.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ClientUtils.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/Configuration.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Configuration.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ExceptionFactory.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ExceptionFactory.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ExceptionFactory.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ExceptionFactory.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/GlobalConfiguration.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/GlobalConfiguration.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/GlobalConfiguration.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/GlobalConfiguration.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/HttpMethod.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/HttpMethod.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/HttpMethod.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/HttpMethod.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/IApiAccessor.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/IApiAccessor.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/IApiAccessor.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/IApiAccessor.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/IAsynchronousClient.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/IAsynchronousClient.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/IAsynchronousClient.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/IAsynchronousClient.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/IReadableConfiguration.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/IReadableConfiguration.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/IReadableConfiguration.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ISynchronousClient.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ISynchronousClient.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/ISynchronousClient.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/ISynchronousClient.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/Multimap.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Multimap.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/Multimap.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/Multimap.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/RequestOptions.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/RequestOptions.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/RequestOptions.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/RequestOptions.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/RetryConfiguration.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/RetryConfiguration.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Client/RetryConfiguration.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Client/RetryConfiguration.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Bird.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Bird.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Bird.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Bird.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Category.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Category.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Category.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Category.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/DataQuery.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/DataQuery.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/DataQuery.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/DataQuery.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/DefaultValue.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/DefaultValue.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/DefaultValue.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/DefaultValue.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/NumberPropertiesOnly.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/NumberPropertiesOnly.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/NumberPropertiesOnly.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/NumberPropertiesOnly.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Pet.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Pet.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Pet.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Query.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Query.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Query.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Query.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/StringEnumRef.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/StringEnumRef.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/StringEnumRef.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/StringEnumRef.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Tag.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/Tag.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/Tag.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestFormObjectMultipartRequestMarker.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/TestFormObjectMultipartRequestMarker.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestFormObjectMultipartRequestMarker.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/TestFormObjectMultipartRequestMarker.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.cs diff --git a/samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.cs b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.cs similarity index 100% rename from samples/client/echo_api/csharp-restsharp/src/Org.OpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.cs rename to samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.cs diff --git a/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..ccb09c252b62 --- /dev/null +++ b/samples/client/echo_api/csharp/restsharp/net8/EchoApi/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,35 @@ + + + + false + net8.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + annotations + false + + + + + + + + + + + + + + diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php index abbbbcf1bc00..32de9920511c 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/BodyApi.php @@ -633,7 +633,7 @@ function ($response) { * @return PromiseInterface */ public function testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo( - $body = null, + ?\Psr\Http\Message\StreamInterface $body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0] ): PromiseInterface { @@ -686,7 +686,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testBodyApplicationOctetstreamBinaryRequest( - $body = null, + ?\Psr\Http\Message\StreamInterface $body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0] ): Request { @@ -949,7 +949,7 @@ function ($response) { * @return PromiseInterface */ public function testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo( - $files, + array $files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0] ): PromiseInterface { @@ -1002,7 +1002,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testBodyMultipartFormdataArrayOfBinaryRequest( - $files, + array $files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0] ): Request { @@ -1278,7 +1278,7 @@ function ($response) { * @return PromiseInterface */ public function testBodyMultipartFormdataSingleBinaryAsyncWithHttpInfo( - $my_file = null, + ?\Psr\Http\Message\StreamInterface $my_file = null, string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0] ): PromiseInterface { @@ -1331,7 +1331,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testBodyMultipartFormdataSingleBinaryRequest( - $my_file = null, + ?\Psr\Http\Message\StreamInterface $my_file = null, string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0] ): Request { @@ -1601,7 +1601,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyAllOfPetAsyncWithHttpInfo( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0] ): PromiseInterface { @@ -1654,7 +1654,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyAllOfPetRequest( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0] ): Request { @@ -1745,7 +1745,7 @@ public function testEchoBodyAllOfPetRequest( * @return string */ public function testEchoBodyFreeFormObjectResponseString( - ?array $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): string { @@ -1766,7 +1766,7 @@ public function testEchoBodyFreeFormObjectResponseString( * @return array of string, HTTP status code, HTTP response headers (array of strings) */ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo( - ?array $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): array { @@ -1893,7 +1893,7 @@ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo( * @return PromiseInterface */ public function testEchoBodyFreeFormObjectResponseStringAsync( - ?array $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): PromiseInterface { @@ -1917,7 +1917,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo( - $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): PromiseInterface { @@ -1970,7 +1970,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyFreeFormObjectResponseStringRequest( - $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): Request { @@ -2233,7 +2233,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyPetAsyncWithHttpInfo( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0] ): PromiseInterface { @@ -2286,7 +2286,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyPetRequest( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0] ): Request { @@ -2549,7 +2549,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyPetResponseStringAsyncWithHttpInfo( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0] ): PromiseInterface { @@ -2602,7 +2602,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyPetResponseStringRequest( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0] ): Request { @@ -2865,7 +2865,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyStringEnumAsyncWithHttpInfo( - $body = null, + ?string $body = null, string $contentType = self::contentTypes['testEchoBodyStringEnum'][0] ): PromiseInterface { @@ -2918,7 +2918,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyStringEnumRequest( - $body = null, + ?string $body = null, string $contentType = self::contentTypes['testEchoBodyStringEnum'][0] ): Request { @@ -3181,7 +3181,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyTagResponseStringAsyncWithHttpInfo( - $tag = null, + ?\OpenAPI\Client\Model\Tag $tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0] ): PromiseInterface { @@ -3234,7 +3234,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyTagResponseStringRequest( - $tag = null, + ?\OpenAPI\Client\Model\Tag $tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0] ): Request { diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php index 241754b30b08..ddaa5c47ab6c 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/FormApi.php @@ -328,9 +328,9 @@ function ($response) { * @return PromiseInterface */ public function testFormIntegerBooleanStringAsyncWithHttpInfo( - $integer_form = null, - $boolean_form = null, - $string_form = null, + ?int $integer_form = null, + ?bool $boolean_form = null, + ?string $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0] ): PromiseInterface { @@ -385,9 +385,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testFormIntegerBooleanStringRequest( - $integer_form = null, - $boolean_form = null, - $string_form = null, + ?int $integer_form = null, + ?bool $boolean_form = null, + ?string $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0] ): Request { @@ -657,7 +657,7 @@ function ($response) { * @return PromiseInterface */ public function testFormObjectMultipartAsyncWithHttpInfo( - $marker, + \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker, string $contentType = self::contentTypes['testFormObjectMultipart'][0] ): PromiseInterface { @@ -710,7 +710,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testFormObjectMultipartRequest( - $marker, + \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker, string $contentType = self::contentTypes['testFormObjectMultipart'][0] ): Request { @@ -1011,12 +1011,12 @@ function ($response) { * @return PromiseInterface */ public function testFormOneofAsyncWithHttpInfo( - $form1 = null, - $form2 = null, - $form3 = null, - $form4 = null, - $id = null, - $name = null, + ?string $form1 = null, + ?int $form2 = null, + ?string $form3 = null, + ?bool $form4 = null, + ?int $id = null, + ?string $name = null, string $contentType = self::contentTypes['testFormOneof'][0] ): PromiseInterface { @@ -1074,12 +1074,12 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testFormOneofRequest( - $form1 = null, - $form2 = null, - $form3 = null, - $form4 = null, - $id = null, - $name = null, + ?string $form1 = null, + ?int $form2 = null, + ?string $form3 = null, + ?bool $form4 = null, + ?int $id = null, + ?string $name = null, string $contentType = self::contentTypes['testFormOneof'][0] ): Request { diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php index 871fd002020b..3337854a883e 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/HeaderApi.php @@ -336,11 +336,11 @@ function ($response) { * @return PromiseInterface */ public function testHeaderIntegerBooleanStringEnumsAsyncWithHttpInfo( - $integer_header = null, - $boolean_header = null, - $string_header = null, - $enum_nonref_string_header = null, - $enum_ref_string_header = null, + ?int $integer_header = null, + ?bool $boolean_header = null, + ?string $string_header = null, + ?string $enum_nonref_string_header = null, + ?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0] ): PromiseInterface { @@ -397,11 +397,11 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testHeaderIntegerBooleanStringEnumsRequest( - $integer_header = null, - $boolean_header = null, - $string_header = null, - $enum_nonref_string_header = null, - $enum_ref_string_header = null, + ?int $integer_header = null, + ?bool $boolean_header = null, + ?string $string_header = null, + ?string $enum_nonref_string_header = null, + ?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0] ): Request { diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php index e806d61c9453..c6a13a2a6f14 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/PathApi.php @@ -329,10 +329,10 @@ function ($response) { * @return PromiseInterface */ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathAsyncWithHttpInfo( - $path_string, - $path_integer, - $enum_nonref_string_path, - $enum_ref_string_path, + string $path_string, + int $path_integer, + string $enum_nonref_string_path, + \OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0] ): PromiseInterface { @@ -388,10 +388,10 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest( - $path_string, - $path_integer, - $enum_nonref_string_path, - $enum_ref_string_path, + string $path_string, + int $path_integer, + string $enum_nonref_string_path, + \OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0] ): Request { diff --git a/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php index 8e64ba5648ce..f0e76da188be 100644 --- a/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php +++ b/samples/client/echo_api/php-nextgen-streaming/src/Api/QueryApi.php @@ -342,8 +342,8 @@ function ($response) { * @return PromiseInterface */ public function testEnumRefStringAsyncWithHttpInfo( - $enum_nonref_string_query = null, - $enum_ref_string_query = null, + ?string $enum_nonref_string_query = null, + ?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0] ): PromiseInterface { @@ -397,8 +397,8 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEnumRefStringRequest( - $enum_nonref_string_query = null, - $enum_ref_string_query = null, + ?string $enum_nonref_string_query = null, + ?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0] ): Request { @@ -687,9 +687,9 @@ function ($response) { * @return PromiseInterface */ public function testQueryDatetimeDateStringAsyncWithHttpInfo( - $datetime_query = null, - $date_query = null, - $string_query = null, + ?\DateTime $datetime_query = null, + ?\DateTime $date_query = null, + ?string $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0] ): PromiseInterface { @@ -744,9 +744,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryDatetimeDateStringRequest( - $datetime_query = null, - $date_query = null, - $string_query = null, + ?\DateTime $datetime_query = null, + ?\DateTime $date_query = null, + ?string $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0] ): Request { @@ -1045,9 +1045,9 @@ function ($response) { * @return PromiseInterface */ public function testQueryIntegerBooleanStringAsyncWithHttpInfo( - $integer_query = null, - $boolean_query = null, - $string_query = null, + ?int $integer_query = null, + ?bool $boolean_query = null, + ?string $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0] ): PromiseInterface { @@ -1102,9 +1102,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryIntegerBooleanStringRequest( - $integer_query = null, - $boolean_query = null, - $string_query = null, + ?int $integer_query = null, + ?bool $boolean_query = null, + ?string $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0] ): Request { @@ -1389,7 +1389,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\Pet $query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0] ): PromiseInterface { @@ -1442,7 +1442,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleDeepObjectExplodeTrueObjectRequest( - $query_object = null, + ?\OpenAPI\Client\Model\Pet $query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0] ): Request { @@ -1707,7 +1707,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0] ): PromiseInterface { @@ -1760,7 +1760,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest( - $query_object = null, + ?\OpenAPI\Client\Model\TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0] ): Request { @@ -1853,7 +1853,7 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest( * @return string */ public function testQueryStyleFormExplodeFalseArrayInteger( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): string { @@ -1874,7 +1874,7 @@ public function testQueryStyleFormExplodeFalseArrayInteger( * @return array of string, HTTP status code, HTTP response headers (array of strings) */ public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): array { @@ -2001,7 +2001,7 @@ public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo( * @return PromiseInterface */ public function testQueryStyleFormExplodeFalseArrayIntegerAsync( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): PromiseInterface { @@ -2025,7 +2025,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeFalseArrayIntegerAsyncWithHttpInfo( - $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): PromiseInterface { @@ -2078,7 +2078,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeFalseArrayIntegerRequest( - $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): Request { @@ -2171,7 +2171,7 @@ public function testQueryStyleFormExplodeFalseArrayIntegerRequest( * @return string */ public function testQueryStyleFormExplodeFalseArrayString( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): string { @@ -2192,7 +2192,7 @@ public function testQueryStyleFormExplodeFalseArrayString( * @return array of string, HTTP status code, HTTP response headers (array of strings) */ public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): array { @@ -2319,7 +2319,7 @@ public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo( * @return PromiseInterface */ public function testQueryStyleFormExplodeFalseArrayStringAsync( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): PromiseInterface { @@ -2343,7 +2343,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeFalseArrayStringAsyncWithHttpInfo( - $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): PromiseInterface { @@ -2396,7 +2396,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeFalseArrayStringRequest( - $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): Request { @@ -2661,7 +2661,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0] ): PromiseInterface { @@ -2714,7 +2714,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeTrueArrayStringRequest( - $query_object = null, + ?\OpenAPI\Client\Model\TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0] ): Request { @@ -2979,7 +2979,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\Pet $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0] ): PromiseInterface { @@ -3032,7 +3032,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeTrueObjectRequest( - $query_object = null, + ?\OpenAPI\Client\Model\Pet $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0] ): Request { @@ -3297,7 +3297,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\DataQuery $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0] ): PromiseInterface { @@ -3350,7 +3350,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeTrueObjectAllOfRequest( - $query_object = null, + ?\OpenAPI\Client\Model\DataQuery $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0] ): Request { diff --git a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php index 1b49ec023e98..fec58cc88f2d 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/BodyApi.php @@ -633,7 +633,7 @@ function ($response) { * @return PromiseInterface */ public function testBodyApplicationOctetstreamBinaryAsyncWithHttpInfo( - $body = null, + ?\SplFileObject $body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0] ): PromiseInterface { @@ -686,7 +686,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testBodyApplicationOctetstreamBinaryRequest( - $body = null, + ?\SplFileObject $body = null, string $contentType = self::contentTypes['testBodyApplicationOctetstreamBinary'][0] ): Request { @@ -949,7 +949,7 @@ function ($response) { * @return PromiseInterface */ public function testBodyMultipartFormdataArrayOfBinaryAsyncWithHttpInfo( - $files, + array $files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0] ): PromiseInterface { @@ -1002,7 +1002,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testBodyMultipartFormdataArrayOfBinaryRequest( - $files, + array $files, string $contentType = self::contentTypes['testBodyMultipartFormdataArrayOfBinary'][0] ): Request { @@ -1278,7 +1278,7 @@ function ($response) { * @return PromiseInterface */ public function testBodyMultipartFormdataSingleBinaryAsyncWithHttpInfo( - $my_file = null, + ?\SplFileObject $my_file = null, string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0] ): PromiseInterface { @@ -1331,7 +1331,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testBodyMultipartFormdataSingleBinaryRequest( - $my_file = null, + ?\SplFileObject $my_file = null, string $contentType = self::contentTypes['testBodyMultipartFormdataSingleBinary'][0] ): Request { @@ -1601,7 +1601,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyAllOfPetAsyncWithHttpInfo( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0] ): PromiseInterface { @@ -1654,7 +1654,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyAllOfPetRequest( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyAllOfPet'][0] ): Request { @@ -1745,7 +1745,7 @@ public function testEchoBodyAllOfPetRequest( * @return string */ public function testEchoBodyFreeFormObjectResponseString( - ?array $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): string { @@ -1766,7 +1766,7 @@ public function testEchoBodyFreeFormObjectResponseString( * @return array of string, HTTP status code, HTTP response headers (array of strings) */ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo( - ?array $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): array { @@ -1893,7 +1893,7 @@ public function testEchoBodyFreeFormObjectResponseStringWithHttpInfo( * @return PromiseInterface */ public function testEchoBodyFreeFormObjectResponseStringAsync( - ?array $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): PromiseInterface { @@ -1917,7 +1917,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyFreeFormObjectResponseStringAsyncWithHttpInfo( - $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): PromiseInterface { @@ -1970,7 +1970,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyFreeFormObjectResponseStringRequest( - $body = null, + array $body = null, string $contentType = self::contentTypes['testEchoBodyFreeFormObjectResponseString'][0] ): Request { @@ -2233,7 +2233,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyPetAsyncWithHttpInfo( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0] ): PromiseInterface { @@ -2286,7 +2286,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyPetRequest( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyPet'][0] ): Request { @@ -2549,7 +2549,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyPetResponseStringAsyncWithHttpInfo( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0] ): PromiseInterface { @@ -2602,7 +2602,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyPetResponseStringRequest( - $pet = null, + ?\OpenAPI\Client\Model\Pet $pet = null, string $contentType = self::contentTypes['testEchoBodyPetResponseString'][0] ): Request { @@ -2865,7 +2865,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyStringEnumAsyncWithHttpInfo( - $body = null, + ?string $body = null, string $contentType = self::contentTypes['testEchoBodyStringEnum'][0] ): PromiseInterface { @@ -2918,7 +2918,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyStringEnumRequest( - $body = null, + ?string $body = null, string $contentType = self::contentTypes['testEchoBodyStringEnum'][0] ): Request { @@ -3181,7 +3181,7 @@ function ($response) { * @return PromiseInterface */ public function testEchoBodyTagResponseStringAsyncWithHttpInfo( - $tag = null, + ?\OpenAPI\Client\Model\Tag $tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0] ): PromiseInterface { @@ -3234,7 +3234,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEchoBodyTagResponseStringRequest( - $tag = null, + ?\OpenAPI\Client\Model\Tag $tag = null, string $contentType = self::contentTypes['testEchoBodyTagResponseString'][0] ): Request { diff --git a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php index 241754b30b08..ddaa5c47ab6c 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/FormApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/FormApi.php @@ -328,9 +328,9 @@ function ($response) { * @return PromiseInterface */ public function testFormIntegerBooleanStringAsyncWithHttpInfo( - $integer_form = null, - $boolean_form = null, - $string_form = null, + ?int $integer_form = null, + ?bool $boolean_form = null, + ?string $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0] ): PromiseInterface { @@ -385,9 +385,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testFormIntegerBooleanStringRequest( - $integer_form = null, - $boolean_form = null, - $string_form = null, + ?int $integer_form = null, + ?bool $boolean_form = null, + ?string $string_form = null, string $contentType = self::contentTypes['testFormIntegerBooleanString'][0] ): Request { @@ -657,7 +657,7 @@ function ($response) { * @return PromiseInterface */ public function testFormObjectMultipartAsyncWithHttpInfo( - $marker, + \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker, string $contentType = self::contentTypes['testFormObjectMultipart'][0] ): PromiseInterface { @@ -710,7 +710,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testFormObjectMultipartRequest( - $marker, + \OpenAPI\Client\Model\TestFormObjectMultipartRequestMarker $marker, string $contentType = self::contentTypes['testFormObjectMultipart'][0] ): Request { @@ -1011,12 +1011,12 @@ function ($response) { * @return PromiseInterface */ public function testFormOneofAsyncWithHttpInfo( - $form1 = null, - $form2 = null, - $form3 = null, - $form4 = null, - $id = null, - $name = null, + ?string $form1 = null, + ?int $form2 = null, + ?string $form3 = null, + ?bool $form4 = null, + ?int $id = null, + ?string $name = null, string $contentType = self::contentTypes['testFormOneof'][0] ): PromiseInterface { @@ -1074,12 +1074,12 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testFormOneofRequest( - $form1 = null, - $form2 = null, - $form3 = null, - $form4 = null, - $id = null, - $name = null, + ?string $form1 = null, + ?int $form2 = null, + ?string $form3 = null, + ?bool $form4 = null, + ?int $id = null, + ?string $name = null, string $contentType = self::contentTypes['testFormOneof'][0] ): Request { diff --git a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php index 871fd002020b..3337854a883e 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/HeaderApi.php @@ -336,11 +336,11 @@ function ($response) { * @return PromiseInterface */ public function testHeaderIntegerBooleanStringEnumsAsyncWithHttpInfo( - $integer_header = null, - $boolean_header = null, - $string_header = null, - $enum_nonref_string_header = null, - $enum_ref_string_header = null, + ?int $integer_header = null, + ?bool $boolean_header = null, + ?string $string_header = null, + ?string $enum_nonref_string_header = null, + ?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0] ): PromiseInterface { @@ -397,11 +397,11 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testHeaderIntegerBooleanStringEnumsRequest( - $integer_header = null, - $boolean_header = null, - $string_header = null, - $enum_nonref_string_header = null, - $enum_ref_string_header = null, + ?int $integer_header = null, + ?bool $boolean_header = null, + ?string $string_header = null, + ?string $enum_nonref_string_header = null, + ?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_header = null, string $contentType = self::contentTypes['testHeaderIntegerBooleanStringEnums'][0] ): Request { diff --git a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php index e806d61c9453..c6a13a2a6f14 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/PathApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/PathApi.php @@ -329,10 +329,10 @@ function ($response) { * @return PromiseInterface */ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathAsyncWithHttpInfo( - $path_string, - $path_integer, - $enum_nonref_string_path, - $enum_ref_string_path, + string $path_string, + int $path_integer, + string $enum_nonref_string_path, + \OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0] ): PromiseInterface { @@ -388,10 +388,10 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPathRequest( - $path_string, - $path_integer, - $enum_nonref_string_path, - $enum_ref_string_path, + string $path_string, + int $path_integer, + string $enum_nonref_string_path, + \OpenAPI\Client\Model\StringEnumRef $enum_ref_string_path, string $contentType = self::contentTypes['testsPathStringPathStringIntegerPathIntegerEnumNonrefStringPathEnumRefStringPath'][0] ): Request { diff --git a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php index 8e64ba5648ce..f0e76da188be 100644 --- a/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php +++ b/samples/client/echo_api/php-nextgen/src/Api/QueryApi.php @@ -342,8 +342,8 @@ function ($response) { * @return PromiseInterface */ public function testEnumRefStringAsyncWithHttpInfo( - $enum_nonref_string_query = null, - $enum_ref_string_query = null, + ?string $enum_nonref_string_query = null, + ?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0] ): PromiseInterface { @@ -397,8 +397,8 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEnumRefStringRequest( - $enum_nonref_string_query = null, - $enum_ref_string_query = null, + ?string $enum_nonref_string_query = null, + ?\OpenAPI\Client\Model\StringEnumRef $enum_ref_string_query = null, string $contentType = self::contentTypes['testEnumRefString'][0] ): Request { @@ -687,9 +687,9 @@ function ($response) { * @return PromiseInterface */ public function testQueryDatetimeDateStringAsyncWithHttpInfo( - $datetime_query = null, - $date_query = null, - $string_query = null, + ?\DateTime $datetime_query = null, + ?\DateTime $date_query = null, + ?string $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0] ): PromiseInterface { @@ -744,9 +744,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryDatetimeDateStringRequest( - $datetime_query = null, - $date_query = null, - $string_query = null, + ?\DateTime $datetime_query = null, + ?\DateTime $date_query = null, + ?string $string_query = null, string $contentType = self::contentTypes['testQueryDatetimeDateString'][0] ): Request { @@ -1045,9 +1045,9 @@ function ($response) { * @return PromiseInterface */ public function testQueryIntegerBooleanStringAsyncWithHttpInfo( - $integer_query = null, - $boolean_query = null, - $string_query = null, + ?int $integer_query = null, + ?bool $boolean_query = null, + ?string $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0] ): PromiseInterface { @@ -1102,9 +1102,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryIntegerBooleanStringRequest( - $integer_query = null, - $boolean_query = null, - $string_query = null, + ?int $integer_query = null, + ?bool $boolean_query = null, + ?string $string_query = null, string $contentType = self::contentTypes['testQueryIntegerBooleanString'][0] ): Request { @@ -1389,7 +1389,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleDeepObjectExplodeTrueObjectAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\Pet $query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0] ): PromiseInterface { @@ -1442,7 +1442,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleDeepObjectExplodeTrueObjectRequest( - $query_object = null, + ?\OpenAPI\Client\Model\Pet $query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObject'][0] ): Request { @@ -1707,7 +1707,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0] ): PromiseInterface { @@ -1760,7 +1760,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest( - $query_object = null, + ?\OpenAPI\Client\Model\TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter $query_object = null, string $contentType = self::contentTypes['testQueryStyleDeepObjectExplodeTrueObjectAllOf'][0] ): Request { @@ -1853,7 +1853,7 @@ public function testQueryStyleDeepObjectExplodeTrueObjectAllOfRequest( * @return string */ public function testQueryStyleFormExplodeFalseArrayInteger( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): string { @@ -1874,7 +1874,7 @@ public function testQueryStyleFormExplodeFalseArrayInteger( * @return array of string, HTTP status code, HTTP response headers (array of strings) */ public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): array { @@ -2001,7 +2001,7 @@ public function testQueryStyleFormExplodeFalseArrayIntegerWithHttpInfo( * @return PromiseInterface */ public function testQueryStyleFormExplodeFalseArrayIntegerAsync( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): PromiseInterface { @@ -2025,7 +2025,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeFalseArrayIntegerAsyncWithHttpInfo( - $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): PromiseInterface { @@ -2078,7 +2078,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeFalseArrayIntegerRequest( - $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayInteger'][0] ): Request { @@ -2171,7 +2171,7 @@ public function testQueryStyleFormExplodeFalseArrayIntegerRequest( * @return string */ public function testQueryStyleFormExplodeFalseArrayString( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): string { @@ -2192,7 +2192,7 @@ public function testQueryStyleFormExplodeFalseArrayString( * @return array of string, HTTP status code, HTTP response headers (array of strings) */ public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): array { @@ -2319,7 +2319,7 @@ public function testQueryStyleFormExplodeFalseArrayStringWithHttpInfo( * @return PromiseInterface */ public function testQueryStyleFormExplodeFalseArrayStringAsync( - ?array $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): PromiseInterface { @@ -2343,7 +2343,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeFalseArrayStringAsyncWithHttpInfo( - $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): PromiseInterface { @@ -2396,7 +2396,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeFalseArrayStringRequest( - $query_object = null, + array $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeFalseArrayString'][0] ): Request { @@ -2661,7 +2661,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeTrueArrayStringAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0] ): PromiseInterface { @@ -2714,7 +2714,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeTrueArrayStringRequest( - $query_object = null, + ?\OpenAPI\Client\Model\TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueArrayString'][0] ): Request { @@ -2979,7 +2979,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeTrueObjectAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\Pet $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0] ): PromiseInterface { @@ -3032,7 +3032,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeTrueObjectRequest( - $query_object = null, + ?\OpenAPI\Client\Model\Pet $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObject'][0] ): Request { @@ -3297,7 +3297,7 @@ function ($response) { * @return PromiseInterface */ public function testQueryStyleFormExplodeTrueObjectAllOfAsyncWithHttpInfo( - $query_object = null, + ?\OpenAPI\Client\Model\DataQuery $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0] ): PromiseInterface { @@ -3350,7 +3350,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryStyleFormExplodeTrueObjectAllOfRequest( - $query_object = null, + ?\OpenAPI\Client\Model\DataQuery $query_object = null, string $contentType = self::contentTypes['testQueryStyleFormExplodeTrueObjectAllOf'][0] ): Request { diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/exceptions.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/exceptions.py index bd5561d241ed..f38ce4018036 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/exceptions.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/exceptions.py @@ -151,6 +151,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -189,6 +196,16 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_auth_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_auth_api.py index bfd827933bd6..47756f746042 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_auth_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_auth_api.py @@ -15,14 +15,14 @@ import unittest -from openapi_client.api.auth_api import AuthApi # noqa: E501 +from openapi_client.api.auth_api import AuthApi class TestAuthApi(unittest.TestCase): """AuthApi unit test stubs""" def setUp(self) -> None: - self.api = AuthApi() # noqa: E501 + self.api = AuthApi() def tearDown(self) -> None: pass @@ -30,7 +30,14 @@ def tearDown(self) -> None: def test_test_auth_http_basic(self) -> None: """Test case for test_auth_http_basic - To test HTTP basic authentication # noqa: E501 + To test HTTP basic authentication + """ + pass + + def test_test_auth_http_bearer(self) -> None: + """Test case for test_auth_http_bearer + + To test HTTP bearer authentication """ pass diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_bird.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_bird.py index d95a104d7147..1a2289c0d472 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_bird.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_bird.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.bird import Bird # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.bird import Bird class TestBird(unittest.TestCase): """Bird unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Bird: """Test Bird - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Bird` """ - model = openapi_client.models.bird.Bird() # noqa: E501 - if include_optional : + model = Bird() + if include_optional: return Bird( - size = '', + size = '', color = '' ) - else : + else: return Bird( ) """ diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_body_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_body_api.py index e5e24ace8102..f9b7917ee006 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_body_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_body_api.py @@ -3,36 +3,97 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.body_api import BodyApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.body_api import BodyApi class TestBodyApi(unittest.TestCase): """BodyApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.body_api.BodyApi() # noqa: E501 + def setUp(self) -> None: + self.api = BodyApi() + + def tearDown(self) -> None: + pass + + def test_test_binary_gif(self) -> None: + """Test case for test_binary_gif + + Test binary (gif) response body + """ + pass + + def test_test_body_application_octetstream_binary(self) -> None: + """Test case for test_body_application_octetstream_binary + + Test body parameter(s) + """ + pass + + def test_test_body_multipart_formdata_array_of_binary(self) -> None: + """Test case for test_body_multipart_formdata_array_of_binary + + Test array of binary in multipart mime + """ + pass + + def test_test_body_multipart_formdata_single_binary(self) -> None: + """Test case for test_body_multipart_formdata_single_binary + + Test single binary in multipart mime + """ + pass + + def test_test_echo_body_all_of_pet(self) -> None: + """Test case for test_echo_body_all_of_pet + + Test body parameter(s) + """ + pass + + def test_test_echo_body_free_form_object_response_string(self) -> None: + """Test case for test_echo_body_free_form_object_response_string - def tearDown(self): + Test free form object + """ pass - def test_test_echo_body_pet(self): + def test_test_echo_body_pet(self) -> None: """Test case for test_echo_body_pet - Test body parameter(s) # noqa: E501 + Test body parameter(s) + """ + pass + + def test_test_echo_body_pet_response_string(self) -> None: + """Test case for test_echo_body_pet_response_string + + Test empty response body + """ + pass + + def test_test_echo_body_string_enum(self) -> None: + """Test case for test_echo_body_string_enum + + Test string enum response body + """ + pass + + def test_test_echo_body_tag_response_string(self) -> None: + """Test case for test_echo_body_tag_response_string + + Test empty json (request body) """ pass diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_category.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_category.py index b5771c572d33..12dfe19f63ac 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_category.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_category.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.category import Category # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.category import Category class TestCategory(unittest.TestCase): """Category unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Category: """Test Category - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Category` """ - model = openapi_client.models.category.Category() # noqa: E501 - if include_optional : + model = Category() + if include_optional: return Category( - id = 1, + id = 1, name = 'Dogs' ) - else : + else: return Category( ) """ diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_data_query.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_data_query.py index f33d8daabae1..fcd7c9566a37 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_data_query.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_data_query.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.data_query import DataQuery # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.data_query import DataQuery class TestDataQuery(unittest.TestCase): """DataQuery unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DataQuery: """Test DataQuery - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DataQuery` """ - model = openapi_client.models.data_query.DataQuery() # noqa: E501 - if include_optional : + model = DataQuery() + if include_optional: return DataQuery( - suffix = '', - text = 'Some text', + suffix = '', + text = 'Some text', var_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return DataQuery( ) """ diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_default_value.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_default_value.py index 6e5f35fd2eff..4bdc49448868 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_default_value.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_default_value.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.default_value import DefaultValue # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.default_value import DefaultValue class TestDefaultValue(unittest.TestCase): """DefaultValue unit test stubs""" @@ -29,34 +26,40 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DefaultValue: """Test DefaultValue - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DefaultValue` """ - model = openapi_client.models.default_value.DefaultValue() # noqa: E501 - if include_optional : + model = DefaultValue() + if include_optional: return DefaultValue( + array_string_enum_ref_default = [ + 'success' + ], array_string_enum_default = [ 'success' - ], + ], array_string_default = [ '' - ], + ], array_integer_default = [ 56 - ], + ], array_string = [ '' - ], + ], array_string_nullable = [ '' - ], + ], + array_string_extension_nullable = [ + '' + ], string_nullable = '' ) - else : + else: return DefaultValue( ) """ diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_form_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_form_api.py index 6422432c79ba..fbd7ed641e6a 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_form_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_form_api.py @@ -3,36 +3,48 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.form_api import FormApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.form_api import FormApi class TestFormApi(unittest.TestCase): """FormApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.form_api.FormApi() # noqa: E501 + def setUp(self) -> None: + self.api = FormApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_test_form_integer_boolean_string(self): + def test_test_form_integer_boolean_string(self) -> None: """Test case for test_form_integer_boolean_string - Test form parameter(s) # noqa: E501 + Test form parameter(s) + """ + pass + + def test_test_form_object_multipart(self) -> None: + """Test case for test_form_object_multipart + + Test form parameter(s) for multipart schema + """ + pass + + def test_test_form_oneof(self) -> None: + """Test case for test_form_oneof + + Test form parameter(s) for oneOf schema """ pass diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_header_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_header_api.py index c1b7ed44e8f8..68670ebc567f 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_header_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_header_api.py @@ -3,36 +3,34 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.header_api import HeaderApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.header_api import HeaderApi class TestHeaderApi(unittest.TestCase): """HeaderApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.header_api.HeaderApi() # noqa: E501 + def setUp(self) -> None: + self.api = HeaderApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_test_header_integer_boolean_string(self): - """Test case for test_header_integer_boolean_string + def test_test_header_integer_boolean_string_enums(self) -> None: + """Test case for test_header_integer_boolean_string_enums - Test header parameter(s) # noqa: E501 + Test header parameter(s) """ pass diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_number_properties_only.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_number_properties_only.py index 68aa757f9df9..682503a0cbf7 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_number_properties_only.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_number_properties_only.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import openapi_client -from openapi_client.models.number_properties_only import NumberPropertiesOnly # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.number_properties_only import NumberPropertiesOnly class TestNumberPropertiesOnly(unittest.TestCase): """NumberPropertiesOnly unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NumberPropertiesOnly: """Test NumberPropertiesOnly - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `NumberPropertiesOnly` """ - model = openapi_client.models.number_properties_only.NumberPropertiesOnly() # noqa: E501 - if include_optional : + model = NumberPropertiesOnly() + if include_optional: return NumberPropertiesOnly( - number = 1.337, - float = 1.337, - double = '' + number = 1.337, + var_float = 1.337, + double = 0.8 ) - else : + else: return NumberPropertiesOnly( ) """ diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_path_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_path_api.py index 4d8e71f7ce6a..faabe2102426 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_path_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_path_api.py @@ -3,36 +3,34 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.path_api import PathApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.path_api import PathApi class TestPathApi(unittest.TestCase): """PathApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.path_api.PathApi() # noqa: E501 + def setUp(self) -> None: + self.api = PathApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_tests_path_string_path_string_integer_path_integer(self): - """Test case for tests_path_string_path_string_integer_path_integer + def test_tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(self) -> None: + """Test case for tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path - Test path parameter(s) # noqa: E501 + Test path parameter(s) """ pass diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_pet.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_pet.py index e02d8615bc08..21965554b265 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_pet.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_pet.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.pet import Pet # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.pet import Pet class TestPet(unittest.TestCase): """Pet unit test stubs""" @@ -29,32 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Pet: """Test Pet - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Pet` """ - model = openapi_client.models.pet.Pet() # noqa: E501 - if include_optional : + model = Pet() + if include_optional: return Pet( - id = 10, - name = 'doggie', + id = 10, + name = 'doggie', category = openapi_client.models.category.Category( id = 1, - name = 'Dogs', ), + name = 'Dogs', ), photo_urls = [ '' - ], + ], tags = [ openapi_client.models.tag.Tag( id = 56, name = '', ) - ], + ], status = 'available' ) - else : + else: return Pet( name = 'doggie', photo_urls = [ diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_query.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_query.py index a7652e1ae59c..c3d033ef0b51 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_query.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_query.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.query import Query # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.query import Query class TestQuery(unittest.TestCase): """Query unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Query: """Test Query - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Query` """ - model = openapi_client.models.query.Query() # noqa: E501 - if include_optional : + model = Query() + if include_optional: return Query( - id = 56, + id = 56, outcomes = [ 'SUCCESS' ] ) - else : + else: return Query( ) """ diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_query_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_query_api.py index 829a635d99b9..e2e6c2dac461 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_query_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_query_api.py @@ -3,50 +3,97 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.query_api import QueryApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.query_api import QueryApi class TestQueryApi(unittest.TestCase): """QueryApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.query_api.QueryApi() # noqa: E501 + def setUp(self) -> None: + self.api = QueryApi() + + def tearDown(self) -> None: + pass + + def test_test_enum_ref_string(self) -> None: + """Test case for test_enum_ref_string - def tearDown(self): + Test query parameter(s) + """ pass - def test_test_query_integer_boolean_string(self): + def test_test_query_datetime_date_string(self) -> None: + """Test case for test_query_datetime_date_string + + Test query parameter(s) + """ + pass + + def test_test_query_integer_boolean_string(self) -> None: """Test case for test_query_integer_boolean_string - Test query parameter(s) # noqa: E501 + Test query parameter(s) + """ + pass + + def test_test_query_style_deep_object_explode_true_object(self) -> None: + """Test case for test_query_style_deep_object_explode_true_object + + Test query parameter(s) + """ + pass + + def test_test_query_style_deep_object_explode_true_object_all_of(self) -> None: + """Test case for test_query_style_deep_object_explode_true_object_all_of + + Test query parameter(s) + """ + pass + + def test_test_query_style_form_explode_false_array_integer(self) -> None: + """Test case for test_query_style_form_explode_false_array_integer + + Test query parameter(s) """ pass - def test_test_query_style_form_explode_true_array_string(self): + def test_test_query_style_form_explode_false_array_string(self) -> None: + """Test case for test_query_style_form_explode_false_array_string + + Test query parameter(s) + """ + pass + + def test_test_query_style_form_explode_true_array_string(self) -> None: """Test case for test_query_style_form_explode_true_array_string - Test query parameter(s) # noqa: E501 + Test query parameter(s) """ pass - def test_test_query_style_form_explode_true_object(self): + def test_test_query_style_form_explode_true_object(self) -> None: """Test case for test_query_style_form_explode_true_object - Test query parameter(s) # noqa: E501 + Test query parameter(s) + """ + pass + + def test_test_query_style_form_explode_true_object_all_of(self) -> None: + """Test case for test_query_style_form_explode_true_object_all_of + + Test query parameter(s) """ pass diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_string_enum_ref.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_string_enum_ref.py index 60a3f0781b18..ece5b369cc22 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_string_enum_ref.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_string_enum_ref.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.string_enum_ref import StringEnumRef # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.string_enum_ref import StringEnumRef class TestStringEnumRef(unittest.TestCase): """StringEnumRef unit test stubs""" diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_tag.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_tag.py index 8e48170ab6ae..7e235ac8b95b 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_tag.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_tag.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.tag import Tag # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.tag import Tag class TestTag(unittest.TestCase): """Tag unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Tag: """Test Tag - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Tag` """ - model = openapi_client.models.tag.Tag() # noqa: E501 - if include_optional : + model = Tag() + if include_optional: return Tag( - id = 56, + id = 56, name = '' ) - else : + else: return Tag( ) """ diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_form_object_multipart_request_marker.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_form_object_multipart_request_marker.py index d49974286060..97f5600a234d 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_form_object_multipart_request_marker.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_form_object_multipart_request_marker.py @@ -28,7 +28,7 @@ def tearDown(self): def make_instance(self, include_optional) -> TestFormObjectMultipartRequestMarker: """Test TestFormObjectMultipartRequestMarker - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestFormObjectMultipartRequestMarker` diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py index 395407345615..22731b578cc8 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter class TestTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(unittest.TestCase): """TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter: """Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` """ - model = openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # noqa: E501 - if include_optional : + model = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() + if include_optional: return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( - size = '', - color = '', - id = 1, + size = '', + color = '', + id = 1, name = 'Dogs' ) - else : + else: return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( ) """ diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_form_explode_true_array_integer_query_object_parameter.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_form_explode_true_array_integer_query_object_parameter.py deleted file mode 100644 index 2b35c46cb3f6..000000000000 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_form_explode_true_array_integer_query_object_parameter.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding: utf-8 - -""" - Echo Server API - - Echo Server API - - The version of the OpenAPI document: 0.1.0 - Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from openapi_client.models.test_query_style_form_explode_true_array_integer_query_object_parameter import TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter - -class TestTestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter(unittest.TestCase): - """TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter: - """Test TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter` - """ - model = TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter() - if include_optional: - return TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter( - values = [ - 56 - ] - ) - else: - return TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter( - ) - """ - - def testTestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter(self): - """Test TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py index 6366b5c23587..2656fbf8e027 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter class TestTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(unittest.TestCase): """TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter: """Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` """ - model = openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # noqa: E501 - if include_optional : + model = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() + if include_optional: return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( values = [ '' ] ) - else : + else: return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_auth_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_auth_api.py index bfd827933bd6..5c53a30e09c4 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_auth_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_auth_api.py @@ -22,10 +22,10 @@ class TestAuthApi(unittest.TestCase): """AuthApi unit test stubs""" def setUp(self) -> None: - self.api = AuthApi() # noqa: E501 + self.api = AuthApi() def tearDown(self) -> None: - pass + self.api.api_client.close() def test_test_auth_http_basic(self) -> None: """Test case for test_auth_http_basic @@ -34,6 +34,13 @@ def test_test_auth_http_basic(self) -> None: """ pass + def test_test_auth_http_bearer(self) -> None: + """Test case for test_auth_http_bearer + + To test HTTP bearer authentication # noqa: E501 + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_bird.py b/samples/client/echo_api/python-pydantic-v1/test/test_bird.py index d95a104d7147..0ce8736bd8a6 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_bird.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_bird.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.bird import Bird # noqa: E501 -from openapi_client.rest import ApiException class TestBird(unittest.TestCase): """Bird unit test stubs""" @@ -29,20 +27,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Bird: """Test Bird include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Bird` """ - model = openapi_client.models.bird.Bird() # noqa: E501 - if include_optional : + model = Bird() # noqa: E501 + if include_optional: return Bird( - size = '', + size = '', color = '' ) - else : + else: return Bird( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py index e5e24ace8102..6727be6c74ca 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_body_api.py @@ -3,39 +3,100 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client from openapi_client.api.body_api import BodyApi # noqa: E501 -from openapi_client.rest import ApiException class TestBodyApi(unittest.TestCase): """BodyApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.body_api.BodyApi() # noqa: E501 + def setUp(self) -> None: + self.api = BodyApi() + + def tearDown(self) -> None: + self.api.api_client.close() + + def test_test_binary_gif(self) -> None: + """Test case for test_binary_gif + + Test binary (gif) response body # noqa: E501 + """ + pass + + def test_test_body_application_octetstream_binary(self) -> None: + """Test case for test_body_application_octetstream_binary + + Test body parameter(s) # noqa: E501 + """ + pass + + def test_test_body_multipart_formdata_array_of_binary(self) -> None: + """Test case for test_body_multipart_formdata_array_of_binary + + Test array of binary in multipart mime # noqa: E501 + """ + pass + + def test_test_body_multipart_formdata_single_binary(self) -> None: + """Test case for test_body_multipart_formdata_single_binary - def tearDown(self): + Test single binary in multipart mime # noqa: E501 + """ pass - def test_test_echo_body_pet(self): + def test_test_echo_body_all_of_pet(self) -> None: + """Test case for test_echo_body_all_of_pet + + Test body parameter(s) # noqa: E501 + """ + pass + + def test_test_echo_body_free_form_object_response_string(self) -> None: + """Test case for test_echo_body_free_form_object_response_string + + Test free form object # noqa: E501 + """ + pass + + def test_test_echo_body_pet(self) -> None: """Test case for test_echo_body_pet Test body parameter(s) # noqa: E501 """ pass + def test_test_echo_body_pet_response_string(self) -> None: + """Test case for test_echo_body_pet_response_string + + Test empty response body # noqa: E501 + """ + pass + + def test_test_echo_body_string_enum(self) -> None: + """Test case for test_echo_body_string_enum + + Test string enum response body # noqa: E501 + """ + pass + + def test_test_echo_body_tag_response_string(self) -> None: + """Test case for test_echo_body_tag_response_string + + Test empty json (request body) # noqa: E501 + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_category.py b/samples/client/echo_api/python-pydantic-v1/test/test_category.py index b5771c572d33..487e50d95d5c 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_category.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_category.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.category import Category # noqa: E501 -from openapi_client.rest import ApiException class TestCategory(unittest.TestCase): """Category unit test stubs""" @@ -29,20 +27,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Category: """Test Category include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Category` """ - model = openapi_client.models.category.Category() # noqa: E501 - if include_optional : + model = Category() # noqa: E501 + if include_optional: return Category( - id = 1, + id = 1, name = 'Dogs' ) - else : + else: return Category( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py b/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py index f33d8daabae1..5ae6bdbf8778 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_data_query.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.data_query import DataQuery # noqa: E501 -from openapi_client.rest import ApiException class TestDataQuery(unittest.TestCase): """DataQuery unit test stubs""" @@ -29,21 +27,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DataQuery: """Test DataQuery include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DataQuery` """ - model = openapi_client.models.data_query.DataQuery() # noqa: E501 - if include_optional : + model = DataQuery() # noqa: E501 + if include_optional: return DataQuery( - suffix = '', - text = 'Some text', + suffix = '', + text = 'Some text', var_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return DataQuery( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py b/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py index 6e5f35fd2eff..a38f9d85c970 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_default_value.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.default_value import DefaultValue # noqa: E501 -from openapi_client.rest import ApiException class TestDefaultValue(unittest.TestCase): """DefaultValue unit test stubs""" @@ -29,34 +27,40 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DefaultValue: """Test DefaultValue include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DefaultValue` """ - model = openapi_client.models.default_value.DefaultValue() # noqa: E501 - if include_optional : + model = DefaultValue() # noqa: E501 + if include_optional: return DefaultValue( + array_string_enum_ref_default = [ + 'success' + ], array_string_enum_default = [ 'success' - ], + ], array_string_default = [ '' - ], + ], array_integer_default = [ 56 - ], + ], array_string = [ '' - ], + ], array_string_nullable = [ '' - ], + ], + array_string_extension_nullable = [ + '' + ], string_nullable = '' ) - else : + else: return DefaultValue( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py index 6422432c79ba..6c888452a47b 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_form_api.py @@ -3,39 +3,51 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client from openapi_client.api.form_api import FormApi # noqa: E501 -from openapi_client.rest import ApiException class TestFormApi(unittest.TestCase): """FormApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.form_api.FormApi() # noqa: E501 + def setUp(self) -> None: + self.api = FormApi() - def tearDown(self): - pass + def tearDown(self) -> None: + self.api.api_client.close() - def test_test_form_integer_boolean_string(self): + def test_test_form_integer_boolean_string(self) -> None: """Test case for test_form_integer_boolean_string Test form parameter(s) # noqa: E501 """ pass + def test_test_form_object_multipart(self) -> None: + """Test case for test_form_object_multipart + + Test form parameter(s) for multipart schema # noqa: E501 + """ + pass + + def test_test_form_oneof(self) -> None: + """Test case for test_form_oneof + + Test form parameter(s) for oneOf schema # noqa: E501 + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py index c1b7ed44e8f8..d9bcf17bfa1e 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_header_api.py @@ -3,34 +3,32 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client from openapi_client.api.header_api import HeaderApi # noqa: E501 -from openapi_client.rest import ApiException class TestHeaderApi(unittest.TestCase): """HeaderApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.header_api.HeaderApi() # noqa: E501 + def setUp(self) -> None: + self.api = HeaderApi() - def tearDown(self): - pass + def tearDown(self) -> None: + self.api.api_client.close() - def test_test_header_integer_boolean_string(self): - """Test case for test_header_integer_boolean_string + def test_test_header_integer_boolean_string_enums(self) -> None: + """Test case for test_header_integer_boolean_string_enums Test header parameter(s) # noqa: E501 """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py b/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py index 68aa757f9df9..e5072e660a20 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_number_properties_only.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import openapi_client from openapi_client.models.number_properties_only import NumberPropertiesOnly # noqa: E501 -from openapi_client.rest import ApiException class TestNumberPropertiesOnly(unittest.TestCase): """NumberPropertiesOnly unit test stubs""" @@ -29,21 +27,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NumberPropertiesOnly: """Test NumberPropertiesOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `NumberPropertiesOnly` """ - model = openapi_client.models.number_properties_only.NumberPropertiesOnly() # noqa: E501 - if include_optional : + model = NumberPropertiesOnly() # noqa: E501 + if include_optional: return NumberPropertiesOnly( - number = 1.337, - float = 1.337, - double = '' + number = 1.337, + float = 1.337, + double = 0.8 ) - else : + else: return NumberPropertiesOnly( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py index 4d8e71f7ce6a..2b0bfc82ebfa 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_path_api.py @@ -3,34 +3,32 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client from openapi_client.api.path_api import PathApi # noqa: E501 -from openapi_client.rest import ApiException class TestPathApi(unittest.TestCase): """PathApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.path_api.PathApi() # noqa: E501 + def setUp(self) -> None: + self.api = PathApi() - def tearDown(self): - pass + def tearDown(self) -> None: + self.api.api_client.close() - def test_tests_path_string_path_string_integer_path_integer(self): - """Test case for tests_path_string_path_string_integer_path_integer + def test_tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(self) -> None: + """Test case for tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path Test path parameter(s) # noqa: E501 """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_pet.py b/samples/client/echo_api/python-pydantic-v1/test/test_pet.py index e02d8615bc08..17f0d1221411 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_pet.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_pet.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.pet import Pet # noqa: E501 -from openapi_client.rest import ApiException class TestPet(unittest.TestCase): """Pet unit test stubs""" @@ -29,32 +27,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Pet: """Test Pet include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Pet` """ - model = openapi_client.models.pet.Pet() # noqa: E501 - if include_optional : + model = Pet() # noqa: E501 + if include_optional: return Pet( - id = 10, - name = 'doggie', + id = 10, + name = 'doggie', category = openapi_client.models.category.Category( id = 1, - name = 'Dogs', ), + name = 'Dogs', ), photo_urls = [ '' - ], + ], tags = [ openapi_client.models.tag.Tag( id = 56, name = '', ) - ], + ], status = 'available' ) - else : + else: return Pet( name = 'doggie', photo_urls = [ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_query.py b/samples/client/echo_api/python-pydantic-v1/test/test_query.py index a7652e1ae59c..bc3dfd5afd1f 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_query.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_query.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.query import Query # noqa: E501 -from openapi_client.rest import ApiException class TestQuery(unittest.TestCase): """Query unit test stubs""" @@ -29,22 +27,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Query: """Test Query include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Query` """ - model = openapi_client.models.query.Query() # noqa: E501 - if include_optional : + model = Query() # noqa: E501 + if include_optional: return Query( - id = 56, + id = 56, outcomes = [ 'SUCCESS' ] ) - else : + else: return Query( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py b/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py index 829a635d99b9..bf9837100754 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_query_api.py @@ -3,53 +3,100 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client from openapi_client.api.query_api import QueryApi # noqa: E501 -from openapi_client.rest import ApiException class TestQueryApi(unittest.TestCase): """QueryApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.query_api.QueryApi() # noqa: E501 + def setUp(self) -> None: + self.api = QueryApi() + + def tearDown(self) -> None: + self.api.api_client.close() + + def test_test_enum_ref_string(self) -> None: + """Test case for test_enum_ref_string + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_datetime_date_string(self) -> None: + """Test case for test_query_datetime_date_string - def tearDown(self): + Test query parameter(s) # noqa: E501 + """ pass - def test_test_query_integer_boolean_string(self): + def test_test_query_integer_boolean_string(self) -> None: """Test case for test_query_integer_boolean_string Test query parameter(s) # noqa: E501 """ pass - def test_test_query_style_form_explode_true_array_string(self): + def test_test_query_style_deep_object_explode_true_object(self) -> None: + """Test case for test_query_style_deep_object_explode_true_object + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_style_deep_object_explode_true_object_all_of(self) -> None: + """Test case for test_query_style_deep_object_explode_true_object_all_of + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_style_form_explode_false_array_integer(self) -> None: + """Test case for test_query_style_form_explode_false_array_integer + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_style_form_explode_false_array_string(self) -> None: + """Test case for test_query_style_form_explode_false_array_string + + Test query parameter(s) # noqa: E501 + """ + pass + + def test_test_query_style_form_explode_true_array_string(self) -> None: """Test case for test_query_style_form_explode_true_array_string Test query parameter(s) # noqa: E501 """ pass - def test_test_query_style_form_explode_true_object(self): + def test_test_query_style_form_explode_true_object(self) -> None: """Test case for test_query_style_form_explode_true_object Test query parameter(s) # noqa: E501 """ pass + def test_test_query_style_form_explode_true_object_all_of(self) -> None: + """Test case for test_query_style_form_explode_true_object_all_of + + Test query parameter(s) # noqa: E501 + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py b/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py index 60a3f0781b18..f48d7776fccf 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_string_enum_ref.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.string_enum_ref import StringEnumRef # noqa: E501 -from openapi_client.rest import ApiException class TestStringEnumRef(unittest.TestCase): """StringEnumRef unit test stubs""" diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_tag.py b/samples/client/echo_api/python-pydantic-v1/test/test_tag.py index 8e48170ab6ae..ce6f8f0cdbc5 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_tag.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_tag.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.tag import Tag # noqa: E501 -from openapi_client.rest import ApiException class TestTag(unittest.TestCase): """Tag unit test stubs""" @@ -29,20 +27,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Tag: """Test Tag include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Tag` """ - model = openapi_client.models.tag.Tag() # noqa: E501 - if include_optional : + model = Tag() # noqa: E501 + if include_optional: return Tag( - id = 56, + id = 56, name = '' ) - else : + else: return Tag( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py index 395407345615..8063f5b7b630 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter # noqa: E501 -from openapi_client.rest import ApiException class TestTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(unittest.TestCase): """TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter unit test stubs""" @@ -29,22 +27,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter: """Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` """ - model = openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # noqa: E501 - if include_optional : + model = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # noqa: E501 + if include_optional: return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( - size = '', - color = '', - id = 1, + size = '', + color = '', + id = 1, name = 'Dogs' ) - else : + else: return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( ) """ diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_integer_query_object_parameter.py b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_integer_query_object_parameter.py deleted file mode 100644 index 3fc17ba947e5..000000000000 --- a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_integer_query_object_parameter.py +++ /dev/null @@ -1,55 +0,0 @@ -# coding: utf-8 - -""" - Echo Server API - - Echo Server API - - The version of the OpenAPI document: 0.1.0 - Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest -import datetime - -from openapi_client.models.test_query_style_form_explode_true_array_integer_query_object_parameter import TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter # noqa: E501 - -class TestTestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter(unittest.TestCase): - """TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter: - """Test TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter` - """ - model = TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter() # noqa: E501 - if include_optional: - return TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter( - values = [ - 56 - ] - ) - else: - return TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter( - ) - """ - - def testTestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter(self): - """Test TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py index 6366b5c23587..f0ce75f334f5 100644 --- a/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py +++ b/samples/client/echo_api/python-pydantic-v1/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -3,22 +3,20 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import openapi_client from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter # noqa: E501 -from openapi_client.rest import ApiException class TestTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(unittest.TestCase): """TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter unit test stubs""" @@ -29,21 +27,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter: """Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` """ - model = openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # noqa: E501 - if include_optional : + model = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # noqa: E501 + if include_optional: return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( values = [ '' ] ) - else : + else: return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( ) """ diff --git a/samples/client/echo_api/python/openapi_client/exceptions.py b/samples/client/echo_api/python/openapi_client/exceptions.py index bd5561d241ed..f38ce4018036 100644 --- a/samples/client/echo_api/python/openapi_client/exceptions.py +++ b/samples/client/echo_api/python/openapi_client/exceptions.py @@ -151,6 +151,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -189,6 +196,16 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/samples/client/echo_api/python/test/test_auth_api.py b/samples/client/echo_api/python/test/test_auth_api.py index bfd827933bd6..47756f746042 100644 --- a/samples/client/echo_api/python/test/test_auth_api.py +++ b/samples/client/echo_api/python/test/test_auth_api.py @@ -15,14 +15,14 @@ import unittest -from openapi_client.api.auth_api import AuthApi # noqa: E501 +from openapi_client.api.auth_api import AuthApi class TestAuthApi(unittest.TestCase): """AuthApi unit test stubs""" def setUp(self) -> None: - self.api = AuthApi() # noqa: E501 + self.api = AuthApi() def tearDown(self) -> None: pass @@ -30,7 +30,14 @@ def tearDown(self) -> None: def test_test_auth_http_basic(self) -> None: """Test case for test_auth_http_basic - To test HTTP basic authentication # noqa: E501 + To test HTTP basic authentication + """ + pass + + def test_test_auth_http_bearer(self) -> None: + """Test case for test_auth_http_bearer + + To test HTTP bearer authentication """ pass diff --git a/samples/client/echo_api/python/test/test_bird.py b/samples/client/echo_api/python/test/test_bird.py index d95a104d7147..1a2289c0d472 100644 --- a/samples/client/echo_api/python/test/test_bird.py +++ b/samples/client/echo_api/python/test/test_bird.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.bird import Bird # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.bird import Bird class TestBird(unittest.TestCase): """Bird unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Bird: """Test Bird - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Bird` """ - model = openapi_client.models.bird.Bird() # noqa: E501 - if include_optional : + model = Bird() + if include_optional: return Bird( - size = '', + size = '', color = '' ) - else : + else: return Bird( ) """ diff --git a/samples/client/echo_api/python/test/test_body_api.py b/samples/client/echo_api/python/test/test_body_api.py index e5e24ace8102..f9b7917ee006 100644 --- a/samples/client/echo_api/python/test/test_body_api.py +++ b/samples/client/echo_api/python/test/test_body_api.py @@ -3,36 +3,97 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.body_api import BodyApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.body_api import BodyApi class TestBodyApi(unittest.TestCase): """BodyApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.body_api.BodyApi() # noqa: E501 + def setUp(self) -> None: + self.api = BodyApi() + + def tearDown(self) -> None: + pass + + def test_test_binary_gif(self) -> None: + """Test case for test_binary_gif + + Test binary (gif) response body + """ + pass + + def test_test_body_application_octetstream_binary(self) -> None: + """Test case for test_body_application_octetstream_binary + + Test body parameter(s) + """ + pass + + def test_test_body_multipart_formdata_array_of_binary(self) -> None: + """Test case for test_body_multipart_formdata_array_of_binary + + Test array of binary in multipart mime + """ + pass + + def test_test_body_multipart_formdata_single_binary(self) -> None: + """Test case for test_body_multipart_formdata_single_binary + + Test single binary in multipart mime + """ + pass + + def test_test_echo_body_all_of_pet(self) -> None: + """Test case for test_echo_body_all_of_pet + + Test body parameter(s) + """ + pass + + def test_test_echo_body_free_form_object_response_string(self) -> None: + """Test case for test_echo_body_free_form_object_response_string - def tearDown(self): + Test free form object + """ pass - def test_test_echo_body_pet(self): + def test_test_echo_body_pet(self) -> None: """Test case for test_echo_body_pet - Test body parameter(s) # noqa: E501 + Test body parameter(s) + """ + pass + + def test_test_echo_body_pet_response_string(self) -> None: + """Test case for test_echo_body_pet_response_string + + Test empty response body + """ + pass + + def test_test_echo_body_string_enum(self) -> None: + """Test case for test_echo_body_string_enum + + Test string enum response body + """ + pass + + def test_test_echo_body_tag_response_string(self) -> None: + """Test case for test_echo_body_tag_response_string + + Test empty json (request body) """ pass diff --git a/samples/client/echo_api/python/test/test_category.py b/samples/client/echo_api/python/test/test_category.py index b5771c572d33..12dfe19f63ac 100644 --- a/samples/client/echo_api/python/test/test_category.py +++ b/samples/client/echo_api/python/test/test_category.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.category import Category # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.category import Category class TestCategory(unittest.TestCase): """Category unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Category: """Test Category - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Category` """ - model = openapi_client.models.category.Category() # noqa: E501 - if include_optional : + model = Category() + if include_optional: return Category( - id = 1, + id = 1, name = 'Dogs' ) - else : + else: return Category( ) """ diff --git a/samples/client/echo_api/python/test/test_data_query.py b/samples/client/echo_api/python/test/test_data_query.py index f33d8daabae1..fcd7c9566a37 100644 --- a/samples/client/echo_api/python/test/test_data_query.py +++ b/samples/client/echo_api/python/test/test_data_query.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.data_query import DataQuery # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.data_query import DataQuery class TestDataQuery(unittest.TestCase): """DataQuery unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DataQuery: """Test DataQuery - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DataQuery` """ - model = openapi_client.models.data_query.DataQuery() # noqa: E501 - if include_optional : + model = DataQuery() + if include_optional: return DataQuery( - suffix = '', - text = 'Some text', + suffix = '', + text = 'Some text', var_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f') ) - else : + else: return DataQuery( ) """ diff --git a/samples/client/echo_api/python/test/test_default_value.py b/samples/client/echo_api/python/test/test_default_value.py index 6e5f35fd2eff..4bdc49448868 100644 --- a/samples/client/echo_api/python/test/test_default_value.py +++ b/samples/client/echo_api/python/test/test_default_value.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.default_value import DefaultValue # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.default_value import DefaultValue class TestDefaultValue(unittest.TestCase): """DefaultValue unit test stubs""" @@ -29,34 +26,40 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DefaultValue: """Test DefaultValue - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DefaultValue` """ - model = openapi_client.models.default_value.DefaultValue() # noqa: E501 - if include_optional : + model = DefaultValue() + if include_optional: return DefaultValue( + array_string_enum_ref_default = [ + 'success' + ], array_string_enum_default = [ 'success' - ], + ], array_string_default = [ '' - ], + ], array_integer_default = [ 56 - ], + ], array_string = [ '' - ], + ], array_string_nullable = [ '' - ], + ], + array_string_extension_nullable = [ + '' + ], string_nullable = '' ) - else : + else: return DefaultValue( ) """ diff --git a/samples/client/echo_api/python/test/test_form_api.py b/samples/client/echo_api/python/test/test_form_api.py index 6422432c79ba..fbd7ed641e6a 100644 --- a/samples/client/echo_api/python/test/test_form_api.py +++ b/samples/client/echo_api/python/test/test_form_api.py @@ -3,36 +3,48 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.form_api import FormApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.form_api import FormApi class TestFormApi(unittest.TestCase): """FormApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.form_api.FormApi() # noqa: E501 + def setUp(self) -> None: + self.api = FormApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_test_form_integer_boolean_string(self): + def test_test_form_integer_boolean_string(self) -> None: """Test case for test_form_integer_boolean_string - Test form parameter(s) # noqa: E501 + Test form parameter(s) + """ + pass + + def test_test_form_object_multipart(self) -> None: + """Test case for test_form_object_multipart + + Test form parameter(s) for multipart schema + """ + pass + + def test_test_form_oneof(self) -> None: + """Test case for test_form_oneof + + Test form parameter(s) for oneOf schema """ pass diff --git a/samples/client/echo_api/python/test/test_header_api.py b/samples/client/echo_api/python/test/test_header_api.py index c1b7ed44e8f8..68670ebc567f 100644 --- a/samples/client/echo_api/python/test/test_header_api.py +++ b/samples/client/echo_api/python/test/test_header_api.py @@ -3,36 +3,34 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.header_api import HeaderApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.header_api import HeaderApi class TestHeaderApi(unittest.TestCase): """HeaderApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.header_api.HeaderApi() # noqa: E501 + def setUp(self) -> None: + self.api = HeaderApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_test_header_integer_boolean_string(self): - """Test case for test_header_integer_boolean_string + def test_test_header_integer_boolean_string_enums(self) -> None: + """Test case for test_header_integer_boolean_string_enums - Test header parameter(s) # noqa: E501 + Test header parameter(s) """ pass diff --git a/samples/client/echo_api/python/test/test_number_properties_only.py b/samples/client/echo_api/python/test/test_number_properties_only.py index 68aa757f9df9..682503a0cbf7 100644 --- a/samples/client/echo_api/python/test/test_number_properties_only.py +++ b/samples/client/echo_api/python/test/test_number_properties_only.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import openapi_client -from openapi_client.models.number_properties_only import NumberPropertiesOnly # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.number_properties_only import NumberPropertiesOnly class TestNumberPropertiesOnly(unittest.TestCase): """NumberPropertiesOnly unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NumberPropertiesOnly: """Test NumberPropertiesOnly - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `NumberPropertiesOnly` """ - model = openapi_client.models.number_properties_only.NumberPropertiesOnly() # noqa: E501 - if include_optional : + model = NumberPropertiesOnly() + if include_optional: return NumberPropertiesOnly( - number = 1.337, - float = 1.337, - double = '' + number = 1.337, + var_float = 1.337, + double = 0.8 ) - else : + else: return NumberPropertiesOnly( ) """ diff --git a/samples/client/echo_api/python/test/test_path_api.py b/samples/client/echo_api/python/test/test_path_api.py index 4d8e71f7ce6a..faabe2102426 100644 --- a/samples/client/echo_api/python/test/test_path_api.py +++ b/samples/client/echo_api/python/test/test_path_api.py @@ -3,36 +3,34 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.path_api import PathApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.path_api import PathApi class TestPathApi(unittest.TestCase): """PathApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.path_api.PathApi() # noqa: E501 + def setUp(self) -> None: + self.api = PathApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_tests_path_string_path_string_integer_path_integer(self): - """Test case for tests_path_string_path_string_integer_path_integer + def test_tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path(self) -> None: + """Test case for tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_enum_ref_string_path - Test path parameter(s) # noqa: E501 + Test path parameter(s) """ pass diff --git a/samples/client/echo_api/python/test/test_pet.py b/samples/client/echo_api/python/test/test_pet.py index e02d8615bc08..21965554b265 100644 --- a/samples/client/echo_api/python/test/test_pet.py +++ b/samples/client/echo_api/python/test/test_pet.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.pet import Pet # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.pet import Pet class TestPet(unittest.TestCase): """Pet unit test stubs""" @@ -29,32 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Pet: """Test Pet - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Pet` """ - model = openapi_client.models.pet.Pet() # noqa: E501 - if include_optional : + model = Pet() + if include_optional: return Pet( - id = 10, - name = 'doggie', + id = 10, + name = 'doggie', category = openapi_client.models.category.Category( id = 1, - name = 'Dogs', ), + name = 'Dogs', ), photo_urls = [ '' - ], + ], tags = [ openapi_client.models.tag.Tag( id = 56, name = '', ) - ], + ], status = 'available' ) - else : + else: return Pet( name = 'doggie', photo_urls = [ diff --git a/samples/client/echo_api/python/test/test_query.py b/samples/client/echo_api/python/test/test_query.py index a7652e1ae59c..c3d033ef0b51 100644 --- a/samples/client/echo_api/python/test/test_query.py +++ b/samples/client/echo_api/python/test/test_query.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.query import Query # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.query import Query class TestQuery(unittest.TestCase): """Query unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Query: """Test Query - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Query` """ - model = openapi_client.models.query.Query() # noqa: E501 - if include_optional : + model = Query() + if include_optional: return Query( - id = 56, + id = 56, outcomes = [ 'SUCCESS' ] ) - else : + else: return Query( ) """ diff --git a/samples/client/echo_api/python/test/test_query_api.py b/samples/client/echo_api/python/test/test_query_api.py index 829a635d99b9..e2e6c2dac461 100644 --- a/samples/client/echo_api/python/test/test_query_api.py +++ b/samples/client/echo_api/python/test/test_query_api.py @@ -3,50 +3,97 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import openapi_client -from openapi_client.api.query_api import QueryApi # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.api.query_api import QueryApi class TestQueryApi(unittest.TestCase): """QueryApi unit test stubs""" - def setUp(self): - self.api = openapi_client.api.query_api.QueryApi() # noqa: E501 + def setUp(self) -> None: + self.api = QueryApi() + + def tearDown(self) -> None: + pass + + def test_test_enum_ref_string(self) -> None: + """Test case for test_enum_ref_string - def tearDown(self): + Test query parameter(s) + """ pass - def test_test_query_integer_boolean_string(self): + def test_test_query_datetime_date_string(self) -> None: + """Test case for test_query_datetime_date_string + + Test query parameter(s) + """ + pass + + def test_test_query_integer_boolean_string(self) -> None: """Test case for test_query_integer_boolean_string - Test query parameter(s) # noqa: E501 + Test query parameter(s) + """ + pass + + def test_test_query_style_deep_object_explode_true_object(self) -> None: + """Test case for test_query_style_deep_object_explode_true_object + + Test query parameter(s) + """ + pass + + def test_test_query_style_deep_object_explode_true_object_all_of(self) -> None: + """Test case for test_query_style_deep_object_explode_true_object_all_of + + Test query parameter(s) + """ + pass + + def test_test_query_style_form_explode_false_array_integer(self) -> None: + """Test case for test_query_style_form_explode_false_array_integer + + Test query parameter(s) """ pass - def test_test_query_style_form_explode_true_array_string(self): + def test_test_query_style_form_explode_false_array_string(self) -> None: + """Test case for test_query_style_form_explode_false_array_string + + Test query parameter(s) + """ + pass + + def test_test_query_style_form_explode_true_array_string(self) -> None: """Test case for test_query_style_form_explode_true_array_string - Test query parameter(s) # noqa: E501 + Test query parameter(s) """ pass - def test_test_query_style_form_explode_true_object(self): + def test_test_query_style_form_explode_true_object(self) -> None: """Test case for test_query_style_form_explode_true_object - Test query parameter(s) # noqa: E501 + Test query parameter(s) + """ + pass + + def test_test_query_style_form_explode_true_object_all_of(self) -> None: + """Test case for test_query_style_form_explode_true_object_all_of + + Test query parameter(s) """ pass diff --git a/samples/client/echo_api/python/test/test_string_enum_ref.py b/samples/client/echo_api/python/test/test_string_enum_ref.py index 60a3f0781b18..ece5b369cc22 100644 --- a/samples/client/echo_api/python/test/test_string_enum_ref.py +++ b/samples/client/echo_api/python/test/test_string_enum_ref.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.string_enum_ref import StringEnumRef # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.string_enum_ref import StringEnumRef class TestStringEnumRef(unittest.TestCase): """StringEnumRef unit test stubs""" diff --git a/samples/client/echo_api/python/test/test_tag.py b/samples/client/echo_api/python/test/test_tag.py index 8e48170ab6ae..7e235ac8b95b 100644 --- a/samples/client/echo_api/python/test/test_tag.py +++ b/samples/client/echo_api/python/test/test_tag.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.tag import Tag # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.tag import Tag class TestTag(unittest.TestCase): """Tag unit test stubs""" @@ -29,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Tag: """Test Tag - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Tag` """ - model = openapi_client.models.tag.Tag() # noqa: E501 - if include_optional : + model = Tag() + if include_optional: return Tag( - id = 56, + id = 56, name = '' ) - else : + else: return Tag( ) """ diff --git a/samples/client/echo_api/python/test/test_test_form_object_multipart_request_marker.py b/samples/client/echo_api/python/test/test_test_form_object_multipart_request_marker.py index d49974286060..97f5600a234d 100644 --- a/samples/client/echo_api/python/test/test_test_form_object_multipart_request_marker.py +++ b/samples/client/echo_api/python/test/test_test_form_object_multipart_request_marker.py @@ -28,7 +28,7 @@ def tearDown(self): def make_instance(self, include_optional) -> TestFormObjectMultipartRequestMarker: """Test TestFormObjectMultipartRequestMarker - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestFormObjectMultipartRequestMarker` diff --git a/samples/client/echo_api/python/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py index 395407345615..22731b578cc8 100644 --- a/samples/client/echo_api/python/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py +++ b/samples/client/echo_api/python/test/test_test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter import TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter class TestTestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(unittest.TestCase): """TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter unit test stubs""" @@ -29,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter: """Test TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter` """ - model = openapi_client.models.test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() # noqa: E501 - if include_optional : + model = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter() + if include_optional: return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( - size = '', - color = '', - id = 1, + size = '', + color = '', + id = 1, name = 'Dogs' ) - else : + else: return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter( ) """ diff --git a/samples/client/echo_api/python/test/test_test_query_style_form_explode_true_array_integer_query_object_parameter.py b/samples/client/echo_api/python/test/test_test_query_style_form_explode_true_array_integer_query_object_parameter.py deleted file mode 100644 index 2b35c46cb3f6..000000000000 --- a/samples/client/echo_api/python/test/test_test_query_style_form_explode_true_array_integer_query_object_parameter.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding: utf-8 - -""" - Echo Server API - - Echo Server API - - The version of the OpenAPI document: 0.1.0 - Contact: team@openapitools.org - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from openapi_client.models.test_query_style_form_explode_true_array_integer_query_object_parameter import TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter - -class TestTestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter(unittest.TestCase): - """TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional) -> TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter: - """Test TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # uncomment below to create an instance of `TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter` - """ - model = TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter() - if include_optional: - return TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter( - values = [ - 56 - ] - ) - else: - return TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter( - ) - """ - - def testTestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter(self): - """Test TestQueryStyleFormExplodeTrueArrayIntegerQueryObjectParameter""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/client/echo_api/python/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py index 6366b5c23587..2656fbf8e027 100644 --- a/samples/client/echo_api/python/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py +++ b/samples/client/echo_api/python/test/test_test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -3,22 +3,19 @@ """ Echo Server API - Echo Server API # noqa: E501 + Echo Server API The version of the OpenAPI document: 0.1.0 Contact: team@openapitools.org - Generated by: https://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import openapi_client -from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter # noqa: E501 -from openapi_client.rest import ApiException +from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter class TestTestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(unittest.TestCase): """TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter unit test stubs""" @@ -29,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter: """Test TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter` """ - model = openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter.TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() # noqa: E501 - if include_optional : + model = TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter() + if include_optional: return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( values = [ '' ] ) - else : + else: return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter( ) """ diff --git a/samples/client/echo_api/r/R/api_client.R b/samples/client/echo_api/r/R/api_client.R index 2f7bcc7a1710..ab9094f67dab 100644 --- a/samples/client/echo_api/r/R/api_client.R +++ b/samples/client/echo_api/r/R/api_client.R @@ -72,7 +72,7 @@ ApiClient <- R6::R6Class( #' @param bearer_token Bearer token. #' @param timeout Timeout. #' @param retry_status_codes Status codes for retry. - #' @param max_retry_attempts Maxmium number of retry. + #' @param max_retry_attempts Maximum number of retry. #' @export initialize = function(base_path = NULL, user_agent = NULL, default_headers = NULL, diff --git a/samples/client/others/c/bearerAuth/CMakeLists.txt b/samples/client/others/c/bearerAuth/CMakeLists.txt index 2bfcf58899c0..e359d41c7789 100644 --- a/samples/client/others/c/bearerAuth/CMakeLists.txt +++ b/samples/client/others/c/bearerAuth/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_policy(SET CMP0063 NEW) set(CMAKE_C_VISIBILITY_PRESET default) set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(CMAKE_C_FLAGS "-Werror=implicit-function-declaration -Werror=missing-declarations -Werror=int-conversion") option(BUILD_SHARED_LIBS "Build using shared libraries" ON) @@ -14,7 +15,7 @@ find_package(OpenSSL) if (OPENSSL_FOUND) message (STATUS "OPENSSL found") - set(CMAKE_C_FLAGS "-DOPENSSL") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL") if(CMAKE_VERSION VERSION_LESS 3.4) include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIRS}) diff --git a/samples/client/others/c/bearerAuth/api/DefaultAPI.c b/samples/client/others/c/bearerAuth/api/DefaultAPI.c index 03c4476fdf86..41f6047cb62f 100644 --- a/samples/client/others/c/bearerAuth/api/DefaultAPI.c +++ b/samples/client/others/c/bearerAuth/api/DefaultAPI.c @@ -5,11 +5,6 @@ #define MAX_NUMBER_LENGTH 16 #define MAX_BUFFER_LENGTH 4096 -#define intToStr(dst, src) \ - do {\ - char dst[256];\ - snprintf(dst, 256, "%ld", (long int)(src));\ -}while(0) // Returns private information. diff --git a/samples/client/others/c/bearerAuth/src/apiClient.c b/samples/client/others/c/bearerAuth/src/apiClient.c index 6614016d27ae..b9f52e2e1b7f 100644 --- a/samples/client/others/c/bearerAuth/src/apiClient.c +++ b/samples/client/others/c/bearerAuth/src/apiClient.c @@ -89,7 +89,7 @@ void sslConfig_free(sslConfig_t *sslConfig) { free(sslConfig); } -void replaceSpaceWithPlus(char *stringToProcess) { +static void replaceSpaceWithPlus(char *stringToProcess) { for(int i = 0; i < strlen(stringToProcess); i++) { if(stringToProcess[i] == ' ') { stringToProcess[i] = '+'; @@ -97,9 +97,9 @@ void replaceSpaceWithPlus(char *stringToProcess) { } } -char *assembleTargetUrl(const char *basePath, - const char *operationParameter, - list_t *queryParameters) { +static char *assembleTargetUrl(const char *basePath, + const char *operationParameter, + list_t *queryParameters) { int neededBufferSizeForQueryParameters = 0; listEntry_t *listEntry; @@ -150,7 +150,7 @@ char *assembleTargetUrl(const char *basePath, return targetUrl; } -char *assembleHeaderField(char *key, char *value) { +static char *assembleHeaderField(char *key, char *value) { char *header = malloc(strlen(key) + strlen(value) + 3); strcpy(header, key), @@ -160,13 +160,13 @@ char *assembleHeaderField(char *key, char *value) { return header; } -void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { +static void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)bodyParametersLength); } -int lengthOfKeyPair(keyValuePair_t *keyPair) { +static int lengthOfKeyPair(keyValuePair_t *keyPair) { long length = 0; if((keyPair->key != NULL) && (keyPair->value != NULL) ) diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs index d5af0aa89c0b..955220dfbae6 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Api/MultipartApi.cs @@ -343,6 +343,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -497,6 +498,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -511,12 +513,12 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter if (marker != null) { - localVarRequestOptions.FormParameters.Add("marker", Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter + localVarRequestOptions.FormParameters.Add("marker", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(marker) : Org.OpenAPITools.Client.ClientUtils.Serialize(marker)); // form parameter } localVarRequestOptions.FileParameters.Add("file", file); if (statusArray != null) { - localVarRequestOptions.FormParameters.Add("statusArray", Org.OpenAPITools.Client.ClientUtils.Serialize(statusArray)); // form parameter + localVarRequestOptions.FormParameters.Add("statusArray", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(statusArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(statusArray)); // form parameter } localVarRequestOptions.Operation = "MultipartApi.MultipartMixed"; @@ -657,6 +659,7 @@ public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs index 91b7422b713e..c8d1224a3477 100644 --- a/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/others/csharp-complex-files/src/Org.OpenAPITools/Client/ApiClient.cs @@ -384,6 +384,14 @@ private RestRequest NewRequest( } } + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + return request; } diff --git a/samples/client/others/typescript/builds/array-of-lists/package.json b/samples/client/others/typescript/builds/array-of-lists/package.json index ea853317fbd4..000e9c5844c4 100644 --- a/samples/client/others/typescript/builds/array-of-lists/package.json +++ b/samples/client/others/typescript/builds/array-of-lists/package.json @@ -32,11 +32,9 @@ }, "dependencies": { "whatwg-fetch": "^3.0.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/client/others/typescript/builds/enum-single-value/package.json b/samples/client/others/typescript/builds/enum-single-value/package.json index ea853317fbd4..000e9c5844c4 100644 --- a/samples/client/others/typescript/builds/enum-single-value/package.json +++ b/samples/client/others/typescript/builds/enum-single-value/package.json @@ -32,11 +32,9 @@ }, "dependencies": { "whatwg-fetch": "^3.0.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/client/others/typescript/builds/null-types-simple/package.json b/samples/client/others/typescript/builds/null-types-simple/package.json index ea853317fbd4..000e9c5844c4 100644 --- a/samples/client/others/typescript/builds/null-types-simple/package.json +++ b/samples/client/others/typescript/builds/null-types-simple/package.json @@ -32,11 +32,9 @@ }, "dependencies": { "whatwg-fetch": "^3.0.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } 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 ea853317fbd4..000e9c5844c4 100644 --- a/samples/client/others/typescript/builds/with-unique-items/package.json +++ b/samples/client/others/typescript/builds/with-unique-items/package.json @@ -32,11 +32,9 @@ }, "dependencies": { "whatwg-fetch": "^3.0.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/client/others/typescript/encode-decode/build/package.json b/samples/client/others/typescript/encode-decode/build/package.json index 98e27af43f34..f7db8ae6bd7a 100644 --- a/samples/client/others/typescript/encode-decode/build/package.json +++ b/samples/client/others/typescript/encode-decode/build/package.json @@ -35,11 +35,9 @@ "@types/node-fetch": "^2.5.7", "@types/node": "*", "form-data": "^2.5.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/client/petstore/R-httr2-wrapper/R/api_client.R b/samples/client/petstore/R-httr2-wrapper/R/api_client.R index 9c5bba767310..f89465e25bbc 100644 --- a/samples/client/petstore/R-httr2-wrapper/R/api_client.R +++ b/samples/client/petstore/R-httr2-wrapper/R/api_client.R @@ -32,7 +32,7 @@ #' @field oauth_secret OAuth secret #' @field oauth_refresh_token OAuth refresh token #' @field oauth_flow_type OAuth flow type -#' @field oauth_authorization_url Authoriziation URL +#' @field oauth_authorization_url Authorization URL #' @field oauth_token_url Token URL #' @field oauth_pkce Boolean flag to enable PKCE #' @field oauth_scopes OAuth scopes @@ -68,7 +68,7 @@ ApiClient <- R6::R6Class( # OAuth2 # Flow type oauth_flow_type = "implicit", - # Authoriziation URL + # Authorization URL oauth_authorization_url = "http://petstore.swagger.io/api/oauth/dialog", # Token URL oauth_token_url = "", @@ -99,7 +99,7 @@ ApiClient <- R6::R6Class( #' @param bearer_token Bearer token. #' @param timeout Timeout. #' @param retry_status_codes Status codes for retry. - #' @param max_retry_attempts Maxmium number of retry. + #' @param max_retry_attempts Maximum number of retry. #' @export initialize = function(base_path = NULL, user_agent = NULL, default_headers = NULL, @@ -296,7 +296,7 @@ ApiClient <- R6::R6Class( req <- req %>% req_oauth_auth_code(client, scope = req_oauth_scopes, pkce = self$oauth_pkce, - auth_url = self$oauth_authoriziation_url) + auth_url = self$oauth_authorization_url) } # stream data diff --git a/samples/client/petstore/R-httr2/R/api_client.R b/samples/client/petstore/R-httr2/R/api_client.R index 9c5bba767310..f89465e25bbc 100644 --- a/samples/client/petstore/R-httr2/R/api_client.R +++ b/samples/client/petstore/R-httr2/R/api_client.R @@ -32,7 +32,7 @@ #' @field oauth_secret OAuth secret #' @field oauth_refresh_token OAuth refresh token #' @field oauth_flow_type OAuth flow type -#' @field oauth_authorization_url Authoriziation URL +#' @field oauth_authorization_url Authorization URL #' @field oauth_token_url Token URL #' @field oauth_pkce Boolean flag to enable PKCE #' @field oauth_scopes OAuth scopes @@ -68,7 +68,7 @@ ApiClient <- R6::R6Class( # OAuth2 # Flow type oauth_flow_type = "implicit", - # Authoriziation URL + # Authorization URL oauth_authorization_url = "http://petstore.swagger.io/api/oauth/dialog", # Token URL oauth_token_url = "", @@ -99,7 +99,7 @@ ApiClient <- R6::R6Class( #' @param bearer_token Bearer token. #' @param timeout Timeout. #' @param retry_status_codes Status codes for retry. - #' @param max_retry_attempts Maxmium number of retry. + #' @param max_retry_attempts Maximum number of retry. #' @export initialize = function(base_path = NULL, user_agent = NULL, default_headers = NULL, @@ -296,7 +296,7 @@ ApiClient <- R6::R6Class( req <- req %>% req_oauth_auth_code(client, scope = req_oauth_scopes, pkce = self$oauth_pkce, - auth_url = self$oauth_authoriziation_url) + auth_url = self$oauth_authorization_url) } # stream data diff --git a/samples/client/petstore/R/R/api_client.R b/samples/client/petstore/R/R/api_client.R index 638216216e37..c9e67c317410 100644 --- a/samples/client/petstore/R/R/api_client.R +++ b/samples/client/petstore/R/R/api_client.R @@ -32,7 +32,7 @@ #' @field oauth_secret OAuth secret #' @field oauth_refresh_token OAuth refresh token #' @field oauth_flow_type OAuth flow type -#' @field oauth_authorization_url Authoriziation URL +#' @field oauth_authorization_url Authorization URL #' @field oauth_token_url Token URL #' @field oauth_pkce Boolean flag to enable PKCE #' @field bearer_token Bearer token @@ -68,7 +68,7 @@ ApiClient <- R6::R6Class( # OAuth2 # Flow type oauth_flow_type = "implicit", - # Authoriziation URL + # Authorization URL oauth_authorization_url = "http://petstore.swagger.io/api/oauth/dialog", # Token URL oauth_token_url = "", @@ -97,7 +97,7 @@ ApiClient <- R6::R6Class( #' @param bearer_token Bearer token. #' @param timeout Timeout. #' @param retry_status_codes Status codes for retry. - #' @param max_retry_attempts Maxmium number of retry. + #' @param max_retry_attempts Maximum number of retry. #' @export initialize = function(base_path = NULL, user_agent = NULL, default_headers = NULL, diff --git a/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt b/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt index c97fd637cdb9..cd72ab391660 100644 --- a/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt +++ b/samples/client/petstore/c-useJsonUnformatted/CMakeLists.txt @@ -6,6 +6,7 @@ cmake_policy(SET CMP0063 NEW) set(CMAKE_C_VISIBILITY_PRESET default) set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(CMAKE_C_FLAGS "-Werror=implicit-function-declaration -Werror=missing-declarations -Werror=int-conversion") option(BUILD_SHARED_LIBS "Build using shared libraries" ON) @@ -14,7 +15,7 @@ find_package(OpenSSL) if (OPENSSL_FOUND) message (STATUS "OPENSSL found") - set(CMAKE_C_FLAGS "-DOPENSSL") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL") if(CMAKE_VERSION VERSION_LESS 3.4) include_directories(${OPENSSL_INCLUDE_DIR}) include_directories(${OPENSSL_INCLUDE_DIRS}) diff --git a/samples/client/petstore/c-useJsonUnformatted/README.md b/samples/client/petstore/c-useJsonUnformatted/README.md index 239e0f4c8ff4..a7cf2d3100af 100644 --- a/samples/client/petstore/c-useJsonUnformatted/README.md +++ b/samples/client/petstore/c-useJsonUnformatted/README.md @@ -84,6 +84,7 @@ Category | Method | HTTP request | Description *StoreAPI* | [**StoreAPI_placeOrder**](docs/StoreAPI.md#StoreAPI_placeOrder) | **POST** /store/order | Place an order for a pet *StoreAPI* | [**StoreAPI_sendFeedback**](docs/StoreAPI.md#StoreAPI_sendFeedback) | **POST** /store/feedback | Send us a feedback message *StoreAPI* | [**StoreAPI_sendRating**](docs/StoreAPI.md#StoreAPI_sendRating) | **POST** /store/rating/{rating} | How would you rate our service? +*StoreAPI* | [**StoreAPI_sendRecommend**](docs/StoreAPI.md#StoreAPI_sendRecommend) | **POST** /store/recommend | Would you recommend our service to a friend? *UserAPI* | [**UserAPI_createUser**](docs/UserAPI.md#UserAPI_createUser) | **POST** /user | Create user *UserAPI* | [**UserAPI_createUsersWithArrayInput**](docs/UserAPI.md#UserAPI_createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array *UserAPI* | [**UserAPI_createUsersWithListInput**](docs/UserAPI.md#UserAPI_createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array diff --git a/samples/client/petstore/c-useJsonUnformatted/api/PetAPI.c b/samples/client/petstore/c-useJsonUnformatted/api/PetAPI.c index 9380afee89c9..c0ac1aa49d3b 100644 --- a/samples/client/petstore/c-useJsonUnformatted/api/PetAPI.c +++ b/samples/client/petstore/c-useJsonUnformatted/api/PetAPI.c @@ -5,11 +5,6 @@ #define MAX_NUMBER_LENGTH 16 #define MAX_BUFFER_LENGTH 4096 -#define intToStr(dst, src) \ - do {\ - char dst[256];\ - snprintf(dst, 256, "%ld", (long int)(src));\ -}while(0) // Functions for enum STATUS for PetAPI_findPetsByStatus @@ -159,7 +154,7 @@ PetAPI_deletePet(apiClient_t *apiClient, long petId, char *api_key) snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); @@ -501,7 +496,7 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId) snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); @@ -658,7 +653,7 @@ PetAPI_isPetAvailable(apiClient_t *apiClient, long petId) snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); @@ -965,7 +960,7 @@ PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId, char *name, char *s snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); @@ -1078,7 +1073,7 @@ PetAPI_uploadFile(apiClient_t *apiClient, long petId, char *additionalMetadata, snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); diff --git a/samples/client/petstore/c-useJsonUnformatted/api/StoreAPI.c b/samples/client/petstore/c-useJsonUnformatted/api/StoreAPI.c index 11b7d9b4224a..2e13582de3bd 100644 --- a/samples/client/petstore/c-useJsonUnformatted/api/StoreAPI.c +++ b/samples/client/petstore/c-useJsonUnformatted/api/StoreAPI.c @@ -5,11 +5,6 @@ #define MAX_NUMBER_LENGTH 16 #define MAX_BUFFER_LENGTH 4096 -#define intToStr(dst, src) \ - do {\ - char dst[256];\ - snprintf(dst, 256, "%ld", (long int)(src));\ -}while(0) // Functions for enum RATING for StoreAPI_sendRating @@ -245,7 +240,7 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId) snprintf(localVarToReplace_orderId, sizeOfPathParams_orderId, "{%s}", "orderId"); char localVarBuff_orderId[256]; - intToStr(localVarBuff_orderId, orderId); + snprintf(localVarBuff_orderId, sizeof localVarBuff_orderId, "%ld", orderId); localVarPath = strReplace(localVarPath, localVarToReplace_orderId, localVarBuff_orderId); @@ -541,3 +536,85 @@ StoreAPI_sendRating(apiClient_t *apiClient, openapi_petstore_sendRating_rating_e } +// Would you recommend our service to a friend? +// +char* +StoreAPI_sendRecommend(apiClient_t *apiClient, int *recommend) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = list_createList(); + list_t *localVarHeaderType = list_createList(); + list_t *localVarContentType = list_createList(); + char *localVarBodyParameters = NULL; + size_t localVarBodyLength = 0; + + // clear the error code from the previous api call + apiClient->response_code = 0; + + // create the path + long sizeOfPath = strlen("/store/recommend")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/store/recommend"); + + + + + + // form parameters + char *keyForm_recommend = NULL; + char * valueForm_recommend = 0; + keyValuePair_t *keyPairForm_recommend = 0; + if (recommend != NULL) + { + keyForm_recommend = strdup("recommend"); + valueForm_recommend = calloc(1,MAX_NUMBER_LENGTH); + snprintf(valueForm_recommend, MAX_NUMBER_LENGTH, "%d", *recommend); + keyPairForm_recommend = keyValuePair_create(keyForm_recommend,valueForm_recommend); + list_addElement(localVarFormParameters,keyPairForm_recommend); + } + list_addElement(localVarHeaderType,"*/*"); //produces + list_addElement(localVarContentType,"multipart/form-data"); //consumes + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + localVarBodyLength, + "POST"); + + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} + //primitive return type simple string + char* elementToReturn = NULL; + if(apiClient->response_code >= 200 && apiClient->response_code < 300) + elementToReturn = strdup((char*)apiClient->dataReceived); + + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + apiClient->dataReceived = NULL; + apiClient->dataReceivedLen = 0; + } + + + list_freeList(localVarFormParameters); + list_freeList(localVarHeaderType); + list_freeList(localVarContentType); + free(localVarPath); + if (keyForm_recommend) { + free(keyForm_recommend); + keyForm_recommend = NULL; + } + free(keyPairForm_recommend); + return elementToReturn; +end: + free(localVarPath); + return NULL; + +} + diff --git a/samples/client/petstore/c-useJsonUnformatted/api/StoreAPI.h b/samples/client/petstore/c-useJsonUnformatted/api/StoreAPI.h index 1608e2b27d66..693d21b7dd64 100644 --- a/samples/client/petstore/c-useJsonUnformatted/api/StoreAPI.h +++ b/samples/client/petstore/c-useJsonUnformatted/api/StoreAPI.h @@ -53,3 +53,9 @@ char* StoreAPI_sendRating(apiClient_t *apiClient, openapi_petstore_sendRating_rating_e rating); +// Would you recommend our service to a friend? +// +char* +StoreAPI_sendRecommend(apiClient_t *apiClient, int *recommend); + + diff --git a/samples/client/petstore/c-useJsonUnformatted/api/UserAPI.c b/samples/client/petstore/c-useJsonUnformatted/api/UserAPI.c index d629b614342a..d5af0312d650 100644 --- a/samples/client/petstore/c-useJsonUnformatted/api/UserAPI.c +++ b/samples/client/petstore/c-useJsonUnformatted/api/UserAPI.c @@ -5,11 +5,6 @@ #define MAX_NUMBER_LENGTH 16 #define MAX_BUFFER_LENGTH 4096 -#define intToStr(dst, src) \ - do {\ - char dst[256];\ - snprintf(dst, 256, "%ld", (long int)(src));\ -}while(0) // Create user diff --git a/samples/client/petstore/c-useJsonUnformatted/docs/StoreAPI.md b/samples/client/petstore/c-useJsonUnformatted/docs/StoreAPI.md index 11fab3fe58ad..8705a994803a 100644 --- a/samples/client/petstore/c-useJsonUnformatted/docs/StoreAPI.md +++ b/samples/client/petstore/c-useJsonUnformatted/docs/StoreAPI.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**StoreAPI_placeOrder**](StoreAPI.md#StoreAPI_placeOrder) | **POST** /store/order | Place an order for a pet [**StoreAPI_sendFeedback**](StoreAPI.md#StoreAPI_sendFeedback) | **POST** /store/feedback | Send us a feedback message [**StoreAPI_sendRating**](StoreAPI.md#StoreAPI_sendRating) | **POST** /store/rating/{rating} | How would you rate our service? +[**StoreAPI_sendRecommend**](StoreAPI.md#StoreAPI_sendRecommend) | **POST** /store/recommend | Would you recommend our service to a friend? # **StoreAPI_deleteOrder** @@ -195,3 +196,33 @@ No authorization required [[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) +# **StoreAPI_sendRecommend** +```c +// Would you recommend our service to a friend? +// +char* StoreAPI_sendRecommend(apiClient_t *apiClient, int *recommend); +``` + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**apiClient** | **apiClient_t \*** | context containing the client configuration | +**recommend** | **int \*** | Would you recommend us or not? | [optional] + +### Return type + +char* + + + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **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) + diff --git a/samples/client/petstore/c-useJsonUnformatted/model/api_response.c b/samples/client/petstore/c-useJsonUnformatted/model/api_response.c index ccae1f010102..d0169c84f5b2 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/api_response.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/api_response.c @@ -5,7 +5,7 @@ -api_response_t *api_response_create( +static api_response_t *api_response_create_internal( int code, char *type, char *message @@ -18,14 +18,30 @@ api_response_t *api_response_create( api_response_local_var->type = type; api_response_local_var->message = message; + api_response_local_var->_library_owned = 1; return api_response_local_var; } +__attribute__((deprecated)) api_response_t *api_response_create( + int code, + char *type, + char *message + ) { + return api_response_create_internal ( + code, + type, + message + ); +} void api_response_free(api_response_t *api_response) { if(NULL == api_response){ return ; } + if(api_response->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "api_response_free"); + return ; + } listEntry_t *listEntry; if (api_response->type) { free(api_response->type); @@ -113,7 +129,7 @@ api_response_t *api_response_parseFromJSON(cJSON *api_responseJSON){ } - api_response_local_var = api_response_create ( + api_response_local_var = api_response_create_internal ( code ? code->valuedouble : 0, type && !cJSON_IsNull(type) ? strdup(type->valuestring) : NULL, message && !cJSON_IsNull(message) ? strdup(message->valuestring) : NULL diff --git a/samples/client/petstore/c-useJsonUnformatted/model/api_response.h b/samples/client/petstore/c-useJsonUnformatted/model/api_response.h index d64dcbacedd9..3d9eb71ff5d5 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/api_response.h +++ b/samples/client/petstore/c-useJsonUnformatted/model/api_response.h @@ -23,9 +23,10 @@ typedef struct api_response_t { char *type; // string char *message; // string + int _library_owned; // Is the library responsible for freeing this object? } api_response_t; -api_response_t *api_response_create( +__attribute__((deprecated)) api_response_t *api_response_create( int code, char *type, char *message diff --git a/samples/client/petstore/c-useJsonUnformatted/model/category.c b/samples/client/petstore/c-useJsonUnformatted/model/category.c index a1ea1a5d5cee..2b060a568015 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/category.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/category.c @@ -5,7 +5,7 @@ -category_t *category_create( +static category_t *category_create_internal( long id, char *name ) { @@ -16,14 +16,28 @@ category_t *category_create( category_local_var->id = id; category_local_var->name = name; + category_local_var->_library_owned = 1; return category_local_var; } +__attribute__((deprecated)) category_t *category_create( + long id, + char *name + ) { + return category_create_internal ( + id, + name + ); +} void category_free(category_t *category) { if(NULL == category){ return ; } + if(category->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "category_free"); + return ; + } listEntry_t *listEntry; if (category->name) { free(category->name); @@ -87,7 +101,7 @@ category_t *category_parseFromJSON(cJSON *categoryJSON){ } - category_local_var = category_create ( + category_local_var = category_create_internal ( id ? id->valuedouble : 0, name && !cJSON_IsNull(name) ? strdup(name->valuestring) : NULL ); diff --git a/samples/client/petstore/c-useJsonUnformatted/model/category.h b/samples/client/petstore/c-useJsonUnformatted/model/category.h index ec9efd6ccf60..bd27e27e35a3 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/category.h +++ b/samples/client/petstore/c-useJsonUnformatted/model/category.h @@ -22,9 +22,10 @@ typedef struct category_t { long id; //numeric char *name; // string + int _library_owned; // Is the library responsible for freeing this object? } category_t; -category_t *category_create( +__attribute__((deprecated)) category_t *category_create( long id, char *name ); diff --git a/samples/client/petstore/c-useJsonUnformatted/model/mapped_model.c b/samples/client/petstore/c-useJsonUnformatted/model/mapped_model.c index 7423e32eb338..3ab1e861c326 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/mapped_model.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/mapped_model.c @@ -5,7 +5,7 @@ -MappedModel_t *MappedModel_create( +static MappedModel_t *MappedModel_create_internal( int another_property, char *uuid_property ) { @@ -16,14 +16,28 @@ MappedModel_t *MappedModel_create( MappedModel_local_var->another_property = another_property; MappedModel_local_var->uuid_property = uuid_property; + MappedModel_local_var->_library_owned = 1; return MappedModel_local_var; } +__attribute__((deprecated)) MappedModel_t *MappedModel_create( + int another_property, + char *uuid_property + ) { + return MappedModel_create_internal ( + another_property, + uuid_property + ); +} void MappedModel_free(MappedModel_t *MappedModel) { if(NULL == MappedModel){ return ; } + if(MappedModel->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "MappedModel_free"); + return ; + } listEntry_t *listEntry; if (MappedModel->uuid_property) { free(MappedModel->uuid_property); @@ -87,7 +101,7 @@ MappedModel_t *MappedModel_parseFromJSON(cJSON *MappedModelJSON){ } - MappedModel_local_var = MappedModel_create ( + MappedModel_local_var = MappedModel_create_internal ( another_property ? another_property->valuedouble : 0, uuid_property && !cJSON_IsNull(uuid_property) ? strdup(uuid_property->valuestring) : NULL ); diff --git a/samples/client/petstore/c-useJsonUnformatted/model/mapped_model.h b/samples/client/petstore/c-useJsonUnformatted/model/mapped_model.h index 83b1d4581ba6..b962632d647d 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/mapped_model.h +++ b/samples/client/petstore/c-useJsonUnformatted/model/mapped_model.h @@ -22,9 +22,10 @@ typedef struct MappedModel_t { int another_property; //numeric char *uuid_property; // string + int _library_owned; // Is the library responsible for freeing this object? } MappedModel_t; -MappedModel_t *MappedModel_create( +__attribute__((deprecated)) MappedModel_t *MappedModel_create( int another_property, char *uuid_property ); diff --git a/samples/client/petstore/c-useJsonUnformatted/model/model_with_set_propertes.c b/samples/client/petstore/c-useJsonUnformatted/model/model_with_set_propertes.c index d29660fccfcd..0791d68f48a5 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/model_with_set_propertes.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/model_with_set_propertes.c @@ -5,7 +5,7 @@ -model_with_set_propertes_t *model_with_set_propertes_create( +static model_with_set_propertes_t *model_with_set_propertes_create_internal( list_t *tag_set, list_t *string_set ) { @@ -16,14 +16,28 @@ model_with_set_propertes_t *model_with_set_propertes_create( model_with_set_propertes_local_var->tag_set = tag_set; model_with_set_propertes_local_var->string_set = string_set; + model_with_set_propertes_local_var->_library_owned = 1; return model_with_set_propertes_local_var; } +__attribute__((deprecated)) model_with_set_propertes_t *model_with_set_propertes_create( + list_t *tag_set, + list_t *string_set + ) { + return model_with_set_propertes_create_internal ( + tag_set, + string_set + ); +} void model_with_set_propertes_free(model_with_set_propertes_t *model_with_set_propertes) { if(NULL == model_with_set_propertes){ return ; } + if(model_with_set_propertes->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "model_with_set_propertes_free"); + return ; + } listEntry_t *listEntry; if (model_with_set_propertes->tag_set) { list_ForEach(listEntry, model_with_set_propertes->tag_set) { @@ -146,7 +160,7 @@ model_with_set_propertes_t *model_with_set_propertes_parseFromJSON(cJSON *model_ } - model_with_set_propertes_local_var = model_with_set_propertes_create ( + model_with_set_propertes_local_var = model_with_set_propertes_create_internal ( tag_set ? tag_setList : NULL, string_set ? string_setList : NULL ); diff --git a/samples/client/petstore/c-useJsonUnformatted/model/model_with_set_propertes.h b/samples/client/petstore/c-useJsonUnformatted/model/model_with_set_propertes.h index 537271638b99..aa82893b94bb 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/model_with_set_propertes.h +++ b/samples/client/petstore/c-useJsonUnformatted/model/model_with_set_propertes.h @@ -23,9 +23,10 @@ typedef struct model_with_set_propertes_t { list_t *tag_set; //nonprimitive container list_t *string_set; //primitive container + int _library_owned; // Is the library responsible for freeing this object? } model_with_set_propertes_t; -model_with_set_propertes_t *model_with_set_propertes_create( +__attribute__((deprecated)) model_with_set_propertes_t *model_with_set_propertes_create( list_t *tag_set, list_t *string_set ); diff --git a/samples/client/petstore/c-useJsonUnformatted/model/order.c b/samples/client/petstore/c-useJsonUnformatted/model/order.c index bbbc50e1a316..d67d1d47c714 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/order.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/order.c @@ -22,7 +22,7 @@ openapi_petstore_order_STATUS_e order_status_FromString(char* status){ return 0; } -order_t *order_create( +static order_t *order_create_internal( long id, long pet_id, int quantity, @@ -41,14 +41,36 @@ order_t *order_create( order_local_var->status = status; order_local_var->complete = complete; + order_local_var->_library_owned = 1; return order_local_var; } +__attribute__((deprecated)) order_t *order_create( + long id, + long pet_id, + int quantity, + char *ship_date, + openapi_petstore_order_STATUS_e status, + int complete + ) { + return order_create_internal ( + id, + pet_id, + quantity, + ship_date, + status, + complete + ); +} void order_free(order_t *order) { if(NULL == order){ return ; } + if(order->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "order_free"); + return ; + } listEntry_t *listEntry; if (order->ship_date) { free(order->ship_date); @@ -94,7 +116,7 @@ cJSON *order_convertToJSON(order_t *order) { // order->status if(order->status != openapi_petstore_order_STATUS_NULL) { - if(cJSON_AddStringToObject(item, "status", statusorder_ToString(order->status)) == NULL) + if(cJSON_AddStringToObject(item, "status", order_status_ToString(order->status)) == NULL) { goto fail; //Enum } @@ -195,7 +217,7 @@ order_t *order_parseFromJSON(cJSON *orderJSON){ } - order_local_var = order_create ( + order_local_var = order_create_internal ( id ? id->valuedouble : 0, pet_id ? pet_id->valuedouble : 0, quantity ? quantity->valuedouble : 0, diff --git a/samples/client/petstore/c-useJsonUnformatted/model/order.h b/samples/client/petstore/c-useJsonUnformatted/model/order.h index 32914a227499..1b0a47b3028e 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/order.h +++ b/samples/client/petstore/c-useJsonUnformatted/model/order.h @@ -34,9 +34,10 @@ typedef struct order_t { openapi_petstore_order_STATUS_e status; //enum int complete; //boolean + int _library_owned; // Is the library responsible for freeing this object? } order_t; -order_t *order_create( +__attribute__((deprecated)) order_t *order_create( long id, long pet_id, int quantity, diff --git a/samples/client/petstore/c-useJsonUnformatted/model/pet.c b/samples/client/petstore/c-useJsonUnformatted/model/pet.c index d95d672eda00..1393cc4275a6 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/pet.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/pet.c @@ -22,7 +22,7 @@ openapi_petstore_pet_STATUS_e pet_status_FromString(char* status){ return 0; } -pet_t *pet_create( +static pet_t *pet_create_internal( long id, category_t *category, char *name, @@ -41,14 +41,36 @@ pet_t *pet_create( pet_local_var->tags = tags; pet_local_var->status = status; + pet_local_var->_library_owned = 1; return pet_local_var; } +__attribute__((deprecated)) pet_t *pet_create( + long id, + category_t *category, + char *name, + list_t *photo_urls, + list_t *tags, + openapi_petstore_pet_STATUS_e status + ) { + return pet_create_internal ( + id, + category, + name, + photo_urls, + tags, + status + ); +} void pet_free(pet_t *pet) { if(NULL == pet){ return ; } + if(pet->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "pet_free"); + return ; + } listEntry_t *listEntry; if (pet->category) { category_free(pet->category); @@ -148,7 +170,7 @@ cJSON *pet_convertToJSON(pet_t *pet) { // pet->status if(pet->status != openapi_petstore_pet_STATUS_NULL) { - if(cJSON_AddStringToObject(item, "status", statuspet_ToString(pet->status)) == NULL) + if(cJSON_AddStringToObject(item, "status", pet_status_ToString(pet->status)) == NULL) { goto fail; //Enum } @@ -275,7 +297,7 @@ pet_t *pet_parseFromJSON(cJSON *petJSON){ } - pet_local_var = pet_create ( + pet_local_var = pet_create_internal ( id ? id->valuedouble : 0, category ? category_local_nonprim : NULL, strdup(name->valuestring), diff --git a/samples/client/petstore/c-useJsonUnformatted/model/pet.h b/samples/client/petstore/c-useJsonUnformatted/model/pet.h index d74025510143..860197e63a53 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/pet.h +++ b/samples/client/petstore/c-useJsonUnformatted/model/pet.h @@ -36,9 +36,10 @@ typedef struct pet_t { list_t *tags; //nonprimitive container openapi_petstore_pet_STATUS_e status; //enum + int _library_owned; // Is the library responsible for freeing this object? } pet_t; -pet_t *pet_create( +__attribute__((deprecated)) pet_t *pet_create( long id, category_t *category, char *name, diff --git a/samples/client/petstore/c-useJsonUnformatted/model/tag.c b/samples/client/petstore/c-useJsonUnformatted/model/tag.c index f79d34ef9acd..e4b4f94af53d 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/tag.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/tag.c @@ -5,7 +5,7 @@ -tag_t *tag_create( +static tag_t *tag_create_internal( long id, char *name ) { @@ -16,14 +16,28 @@ tag_t *tag_create( tag_local_var->id = id; tag_local_var->name = name; + tag_local_var->_library_owned = 1; return tag_local_var; } +__attribute__((deprecated)) tag_t *tag_create( + long id, + char *name + ) { + return tag_create_internal ( + id, + name + ); +} void tag_free(tag_t *tag) { if(NULL == tag){ return ; } + if(tag->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "tag_free"); + return ; + } listEntry_t *listEntry; if (tag->name) { free(tag->name); @@ -87,7 +101,7 @@ tag_t *tag_parseFromJSON(cJSON *tagJSON){ } - tag_local_var = tag_create ( + tag_local_var = tag_create_internal ( id ? id->valuedouble : 0, name && !cJSON_IsNull(name) ? strdup(name->valuestring) : NULL ); diff --git a/samples/client/petstore/c-useJsonUnformatted/model/tag.h b/samples/client/petstore/c-useJsonUnformatted/model/tag.h index 9e7b5d053a9d..d4b29e4d2e04 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/tag.h +++ b/samples/client/petstore/c-useJsonUnformatted/model/tag.h @@ -22,9 +22,10 @@ typedef struct tag_t { long id; //numeric char *name; // string + int _library_owned; // Is the library responsible for freeing this object? } tag_t; -tag_t *tag_create( +__attribute__((deprecated)) tag_t *tag_create( long id, char *name ); diff --git a/samples/client/petstore/c-useJsonUnformatted/model/user.c b/samples/client/petstore/c-useJsonUnformatted/model/user.c index 111bafdc02ad..ce31e6ad17df 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/user.c +++ b/samples/client/petstore/c-useJsonUnformatted/model/user.c @@ -5,7 +5,7 @@ -user_t *user_create( +static user_t *user_create_internal( long id, char *username, char *first_name, @@ -32,14 +32,44 @@ user_t *user_create( user_local_var->extra = extra; user_local_var->preference = preference; + user_local_var->_library_owned = 1; return user_local_var; } +__attribute__((deprecated)) user_t *user_create( + long id, + char *username, + char *first_name, + char *last_name, + char *email, + char *password, + char *phone, + int user_status, + list_t* extra, + openapi_petstore_preference__e preference + ) { + return user_create_internal ( + id, + username, + first_name, + last_name, + email, + password, + phone, + user_status, + extra, + preference + ); +} void user_free(user_t *user) { if(NULL == user){ return ; } + if(user->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "user_free"); + return ; + } listEntry_t *listEntry; if (user->username) { free(user->username); @@ -320,7 +350,7 @@ user_t *user_parseFromJSON(cJSON *userJSON){ } - user_local_var = user_create ( + user_local_var = user_create_internal ( id ? id->valuedouble : 0, username && !cJSON_IsNull(username) ? strdup(username->valuestring) : NULL, first_name && !cJSON_IsNull(first_name) ? strdup(first_name->valuestring) : NULL, diff --git a/samples/client/petstore/c-useJsonUnformatted/model/user.h b/samples/client/petstore/c-useJsonUnformatted/model/user.h index badbc747b308..4643e020a5fe 100644 --- a/samples/client/petstore/c-useJsonUnformatted/model/user.h +++ b/samples/client/petstore/c-useJsonUnformatted/model/user.h @@ -32,9 +32,10 @@ typedef struct user_t { list_t* extra; //map openapi_petstore_preference__e preference; //referenced enum + int _library_owned; // Is the library responsible for freeing this object? } user_t; -user_t *user_create( +__attribute__((deprecated)) user_t *user_create( long id, char *username, char *first_name, diff --git a/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c b/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c index 302cb8bff342..ad06a341a4bb 100644 --- a/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c +++ b/samples/client/petstore/c-useJsonUnformatted/src/apiClient.c @@ -116,7 +116,7 @@ void sslConfig_free(sslConfig_t *sslConfig) { free(sslConfig); } -void replaceSpaceWithPlus(char *stringToProcess) { +static void replaceSpaceWithPlus(char *stringToProcess) { for(int i = 0; i < strlen(stringToProcess); i++) { if(stringToProcess[i] == ' ') { stringToProcess[i] = '+'; @@ -124,9 +124,9 @@ void replaceSpaceWithPlus(char *stringToProcess) { } } -char *assembleTargetUrl(const char *basePath, - const char *operationParameter, - list_t *queryParameters) { +static char *assembleTargetUrl(const char *basePath, + const char *operationParameter, + list_t *queryParameters) { int neededBufferSizeForQueryParameters = 0; listEntry_t *listEntry; @@ -177,7 +177,7 @@ char *assembleTargetUrl(const char *basePath, return targetUrl; } -char *assembleHeaderField(char *key, char *value) { +static char *assembleHeaderField(char *key, char *value) { char *header = malloc(strlen(key) + strlen(value) + 3); strcpy(header, key), @@ -187,13 +187,13 @@ char *assembleHeaderField(char *key, char *value) { return header; } -void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { +static void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)bodyParametersLength); } -int lengthOfKeyPair(keyValuePair_t *keyPair) { +static int lengthOfKeyPair(keyValuePair_t *keyPair) { long length = 0; if((keyPair->key != NULL) && (keyPair->value != NULL) ) diff --git a/samples/client/petstore/c/README.md b/samples/client/petstore/c/README.md index 239e0f4c8ff4..a7cf2d3100af 100644 --- a/samples/client/petstore/c/README.md +++ b/samples/client/petstore/c/README.md @@ -84,6 +84,7 @@ Category | Method | HTTP request | Description *StoreAPI* | [**StoreAPI_placeOrder**](docs/StoreAPI.md#StoreAPI_placeOrder) | **POST** /store/order | Place an order for a pet *StoreAPI* | [**StoreAPI_sendFeedback**](docs/StoreAPI.md#StoreAPI_sendFeedback) | **POST** /store/feedback | Send us a feedback message *StoreAPI* | [**StoreAPI_sendRating**](docs/StoreAPI.md#StoreAPI_sendRating) | **POST** /store/rating/{rating} | How would you rate our service? +*StoreAPI* | [**StoreAPI_sendRecommend**](docs/StoreAPI.md#StoreAPI_sendRecommend) | **POST** /store/recommend | Would you recommend our service to a friend? *UserAPI* | [**UserAPI_createUser**](docs/UserAPI.md#UserAPI_createUser) | **POST** /user | Create user *UserAPI* | [**UserAPI_createUsersWithArrayInput**](docs/UserAPI.md#UserAPI_createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array *UserAPI* | [**UserAPI_createUsersWithListInput**](docs/UserAPI.md#UserAPI_createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array diff --git a/samples/client/petstore/c/api/PetAPI.c b/samples/client/petstore/c/api/PetAPI.c index 16bb7fddcab1..90e5c5312f69 100644 --- a/samples/client/petstore/c/api/PetAPI.c +++ b/samples/client/petstore/c/api/PetAPI.c @@ -5,11 +5,6 @@ #define MAX_NUMBER_LENGTH 16 #define MAX_BUFFER_LENGTH 4096 -#define intToStr(dst, src) \ - do {\ - char dst[256];\ - snprintf(dst, 256, "%ld", (long int)(src));\ -}while(0) // Functions for enum STATUS for PetAPI_findPetsByStatus @@ -159,7 +154,7 @@ PetAPI_deletePet(apiClient_t *apiClient, long petId, char *api_key) snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); @@ -501,7 +496,7 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId) snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); @@ -658,7 +653,7 @@ PetAPI_isPetAvailable(apiClient_t *apiClient, long petId) snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); @@ -965,7 +960,7 @@ PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId, char *name, char *s snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); @@ -1078,7 +1073,7 @@ PetAPI_uploadFile(apiClient_t *apiClient, long petId, char *additionalMetadata, snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId"); char localVarBuff_petId[256]; - intToStr(localVarBuff_petId, petId); + snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId); localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId); diff --git a/samples/client/petstore/c/api/StoreAPI.c b/samples/client/petstore/c/api/StoreAPI.c index 6da10d3e0807..843c6bfc47e2 100644 --- a/samples/client/petstore/c/api/StoreAPI.c +++ b/samples/client/petstore/c/api/StoreAPI.c @@ -5,11 +5,6 @@ #define MAX_NUMBER_LENGTH 16 #define MAX_BUFFER_LENGTH 4096 -#define intToStr(dst, src) \ - do {\ - char dst[256];\ - snprintf(dst, 256, "%ld", (long int)(src));\ -}while(0) // Functions for enum RATING for StoreAPI_sendRating @@ -245,7 +240,7 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId) snprintf(localVarToReplace_orderId, sizeOfPathParams_orderId, "{%s}", "orderId"); char localVarBuff_orderId[256]; - intToStr(localVarBuff_orderId, orderId); + snprintf(localVarBuff_orderId, sizeof localVarBuff_orderId, "%ld", orderId); localVarPath = strReplace(localVarPath, localVarToReplace_orderId, localVarBuff_orderId); @@ -541,3 +536,85 @@ StoreAPI_sendRating(apiClient_t *apiClient, openapi_petstore_sendRating_rating_e } +// Would you recommend our service to a friend? +// +char* +StoreAPI_sendRecommend(apiClient_t *apiClient, int *recommend) +{ + list_t *localVarQueryParameters = NULL; + list_t *localVarHeaderParameters = NULL; + list_t *localVarFormParameters = list_createList(); + list_t *localVarHeaderType = list_createList(); + list_t *localVarContentType = list_createList(); + char *localVarBodyParameters = NULL; + size_t localVarBodyLength = 0; + + // clear the error code from the previous api call + apiClient->response_code = 0; + + // create the path + long sizeOfPath = strlen("/store/recommend")+1; + char *localVarPath = malloc(sizeOfPath); + snprintf(localVarPath, sizeOfPath, "/store/recommend"); + + + + + + // form parameters + char *keyForm_recommend = NULL; + char * valueForm_recommend = 0; + keyValuePair_t *keyPairForm_recommend = 0; + if (recommend != NULL) + { + keyForm_recommend = strdup("recommend"); + valueForm_recommend = calloc(1,MAX_NUMBER_LENGTH); + snprintf(valueForm_recommend, MAX_NUMBER_LENGTH, "%d", *recommend); + keyPairForm_recommend = keyValuePair_create(keyForm_recommend,valueForm_recommend); + list_addElement(localVarFormParameters,keyPairForm_recommend); + } + list_addElement(localVarHeaderType,"*/*"); //produces + list_addElement(localVarContentType,"multipart/form-data"); //consumes + apiClient_invoke(apiClient, + localVarPath, + localVarQueryParameters, + localVarHeaderParameters, + localVarFormParameters, + localVarHeaderType, + localVarContentType, + localVarBodyParameters, + localVarBodyLength, + "POST"); + + // uncomment below to debug the error response + //if (apiClient->response_code == 200) { + // printf("%s\n","successful operation"); + //} + //primitive return type simple string + char* elementToReturn = NULL; + if(apiClient->response_code >= 200 && apiClient->response_code < 300) + elementToReturn = strdup((char*)apiClient->dataReceived); + + if (apiClient->dataReceived) { + free(apiClient->dataReceived); + apiClient->dataReceived = NULL; + apiClient->dataReceivedLen = 0; + } + + + list_freeList(localVarFormParameters); + list_freeList(localVarHeaderType); + list_freeList(localVarContentType); + free(localVarPath); + if (keyForm_recommend) { + free(keyForm_recommend); + keyForm_recommend = NULL; + } + free(keyPairForm_recommend); + return elementToReturn; +end: + free(localVarPath); + return NULL; + +} + diff --git a/samples/client/petstore/c/api/StoreAPI.h b/samples/client/petstore/c/api/StoreAPI.h index 1608e2b27d66..693d21b7dd64 100644 --- a/samples/client/petstore/c/api/StoreAPI.h +++ b/samples/client/petstore/c/api/StoreAPI.h @@ -53,3 +53,9 @@ char* StoreAPI_sendRating(apiClient_t *apiClient, openapi_petstore_sendRating_rating_e rating); +// Would you recommend our service to a friend? +// +char* +StoreAPI_sendRecommend(apiClient_t *apiClient, int *recommend); + + diff --git a/samples/client/petstore/c/api/UserAPI.c b/samples/client/petstore/c/api/UserAPI.c index 213220a3c1eb..d27ee87c4fde 100644 --- a/samples/client/petstore/c/api/UserAPI.c +++ b/samples/client/petstore/c/api/UserAPI.c @@ -5,11 +5,6 @@ #define MAX_NUMBER_LENGTH 16 #define MAX_BUFFER_LENGTH 4096 -#define intToStr(dst, src) \ - do {\ - char dst[256];\ - snprintf(dst, 256, "%ld", (long int)(src));\ -}while(0) // Create user diff --git a/samples/client/petstore/c/docs/StoreAPI.md b/samples/client/petstore/c/docs/StoreAPI.md index 11fab3fe58ad..8705a994803a 100644 --- a/samples/client/petstore/c/docs/StoreAPI.md +++ b/samples/client/petstore/c/docs/StoreAPI.md @@ -10,6 +10,7 @@ Method | HTTP request | Description [**StoreAPI_placeOrder**](StoreAPI.md#StoreAPI_placeOrder) | **POST** /store/order | Place an order for a pet [**StoreAPI_sendFeedback**](StoreAPI.md#StoreAPI_sendFeedback) | **POST** /store/feedback | Send us a feedback message [**StoreAPI_sendRating**](StoreAPI.md#StoreAPI_sendRating) | **POST** /store/rating/{rating} | How would you rate our service? +[**StoreAPI_sendRecommend**](StoreAPI.md#StoreAPI_sendRecommend) | **POST** /store/recommend | Would you recommend our service to a friend? # **StoreAPI_deleteOrder** @@ -195,3 +196,33 @@ No authorization required [[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) +# **StoreAPI_sendRecommend** +```c +// Would you recommend our service to a friend? +// +char* StoreAPI_sendRecommend(apiClient_t *apiClient, int *recommend); +``` + +### Parameters +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**apiClient** | **apiClient_t \*** | context containing the client configuration | +**recommend** | **int \*** | Would you recommend us or not? | [optional] + +### Return type + +char* + + + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **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) + diff --git a/samples/client/petstore/c/model/api_response.c b/samples/client/petstore/c/model/api_response.c index ccae1f010102..d0169c84f5b2 100644 --- a/samples/client/petstore/c/model/api_response.c +++ b/samples/client/petstore/c/model/api_response.c @@ -5,7 +5,7 @@ -api_response_t *api_response_create( +static api_response_t *api_response_create_internal( int code, char *type, char *message @@ -18,14 +18,30 @@ api_response_t *api_response_create( api_response_local_var->type = type; api_response_local_var->message = message; + api_response_local_var->_library_owned = 1; return api_response_local_var; } +__attribute__((deprecated)) api_response_t *api_response_create( + int code, + char *type, + char *message + ) { + return api_response_create_internal ( + code, + type, + message + ); +} void api_response_free(api_response_t *api_response) { if(NULL == api_response){ return ; } + if(api_response->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "api_response_free"); + return ; + } listEntry_t *listEntry; if (api_response->type) { free(api_response->type); @@ -113,7 +129,7 @@ api_response_t *api_response_parseFromJSON(cJSON *api_responseJSON){ } - api_response_local_var = api_response_create ( + api_response_local_var = api_response_create_internal ( code ? code->valuedouble : 0, type && !cJSON_IsNull(type) ? strdup(type->valuestring) : NULL, message && !cJSON_IsNull(message) ? strdup(message->valuestring) : NULL diff --git a/samples/client/petstore/c/model/api_response.h b/samples/client/petstore/c/model/api_response.h index d64dcbacedd9..3d9eb71ff5d5 100644 --- a/samples/client/petstore/c/model/api_response.h +++ b/samples/client/petstore/c/model/api_response.h @@ -23,9 +23,10 @@ typedef struct api_response_t { char *type; // string char *message; // string + int _library_owned; // Is the library responsible for freeing this object? } api_response_t; -api_response_t *api_response_create( +__attribute__((deprecated)) api_response_t *api_response_create( int code, char *type, char *message diff --git a/samples/client/petstore/c/model/category.c b/samples/client/petstore/c/model/category.c index a1ea1a5d5cee..2b060a568015 100644 --- a/samples/client/petstore/c/model/category.c +++ b/samples/client/petstore/c/model/category.c @@ -5,7 +5,7 @@ -category_t *category_create( +static category_t *category_create_internal( long id, char *name ) { @@ -16,14 +16,28 @@ category_t *category_create( category_local_var->id = id; category_local_var->name = name; + category_local_var->_library_owned = 1; return category_local_var; } +__attribute__((deprecated)) category_t *category_create( + long id, + char *name + ) { + return category_create_internal ( + id, + name + ); +} void category_free(category_t *category) { if(NULL == category){ return ; } + if(category->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "category_free"); + return ; + } listEntry_t *listEntry; if (category->name) { free(category->name); @@ -87,7 +101,7 @@ category_t *category_parseFromJSON(cJSON *categoryJSON){ } - category_local_var = category_create ( + category_local_var = category_create_internal ( id ? id->valuedouble : 0, name && !cJSON_IsNull(name) ? strdup(name->valuestring) : NULL ); diff --git a/samples/client/petstore/c/model/category.h b/samples/client/petstore/c/model/category.h index ec9efd6ccf60..bd27e27e35a3 100644 --- a/samples/client/petstore/c/model/category.h +++ b/samples/client/petstore/c/model/category.h @@ -22,9 +22,10 @@ typedef struct category_t { long id; //numeric char *name; // string + int _library_owned; // Is the library responsible for freeing this object? } category_t; -category_t *category_create( +__attribute__((deprecated)) category_t *category_create( long id, char *name ); diff --git a/samples/client/petstore/c/model/mapped_model.c b/samples/client/petstore/c/model/mapped_model.c index 7423e32eb338..3ab1e861c326 100644 --- a/samples/client/petstore/c/model/mapped_model.c +++ b/samples/client/petstore/c/model/mapped_model.c @@ -5,7 +5,7 @@ -MappedModel_t *MappedModel_create( +static MappedModel_t *MappedModel_create_internal( int another_property, char *uuid_property ) { @@ -16,14 +16,28 @@ MappedModel_t *MappedModel_create( MappedModel_local_var->another_property = another_property; MappedModel_local_var->uuid_property = uuid_property; + MappedModel_local_var->_library_owned = 1; return MappedModel_local_var; } +__attribute__((deprecated)) MappedModel_t *MappedModel_create( + int another_property, + char *uuid_property + ) { + return MappedModel_create_internal ( + another_property, + uuid_property + ); +} void MappedModel_free(MappedModel_t *MappedModel) { if(NULL == MappedModel){ return ; } + if(MappedModel->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "MappedModel_free"); + return ; + } listEntry_t *listEntry; if (MappedModel->uuid_property) { free(MappedModel->uuid_property); @@ -87,7 +101,7 @@ MappedModel_t *MappedModel_parseFromJSON(cJSON *MappedModelJSON){ } - MappedModel_local_var = MappedModel_create ( + MappedModel_local_var = MappedModel_create_internal ( another_property ? another_property->valuedouble : 0, uuid_property && !cJSON_IsNull(uuid_property) ? strdup(uuid_property->valuestring) : NULL ); diff --git a/samples/client/petstore/c/model/mapped_model.h b/samples/client/petstore/c/model/mapped_model.h index 83b1d4581ba6..b962632d647d 100644 --- a/samples/client/petstore/c/model/mapped_model.h +++ b/samples/client/petstore/c/model/mapped_model.h @@ -22,9 +22,10 @@ typedef struct MappedModel_t { int another_property; //numeric char *uuid_property; // string + int _library_owned; // Is the library responsible for freeing this object? } MappedModel_t; -MappedModel_t *MappedModel_create( +__attribute__((deprecated)) MappedModel_t *MappedModel_create( int another_property, char *uuid_property ); diff --git a/samples/client/petstore/c/model/model_with_set_propertes.c b/samples/client/petstore/c/model/model_with_set_propertes.c index d29660fccfcd..0791d68f48a5 100644 --- a/samples/client/petstore/c/model/model_with_set_propertes.c +++ b/samples/client/petstore/c/model/model_with_set_propertes.c @@ -5,7 +5,7 @@ -model_with_set_propertes_t *model_with_set_propertes_create( +static model_with_set_propertes_t *model_with_set_propertes_create_internal( list_t *tag_set, list_t *string_set ) { @@ -16,14 +16,28 @@ model_with_set_propertes_t *model_with_set_propertes_create( model_with_set_propertes_local_var->tag_set = tag_set; model_with_set_propertes_local_var->string_set = string_set; + model_with_set_propertes_local_var->_library_owned = 1; return model_with_set_propertes_local_var; } +__attribute__((deprecated)) model_with_set_propertes_t *model_with_set_propertes_create( + list_t *tag_set, + list_t *string_set + ) { + return model_with_set_propertes_create_internal ( + tag_set, + string_set + ); +} void model_with_set_propertes_free(model_with_set_propertes_t *model_with_set_propertes) { if(NULL == model_with_set_propertes){ return ; } + if(model_with_set_propertes->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "model_with_set_propertes_free"); + return ; + } listEntry_t *listEntry; if (model_with_set_propertes->tag_set) { list_ForEach(listEntry, model_with_set_propertes->tag_set) { @@ -146,7 +160,7 @@ model_with_set_propertes_t *model_with_set_propertes_parseFromJSON(cJSON *model_ } - model_with_set_propertes_local_var = model_with_set_propertes_create ( + model_with_set_propertes_local_var = model_with_set_propertes_create_internal ( tag_set ? tag_setList : NULL, string_set ? string_setList : NULL ); diff --git a/samples/client/petstore/c/model/model_with_set_propertes.h b/samples/client/petstore/c/model/model_with_set_propertes.h index 537271638b99..aa82893b94bb 100644 --- a/samples/client/petstore/c/model/model_with_set_propertes.h +++ b/samples/client/petstore/c/model/model_with_set_propertes.h @@ -23,9 +23,10 @@ typedef struct model_with_set_propertes_t { list_t *tag_set; //nonprimitive container list_t *string_set; //primitive container + int _library_owned; // Is the library responsible for freeing this object? } model_with_set_propertes_t; -model_with_set_propertes_t *model_with_set_propertes_create( +__attribute__((deprecated)) model_with_set_propertes_t *model_with_set_propertes_create( list_t *tag_set, list_t *string_set ); diff --git a/samples/client/petstore/c/model/order.c b/samples/client/petstore/c/model/order.c index bbbc50e1a316..d67d1d47c714 100644 --- a/samples/client/petstore/c/model/order.c +++ b/samples/client/petstore/c/model/order.c @@ -22,7 +22,7 @@ openapi_petstore_order_STATUS_e order_status_FromString(char* status){ return 0; } -order_t *order_create( +static order_t *order_create_internal( long id, long pet_id, int quantity, @@ -41,14 +41,36 @@ order_t *order_create( order_local_var->status = status; order_local_var->complete = complete; + order_local_var->_library_owned = 1; return order_local_var; } +__attribute__((deprecated)) order_t *order_create( + long id, + long pet_id, + int quantity, + char *ship_date, + openapi_petstore_order_STATUS_e status, + int complete + ) { + return order_create_internal ( + id, + pet_id, + quantity, + ship_date, + status, + complete + ); +} void order_free(order_t *order) { if(NULL == order){ return ; } + if(order->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "order_free"); + return ; + } listEntry_t *listEntry; if (order->ship_date) { free(order->ship_date); @@ -94,7 +116,7 @@ cJSON *order_convertToJSON(order_t *order) { // order->status if(order->status != openapi_petstore_order_STATUS_NULL) { - if(cJSON_AddStringToObject(item, "status", statusorder_ToString(order->status)) == NULL) + if(cJSON_AddStringToObject(item, "status", order_status_ToString(order->status)) == NULL) { goto fail; //Enum } @@ -195,7 +217,7 @@ order_t *order_parseFromJSON(cJSON *orderJSON){ } - order_local_var = order_create ( + order_local_var = order_create_internal ( id ? id->valuedouble : 0, pet_id ? pet_id->valuedouble : 0, quantity ? quantity->valuedouble : 0, diff --git a/samples/client/petstore/c/model/order.h b/samples/client/petstore/c/model/order.h index 32914a227499..1b0a47b3028e 100644 --- a/samples/client/petstore/c/model/order.h +++ b/samples/client/petstore/c/model/order.h @@ -34,9 +34,10 @@ typedef struct order_t { openapi_petstore_order_STATUS_e status; //enum int complete; //boolean + int _library_owned; // Is the library responsible for freeing this object? } order_t; -order_t *order_create( +__attribute__((deprecated)) order_t *order_create( long id, long pet_id, int quantity, diff --git a/samples/client/petstore/c/model/pet.c b/samples/client/petstore/c/model/pet.c index d95d672eda00..1393cc4275a6 100644 --- a/samples/client/petstore/c/model/pet.c +++ b/samples/client/petstore/c/model/pet.c @@ -22,7 +22,7 @@ openapi_petstore_pet_STATUS_e pet_status_FromString(char* status){ return 0; } -pet_t *pet_create( +static pet_t *pet_create_internal( long id, category_t *category, char *name, @@ -41,14 +41,36 @@ pet_t *pet_create( pet_local_var->tags = tags; pet_local_var->status = status; + pet_local_var->_library_owned = 1; return pet_local_var; } +__attribute__((deprecated)) pet_t *pet_create( + long id, + category_t *category, + char *name, + list_t *photo_urls, + list_t *tags, + openapi_petstore_pet_STATUS_e status + ) { + return pet_create_internal ( + id, + category, + name, + photo_urls, + tags, + status + ); +} void pet_free(pet_t *pet) { if(NULL == pet){ return ; } + if(pet->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "pet_free"); + return ; + } listEntry_t *listEntry; if (pet->category) { category_free(pet->category); @@ -148,7 +170,7 @@ cJSON *pet_convertToJSON(pet_t *pet) { // pet->status if(pet->status != openapi_petstore_pet_STATUS_NULL) { - if(cJSON_AddStringToObject(item, "status", statuspet_ToString(pet->status)) == NULL) + if(cJSON_AddStringToObject(item, "status", pet_status_ToString(pet->status)) == NULL) { goto fail; //Enum } @@ -275,7 +297,7 @@ pet_t *pet_parseFromJSON(cJSON *petJSON){ } - pet_local_var = pet_create ( + pet_local_var = pet_create_internal ( id ? id->valuedouble : 0, category ? category_local_nonprim : NULL, strdup(name->valuestring), diff --git a/samples/client/petstore/c/model/pet.h b/samples/client/petstore/c/model/pet.h index d74025510143..860197e63a53 100644 --- a/samples/client/petstore/c/model/pet.h +++ b/samples/client/petstore/c/model/pet.h @@ -36,9 +36,10 @@ typedef struct pet_t { list_t *tags; //nonprimitive container openapi_petstore_pet_STATUS_e status; //enum + int _library_owned; // Is the library responsible for freeing this object? } pet_t; -pet_t *pet_create( +__attribute__((deprecated)) pet_t *pet_create( long id, category_t *category, char *name, diff --git a/samples/client/petstore/c/model/tag.c b/samples/client/petstore/c/model/tag.c index f79d34ef9acd..e4b4f94af53d 100644 --- a/samples/client/petstore/c/model/tag.c +++ b/samples/client/petstore/c/model/tag.c @@ -5,7 +5,7 @@ -tag_t *tag_create( +static tag_t *tag_create_internal( long id, char *name ) { @@ -16,14 +16,28 @@ tag_t *tag_create( tag_local_var->id = id; tag_local_var->name = name; + tag_local_var->_library_owned = 1; return tag_local_var; } +__attribute__((deprecated)) tag_t *tag_create( + long id, + char *name + ) { + return tag_create_internal ( + id, + name + ); +} void tag_free(tag_t *tag) { if(NULL == tag){ return ; } + if(tag->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "tag_free"); + return ; + } listEntry_t *listEntry; if (tag->name) { free(tag->name); @@ -87,7 +101,7 @@ tag_t *tag_parseFromJSON(cJSON *tagJSON){ } - tag_local_var = tag_create ( + tag_local_var = tag_create_internal ( id ? id->valuedouble : 0, name && !cJSON_IsNull(name) ? strdup(name->valuestring) : NULL ); diff --git a/samples/client/petstore/c/model/tag.h b/samples/client/petstore/c/model/tag.h index 9e7b5d053a9d..d4b29e4d2e04 100644 --- a/samples/client/petstore/c/model/tag.h +++ b/samples/client/petstore/c/model/tag.h @@ -22,9 +22,10 @@ typedef struct tag_t { long id; //numeric char *name; // string + int _library_owned; // Is the library responsible for freeing this object? } tag_t; -tag_t *tag_create( +__attribute__((deprecated)) tag_t *tag_create( long id, char *name ); diff --git a/samples/client/petstore/c/model/user.c b/samples/client/petstore/c/model/user.c index 111bafdc02ad..ce31e6ad17df 100644 --- a/samples/client/petstore/c/model/user.c +++ b/samples/client/petstore/c/model/user.c @@ -5,7 +5,7 @@ -user_t *user_create( +static user_t *user_create_internal( long id, char *username, char *first_name, @@ -32,14 +32,44 @@ user_t *user_create( user_local_var->extra = extra; user_local_var->preference = preference; + user_local_var->_library_owned = 1; return user_local_var; } +__attribute__((deprecated)) user_t *user_create( + long id, + char *username, + char *first_name, + char *last_name, + char *email, + char *password, + char *phone, + int user_status, + list_t* extra, + openapi_petstore_preference__e preference + ) { + return user_create_internal ( + id, + username, + first_name, + last_name, + email, + password, + phone, + user_status, + extra, + preference + ); +} void user_free(user_t *user) { if(NULL == user){ return ; } + if(user->_library_owned != 1){ + fprintf(stderr, "WARNING: %s() does NOT free objects allocated by the user\n", "user_free"); + return ; + } listEntry_t *listEntry; if (user->username) { free(user->username); @@ -320,7 +350,7 @@ user_t *user_parseFromJSON(cJSON *userJSON){ } - user_local_var = user_create ( + user_local_var = user_create_internal ( id ? id->valuedouble : 0, username && !cJSON_IsNull(username) ? strdup(username->valuestring) : NULL, first_name && !cJSON_IsNull(first_name) ? strdup(first_name->valuestring) : NULL, diff --git a/samples/client/petstore/c/model/user.h b/samples/client/petstore/c/model/user.h index badbc747b308..4643e020a5fe 100644 --- a/samples/client/petstore/c/model/user.h +++ b/samples/client/petstore/c/model/user.h @@ -32,9 +32,10 @@ typedef struct user_t { list_t* extra; //map openapi_petstore_preference__e preference; //referenced enum + int _library_owned; // Is the library responsible for freeing this object? } user_t; -user_t *user_create( +__attribute__((deprecated)) user_t *user_create( long id, char *username, char *first_name, diff --git a/samples/client/petstore/c/src/apiClient.c b/samples/client/petstore/c/src/apiClient.c index 302cb8bff342..ad06a341a4bb 100644 --- a/samples/client/petstore/c/src/apiClient.c +++ b/samples/client/petstore/c/src/apiClient.c @@ -116,7 +116,7 @@ void sslConfig_free(sslConfig_t *sslConfig) { free(sslConfig); } -void replaceSpaceWithPlus(char *stringToProcess) { +static void replaceSpaceWithPlus(char *stringToProcess) { for(int i = 0; i < strlen(stringToProcess); i++) { if(stringToProcess[i] == ' ') { stringToProcess[i] = '+'; @@ -124,9 +124,9 @@ void replaceSpaceWithPlus(char *stringToProcess) { } } -char *assembleTargetUrl(const char *basePath, - const char *operationParameter, - list_t *queryParameters) { +static char *assembleTargetUrl(const char *basePath, + const char *operationParameter, + list_t *queryParameters) { int neededBufferSizeForQueryParameters = 0; listEntry_t *listEntry; @@ -177,7 +177,7 @@ char *assembleTargetUrl(const char *basePath, return targetUrl; } -char *assembleHeaderField(char *key, char *value) { +static char *assembleHeaderField(char *key, char *value) { char *header = malloc(strlen(key) + strlen(value) + 3); strcpy(header, key), @@ -187,13 +187,13 @@ char *assembleHeaderField(char *key, char *value) { return header; } -void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { +static void postData(CURL *handle, const char *bodyParameters, size_t bodyParametersLength) { curl_easy_setopt(handle, CURLOPT_POSTFIELDS, bodyParameters); curl_easy_setopt(handle, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)bodyParametersLength); } -int lengthOfKeyPair(keyValuePair_t *keyPair) { +static int lengthOfKeyPair(keyValuePair_t *keyPair) { long length = 0; if((keyPair->key != NULL) && (keyPair->value != NULL) ) diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h index ed917a0bdafa..462670a50ad7 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h @@ -240,7 +240,7 @@ web::json::value ModelBase::toJson( const std::vector& value ) template web::json::value ModelBase::toJson( const std::set& value ) { - // There's no protoype web::json::value::array(...) taking a std::set parameter. Converting to std::vector to get an array. + // There's no prototype web::json::value::array(...) taking a std::set parameter. Converting to std::vector to get an array. std::vector ret; for ( const auto& x : value ) { diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..a4e283f2d333 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -3,14 +3,14 @@ Org.OpenAPITools.Test Org.OpenAPITools.Test - net8.0 + net9.0 false enable - - + + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 9f99b6957b6d..5e475211af94 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -2,7 +2,7 @@ true - net8.0 + net9.0 Org.OpenAPITools Org.OpenAPITools Library @@ -22,10 +22,10 @@ - - - - + + + + diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/README.md index 4ab472091646..529a157c5103 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/README.md +++ b/samples/client/petstore/csharp/generichost/latest/Tags/src/Org.OpenAPITools/README.md @@ -6,7 +6,7 @@ ```ps1 $properties = @( 'apiName=Api', - 'targetFramework=net8.0', + 'targetFramework=net9.0', 'validatable=true', 'nullableReferenceTypes=true', 'hideGenerationTimestamp=true', @@ -181,7 +181,7 @@ Authentication schemes defined for the API: - returnICollection: false - sortParamsByRequiredFlag: - sourceFolder: src -- targetFramework: net8.0 +- targetFramework: net9.0 - useCollection: false - useDateTimeOffset: false - useOneOfDiscriminatorLookup: false diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..497ab8cafe48 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -69,7 +69,7 @@ public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString k public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..497ab8cafe48 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -69,7 +69,7 @@ public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString k public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..497ab8cafe48 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -69,7 +69,7 @@ public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString k public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..497ab8cafe48 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -69,7 +69,7 @@ public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString k public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index d8ddfad1b40c..de068c66902a 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 012e633f989c..7616d3209c20 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -69,7 +69,7 @@ public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString k public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 2d8c0b2a52f7..e566414eb6ac 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -71,7 +71,7 @@ public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString? public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index d8ddfad1b40c..de068c66902a 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 012e633f989c..7616d3209c20 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -69,7 +69,7 @@ public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString k public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 2d8c0b2a52f7..e566414eb6ac 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -71,7 +71,7 @@ public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString? public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 05ce7e5830d8..67a08dd23ebd 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/.gitignore b/samples/client/petstore/csharp/generichost/net9/AllOf/.gitignore similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/.gitignore rename to samples/client/petstore/csharp/generichost/net9/AllOf/.gitignore diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net9/AllOf/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/.openapi-generator-ignore rename to samples/client/petstore/csharp/generichost/net9/AllOf/.openapi-generator-ignore diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/AllOf/.openapi-generator/FILES new file mode 100644 index 000000000000..b9ab612bd8b5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/.openapi-generator/FILES @@ -0,0 +1,42 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/DefaultApi.md +docs/models/Adult.md +docs/models/Child.md +docs/models/Person.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/Adult.cs +src/Org.OpenAPITools/Model/Child.cs +src/Org.OpenAPITools/Model/Person.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net9/AllOf/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/.openapi-generator/VERSION rename to samples/client/petstore/csharp/generichost/net9/AllOf/.openapi-generator/VERSION diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net9/AllOf/Org.OpenAPITools.sln similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/Org.OpenAPITools.sln rename to samples/client/petstore/csharp/generichost/net9/AllOf/Org.OpenAPITools.sln diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/README.md b/samples/client/petstore/csharp/generichost/net9/AllOf/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/AllOf/api/openapi.yaml new file mode 100644 index 000000000000..a6144ccdba8c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/api/openapi.yaml @@ -0,0 +1,71 @@ +openapi: 3.0.1 +info: + license: + name: MIT + title: Example + version: 1.0.0 +servers: +- url: http://api.example.xyz/v1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + explode: false + in: path + name: personId + required: true + schema: + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK +components: + schemas: + Person: + discriminator: + mapping: + a: '#/components/schemas/Adult' + c: Child + propertyName: $_type + example: + lastName: lastName + firstName: firstName + $_type: $_type + properties: + $_type: + type: string + lastName: + type: string + firstName: + type: string + type: object + Adult: + allOf: + - $ref: '#/components/schemas/Person' + - properties: + children: + items: + $ref: '#/components/schemas/Child' + type: array + type: object + description: A representation of an adult + Child: + allOf: + - properties: + age: + format: int32 + type: integer + type: object + - $ref: '#/components/schemas/Person' + description: A representation of a child + properties: + boosterSeat: + type: boolean + diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/appveyor.yml b/samples/client/petstore/csharp/generichost/net9/AllOf/appveyor.yml similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/appveyor.yml rename to samples/client/petstore/csharp/generichost/net9/AllOf/appveyor.yml diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/apis/DefaultApi.md new file mode 100644 index 000000000000..c203cd813bb0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/apis/DefaultApi.md @@ -0,0 +1,95 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://api.example.xyz/v1* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**List**](DefaultApi.md#list) | **GET** /person/display/{personId} | | + + +# **List** +> Person List (string personId) + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class ListExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://api.example.xyz/v1"; + var apiInstance = new DefaultApi(config); + var personId = "personId_example"; // string | The id of the person to retrieve + + try + { + Person result = apiInstance.List(personId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.List: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the ListWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.ListWithHttpInfo(personId); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.ListWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **personId** | **string** | The id of the person to retrieve | | + +### Return type + +[**Person**](Person.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | OK | - | + +[[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/csharp/generichost/net9/AllOf/docs/models/Adult.md b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/models/Adult.md new file mode 100644 index 000000000000..4bf74e4efc9b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/models/Adult.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Adult +A representation of an adult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**FirstName** | **string** | | [optional] +**LastName** | **string** | | [optional] +**Type** | **string** | | [optional] +**Children** | [**List<Child>**](Child.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/docs/models/Child.md b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/models/Child.md new file mode 100644 index 000000000000..bb2a1e5a5613 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/models/Child.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Child +A representation of a child + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**FirstName** | **string** | | [optional] +**LastName** | **string** | | [optional] +**Type** | **string** | | [optional] +**Age** | **int** | | [optional] +**BoosterSeat** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/docs/models/Person.md b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/models/Person.md new file mode 100644 index 000000000000..42c19689f9a1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/models/Person.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Person + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**FirstName** | **string** | | [optional] +**LastName** | **string** | | [optional] +**Type** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..5dd80394d3fc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,58 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 000000000000..6151cce5b8b5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,65 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing DefaultApi + /// + public sealed class DefaultApiTests : ApiTestsBase + { + private readonly IDefaultApi _instance; + + public DefaultApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test List + /// + [Fact (Skip = "not implemented")] + public async Task ListAsyncTest() + { + string personId = default!; + var response = await _instance.ListAsync(personId); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..f408496be456 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,103 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Model/AdultTests.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Model/AdultTests.cs new file mode 100644 index 000000000000..31079eac9742 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Model/AdultTests.cs @@ -0,0 +1,65 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Adult + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AdultTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Adult + //private Adult instance; + + public AdultTests() + { + // TODO uncomment below to create an instance of Adult + //instance = new Adult(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Adult + /// + [Fact] + public void AdultInstanceTest() + { + // TODO uncomment below to test "IsType" Adult + //Assert.IsType(instance); + } + + /// + /// Test the property 'Children' + /// + [Fact] + public void ChildrenTest() + { + // TODO unit test for the property 'Children' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Model/ChildTests.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Model/ChildTests.cs new file mode 100644 index 000000000000..17720f6e735f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Model/ChildTests.cs @@ -0,0 +1,74 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Child + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ChildTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Child + //private Child instance; + + public ChildTests() + { + // TODO uncomment below to create an instance of Child + //instance = new Child(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Child + /// + [Fact] + public void ChildInstanceTest() + { + // TODO uncomment below to test "IsType" Child + //Assert.IsType(instance); + } + + /// + /// Test the property 'Age' + /// + [Fact] + public void AgeTest() + { + // TODO unit test for the property 'Age' + } + + /// + /// Test the property 'BoosterSeat' + /// + [Fact] + public void BoosterSeatTest() + { + // TODO unit test for the property 'BoosterSeat' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Model/PersonTests.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Model/PersonTests.cs new file mode 100644 index 000000000000..aa3fc482188d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Model/PersonTests.cs @@ -0,0 +1,103 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Person + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PersonTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Person + //private Person instance; + + public PersonTests() + { + // TODO uncomment below to create an instance of Person + //instance = new Person(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Person + /// + [Fact] + public void PersonInstanceTest() + { + // TODO uncomment below to test "IsType" Person + //Assert.IsType(instance); + } + + /// + /// Test deserialize a Adult from type Person + /// + [Fact] + public void AdultDeserializeFromPersonTest() + { + // TODO uncomment below to test deserialize a Adult from type Person + //Assert.IsType(JsonConvert.DeserializeObject(new Adult().ToJson())); + } + + /// + /// Test deserialize a Child from type Person + /// + [Fact] + public void ChildDeserializeFromPersonTest() + { + // TODO uncomment below to test deserialize a Child from type Person + //Assert.IsType(JsonConvert.DeserializeObject(new Child().ToJson())); + } + + /// + /// Test the property 'FirstName' + /// + [Fact] + public void FirstNameTest() + { + // TODO unit test for the property 'FirstName' + } + + /// + /// Test the property 'LastName' + /// + [Fact] + public void LastNameTest() + { + // TODO unit test for the property 'LastName' + } + + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..a4e283f2d333 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net9.0 + false + enable + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..910c5c211fba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,358 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IDefaultApi : IApi + { + /// + /// The class containing the events + /// + DefaultApiEvents Events { get; } + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The id of the person to retrieve + /// Cancellation Token to cancel the request. + /// <> + Task ListAsync(string personId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// The id of the person to retrieve + /// Cancellation Token to cancel the request. + /// <?> + Task ListOrDefaultAsync(string personId, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IListApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class DefaultApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnList; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorList; + + internal void ExecuteOnList(DefaultApi.ListApiResponse apiResponse) + { + OnList?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorList(Exception exception) + { + OnErrorList?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class DefaultApi : IDefaultApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public DefaultApiEvents Events { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = defaultApiEvents; + } + + partial void FormatList(ref string personId); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateList(string personId) + { + if (personId == null) + throw new ArgumentNullException(nameof(personId)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterListDefaultImplementation(IListApiResponse apiResponseLocalVar, string personId) + { + bool suppressDefaultLog = false; + AfterList(ref suppressDefaultLog, apiResponseLocalVar, personId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterList(ref bool suppressDefaultLog, IListApiResponse apiResponseLocalVar, string personId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorListDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string personId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorList(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, personId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorList(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string personId); + + /// + /// + /// + /// The id of the person to retrieve + /// Cancellation Token to cancel the request. + /// <> + public async Task ListOrDefaultAsync(string personId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await ListAsync(personId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// The id of the person to retrieve + /// Cancellation Token to cancel the request. + /// <> + public async Task ListAsync(string personId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateList(personId); + + FormatList(ref personId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/person/display/{personId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpersonId%7D", Uri.EscapeDataString(personId.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + ListApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/person/display/{personId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterListDefaultImplementation(apiResponseLocalVar, personId); + + Events.ExecuteOnList(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorListDefaultImplementation(e, "/person/display/{personId}", uriBuilderLocalVar.Path, personId); + Events.ExecuteOnErrorList(e); + throw; + } + } + + /// + /// The + /// + public partial class ListApiResponse : Org.OpenAPITools.Client.ApiResponse, IListApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public ListApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Person? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Person? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..eaf62115550f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,52 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string? ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..29ca5094b343 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,172 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string? ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri? RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string? ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri? RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk([NotNullWhen(true)]out TType? result); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..ce9f6af2b941 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,333 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using KellermanSoftware.CompareNetObjects; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// An instance of CompareLogic. + /// + public static CompareLogic compareLogic; + + /// + /// Static constructor to initialise compareLogic. + /// + static ClientUtils() + { + ComparisonConfig comparisonConfig = new(); + comparisonConfig.UseHashCodeIdentifier = true; + compareLogic = new(comparisonConfig); + } + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string? SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// 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) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string? SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://api.example.xyz/v1"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = "/v1"; + + /// + /// The host of the API + /// + public const string HOST = "api.example.xyz"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..85093b0c1fee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,20 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..f7fe93629939 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -0,0 +1,61 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..a5cb490f3ef1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -0,0 +1,66 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..79fb8600e4be --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,75 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..26d8b0757ba4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,80 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..f711f9f3c7ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..89dc36db6665 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,135 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new AdultJsonConverter()); + _jsonOptions.Converters.Add(new ChildJsonConverter()); + _jsonOptions.Converters.Add(new PersonJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action? client = null, Action? builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..0184d9ad9446 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,27 @@ +// + +#nullable enable + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..b3419229d654 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,53 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..d50991f16ec4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -0,0 +1,57 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..3f713a2ef4bb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,71 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..7b0f23d28a4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,37 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..25a52d3c7185 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,44 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..733d70fe43f1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,59 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..813775e7dcf9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -0,0 +1,79 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..c7fc843b1e4d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -0,0 +1,73 @@ +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static void AddApi(this IServiceCollection services) + { + HostConfiguration config = new(services); + AddApi(services, config); + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs new file mode 100644 index 000000000000..061761d954f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Adult.cs @@ -0,0 +1,207 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// A representation of an adult + /// + public partial class Adult : Person, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// children + /// firstName + /// lastName + [JsonConstructor] + public Adult(Option?> children = default, Option firstName = default, Option lastName = default) : base(firstName, lastName) + { + ChildrenOption = children; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Children + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ChildrenOption { get; private set; } + + /// + /// Gets or Sets Children + /// + [JsonPropertyName("children")] + public List? Children { get { return this.ChildrenOption; } set { this.ChildrenOption = new(value); } } + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string Type { get; } = "Adult"; + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Adult {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Children: ").Append(Children).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class AdultJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> children = default; + Option firstName = default; + Option lastName = default; + Option type = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "children": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + children = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "firstName": + firstName = new Option(utf8JsonReader.GetString()!); + break; + case "lastName": + lastName = new Option(utf8JsonReader.GetString()!); + break; + case "$_type": + type = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (children.IsSet && children.Value == null) + throw new ArgumentNullException(nameof(children), "Property is not nullable for class Adult."); + + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Adult."); + + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Adult."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Adult."); + + return new Adult(children, firstName, lastName); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, adult, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) + { + if (adult.ChildrenOption.IsSet && adult.Children == null) + throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult."); + + if (adult.FirstNameOption.IsSet && adult.FirstName == null) + throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult."); + + if (adult.LastNameOption.IsSet && adult.LastName == null) + throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult."); + + if (adult.ChildrenOption.IsSet) + { + writer.WritePropertyName("children"); + JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); + } + if (adult.FirstNameOption.IsSet) + writer.WriteString("firstName", adult.FirstName); + + if (adult.LastNameOption.IsSet) + writer.WriteString("lastName", adult.LastName); + + writer.WriteString("$_type", adult.Type); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs new file mode 100644 index 000000000000..94bb37a7732d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Child.cs @@ -0,0 +1,229 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// A representation of a child + /// + public partial class Child : Person, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// age + /// firstName + /// lastName + /// boosterSeat + [JsonConstructor] + public Child(Option age = default, Option firstName = default, Option lastName = default, Option boosterSeat = default) : base(firstName, lastName) + { + AgeOption = age; + BoosterSeatOption = boosterSeat; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Age + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AgeOption { get; private set; } + + /// + /// Gets or Sets Age + /// + [JsonPropertyName("age")] + public int? Age { get { return this.AgeOption; } set { this.AgeOption = new(value); } } + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string Type { get; } = "Child"; + + /// + /// Used to track the state of BoosterSeat + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BoosterSeatOption { get; private set; } + + /// + /// Gets or Sets BoosterSeat + /// + [JsonPropertyName("boosterSeat")] + public bool? BoosterSeat { get { return this.BoosterSeatOption; } set { this.BoosterSeatOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Child {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Age: ").Append(Age).Append("\n"); + sb.Append(" BoosterSeat: ").Append(BoosterSeat).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class ChildJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option age = default; + Option firstName = default; + Option lastName = default; + Option type = default; + Option boosterSeat = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "age": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + age = new Option(utf8JsonReader.GetInt32()); + break; + case "firstName": + firstName = new Option(utf8JsonReader.GetString()!); + break; + case "lastName": + lastName = new Option(utf8JsonReader.GetString()!); + break; + case "$_type": + type = new Option(utf8JsonReader.GetString()!); + break; + case "boosterSeat": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + boosterSeat = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (age.IsSet && age.Value == null) + throw new ArgumentNullException(nameof(age), "Property is not nullable for class Child."); + + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Child."); + + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Child."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Child."); + + if (boosterSeat.IsSet && boosterSeat.Value == null) + throw new ArgumentNullException(nameof(boosterSeat), "Property is not nullable for class Child."); + + return new Child(age, firstName, lastName, boosterSeat); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, child, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) + { + if (child.FirstNameOption.IsSet && child.FirstName == null) + throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child."); + + if (child.LastNameOption.IsSet && child.LastName == null) + throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child."); + + if (child.AgeOption.IsSet) + writer.WriteNumber("age", child.AgeOption.Value!.Value); + + if (child.FirstNameOption.IsSet) + writer.WriteString("firstName", child.FirstName); + + if (child.LastNameOption.IsSet) + writer.WriteString("lastName", child.LastName); + + writer.WriteString("$_type", child.Type); + + if (child.BoosterSeatOption.IsSet) + writer.WriteBoolean("boosterSeat", child.BoosterSeatOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Person.cs new file mode 100644 index 000000000000..d3f9d198830e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Model/Person.cs @@ -0,0 +1,249 @@ +// +/* + * Example + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Person + /// + public partial class Person : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// firstName + /// lastName + [JsonConstructor] + public Person(Option firstName = default, Option lastName = default) + { + FirstNameOption = firstName; + LastNameOption = lastName; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FirstNameOption { get; private set; } + + /// + /// Gets or Sets FirstName + /// + [JsonPropertyName("firstName")] + public string? FirstName { get { return this.FirstNameOption; } set { this.FirstNameOption = new(value); } } + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option LastNameOption { get; private set; } + + /// + /// Gets or Sets LastName + /// + [JsonPropertyName("lastName")] + public string? LastName { get { return this.LastNameOption; } set { this.LastNameOption = new(value); } } + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public string Type { get; } = "Person"; + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Person {\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PersonJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option firstName = default; + Option lastName = default; + Option type = default; + + string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "$_type"); + + if (discriminator != null && discriminator.Equals("Adult")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + if (discriminator != null && discriminator.Equals("Child")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "firstName": + firstName = new Option(utf8JsonReader.GetString()!); + break; + case "lastName": + lastName = new Option(utf8JsonReader.GetString()!); + break; + case "$_type": + type = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Person."); + + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Person."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Person."); + + return new Person(firstName, lastName); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) + { + if (person is Adult adult){ + JsonSerializer.Serialize(writer, adult, jsonSerializerOptions); + return; + } + + if (person is Child child){ + JsonSerializer.Serialize(writer, child, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, person, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) + { + if (person.FirstNameOption.IsSet && person.FirstName == null) + throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person."); + + if (person.LastNameOption.IsSet && person.LastName == null) + throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person."); + + if (person.FirstNameOption.IsSet) + writer.WriteString("firstName", person.FirstName); + + if (person.LastNameOption.IsSet) + writer.WriteString("lastName", person.LastName); + + writer.WriteString("$_type", person.Type); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..36cbc4f59ca3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,32 @@ + + + + true + net9.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + enable + false + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..ac43ed1f82c1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AllOf/src/Org.OpenAPITools/README.md @@ -0,0 +1,177 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net9.0', + 'validatable=true', + 'nullableReferenceTypes=true', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + ListApiResponse apiResponse = await api.ListAsync("todo"); + Person model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.11.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: Example +- appVersion: 1.0.0 +- appDescription: No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: false +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: true +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net9.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/.gitignore b/samples/client/petstore/csharp/generichost/net9/AnyOf/.gitignore similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/.gitignore rename to samples/client/petstore/csharp/generichost/net9/AnyOf/.gitignore diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net9/AnyOf/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/.openapi-generator-ignore rename to samples/client/petstore/csharp/generichost/net9/AnyOf/.openapi-generator-ignore diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/AnyOf/.openapi-generator/FILES new file mode 100644 index 000000000000..dc42a5d47091 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/.openapi-generator/FILES @@ -0,0 +1,42 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/DefaultApi.md +docs/models/Apple.md +docs/models/Banana.md +docs/models/Fruit.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/Apple.cs +src/Org.OpenAPITools/Model/Banana.cs +src/Org.OpenAPITools/Model/Fruit.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net9/AnyOf/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/.openapi-generator/VERSION rename to samples/client/petstore/csharp/generichost/net9/AnyOf/.openapi-generator/VERSION diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net9/AnyOf/Org.OpenAPITools.sln similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/Org.OpenAPITools.sln rename to samples/client/petstore/csharp/generichost/net9/AnyOf/Org.OpenAPITools.sln diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/README.md b/samples/client/petstore/csharp/generichost/net9/AnyOf/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/AnyOf/api/openapi.yaml new file mode 100644 index 000000000000..25b9adb5f50a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/api/openapi.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.1 +info: + title: fruity + version: 0.0.1 +servers: +- url: / +paths: + /: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/fruit' + description: desc +components: + schemas: + fruit: + anyOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + example: + color: color + properties: + color: + type: string + title: fruit + type: object + apple: + properties: + kind: + type: string + title: apple + type: object + banana: + properties: + count: + type: number + title: banana + type: object + diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/appveyor.yml b/samples/client/petstore/csharp/generichost/net9/AnyOf/appveyor.yml similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/appveyor.yml rename to samples/client/petstore/csharp/generichost/net9/AnyOf/appveyor.yml diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/apis/DefaultApi.md new file mode 100644 index 000000000000..bccf3af9c516 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/apis/DefaultApi.md @@ -0,0 +1,90 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**RootGet**](DefaultApi.md#rootget) | **GET** / | | + + +# **RootGet** +> Fruit RootGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class RootGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://localhost"; + var apiInstance = new DefaultApi(config); + + try + { + Fruit result = apiInstance.RootGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.RootGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the RootGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.RootGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.RootGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**Fruit**](Fruit.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | desc | - | + +[[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/csharp/generichost/net9/AnyOf/docs/models/Apple.md b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/models/Apple.md new file mode 100644 index 000000000000..95f575834399 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/models/Apple.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kind** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/models/Banana.md b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/models/Banana.md new file mode 100644 index 000000000000..c9aea6fb56c8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/models/Banana.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Count** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/models/Fruit.md b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/models/Fruit.md new file mode 100644 index 000000000000..b3bee18f7ba0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/models/Fruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Fruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..5a82cd6c99de --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,58 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 000000000000..b7bcc281037a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,64 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing DefaultApi + /// + public sealed class DefaultApiTests : ApiTestsBase + { + private readonly IDefaultApi _instance; + + public DefaultApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test RootGet + /// + [Fact (Skip = "not implemented")] + public async Task RootGetAsyncTest() + { + var response = await _instance.RootGetAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..4006d2fc6ba6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,103 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Model/AppleTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Model/AppleTests.cs new file mode 100644 index 000000000000..483628b6a4a0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Model/AppleTests.cs @@ -0,0 +1,65 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Apple + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Apple + //private Apple instance; + + public AppleTests() + { + // TODO uncomment below to create an instance of Apple + //instance = new Apple(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Apple + /// + [Fact] + public void AppleInstanceTest() + { + // TODO uncomment below to test "IsType" Apple + //Assert.IsType(instance); + } + + /// + /// Test the property 'Kind' + /// + [Fact] + public void KindTest() + { + // TODO unit test for the property 'Kind' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Model/BananaTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Model/BananaTests.cs new file mode 100644 index 000000000000..5befec8d7e5f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Model/BananaTests.cs @@ -0,0 +1,65 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Banana + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Banana + //private Banana instance; + + public BananaTests() + { + // TODO uncomment below to create an instance of Banana + //instance = new Banana(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Banana + /// + [Fact] + public void BananaInstanceTest() + { + // TODO uncomment below to test "IsType" Banana + //Assert.IsType(instance); + } + + /// + /// Test the property 'Count' + /// + [Fact] + public void CountTest() + { + // TODO unit test for the property 'Count' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Model/FruitTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Model/FruitTests.cs new file mode 100644 index 000000000000..a6607ae5d56d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Model/FruitTests.cs @@ -0,0 +1,65 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Fruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Fruit + //private Fruit instance; + + public FruitTests() + { + // TODO uncomment below to create an instance of Fruit + //instance = new Fruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Fruit + /// + [Fact] + public void FruitInstanceTest() + { + // TODO uncomment below to test "IsType" Fruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..a4e283f2d333 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net9.0 + false + enable + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..030cc3bf12e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,332 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IDefaultApi : IApi + { + /// + /// The class containing the events + /// + DefaultApiEvents Events { get; } + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task RootGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task RootGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IRootGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class DefaultApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnRootGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorRootGet; + + internal void ExecuteOnRootGet(DefaultApi.RootGetApiResponse apiResponse) + { + OnRootGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorRootGet(Exception exception) + { + OnErrorRootGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class DefaultApi : IDefaultApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public DefaultApiEvents Events { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = defaultApiEvents; + } + + /// + /// Processes the server response + /// + /// + private void AfterRootGetDefaultImplementation(IRootGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterRootGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterRootGet(ref bool suppressDefaultLog, IRootGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorRootGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorRootGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorRootGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task RootGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await RootGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task RootGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + RootGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/", requestedAtLocalVar, _jsonSerializerOptions); + + AfterRootGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnRootGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorRootGetDefaultImplementation(e, "/", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorRootGet(e); + throw; + } + } + + /// + /// The + /// + public partial class RootGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IRootGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public RootGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Fruit? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Fruit? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..6ca1d86d4a35 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,52 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string? ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..2675478b8b4f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,172 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string? ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri? RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string? ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri? RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk([NotNullWhen(true)]out TType? result); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..17060612c0b4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,333 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using KellermanSoftware.CompareNetObjects; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// An instance of CompareLogic. + /// + public static CompareLogic compareLogic; + + /// + /// Static constructor to initialise compareLogic. + /// + static ClientUtils() + { + ComparisonConfig comparisonConfig = new(); + comparisonConfig.UseHashCodeIdentifier = true; + compareLogic = new(comparisonConfig); + } + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string? SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// 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) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string? SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://localhost"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = ""; + + /// + /// The host of the API + /// + public const string HOST = "localhost"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..85093b0c1fee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,20 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..5009ae5304f7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -0,0 +1,61 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..02dda463ab26 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -0,0 +1,66 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..4be8e3a725e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,75 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..06d46536f037 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,80 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..f711f9f3c7ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..0cffc3195908 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,135 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new AppleJsonConverter()); + _jsonOptions.Converters.Add(new BananaJsonConverter()); + _jsonOptions.Converters.Add(new FruitJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action? client = null, Action? builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..0184d9ad9446 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,27 @@ +// + +#nullable enable + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..6f4db75a4454 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,53 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..b10d5ac58f56 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -0,0 +1,57 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..3f713a2ef4bb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,71 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..7b0f23d28a4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,37 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..db3ce767d4af --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,44 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..f0f8143d7f5e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,59 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..d6540c10a71f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -0,0 +1,79 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..387a17e202fc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -0,0 +1,73 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static void AddApi(this IServiceCollection services) + { + HostConfiguration config = new(services); + AddApi(services, config); + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Apple.cs new file mode 100644 index 000000000000..dd3528fa42a4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -0,0 +1,176 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Apple + /// + public partial class Apple : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// kind + [JsonConstructor] + public Apple(Option kind = default) + { + KindOption = kind; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Kind + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option KindOption { get; private set; } + + /// + /// Gets or Sets Kind + /// + [JsonPropertyName("kind")] + public string? Kind { get { return this.KindOption; } set { this.KindOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Apple {\n"); + sb.Append(" Kind: ").Append(Kind).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option kind = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "kind": + kind = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (kind.IsSet && kind.Value == null) + throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); + + return new Apple(kind); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apple, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + if (apple.KindOption.IsSet && apple.Kind == null) + throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + + if (apple.KindOption.IsSet) + writer.WriteString("kind", apple.Kind); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs new file mode 100644 index 000000000000..66a33723aebc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -0,0 +1,174 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Banana + /// + public partial class Banana : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// count + [JsonConstructor] + public Banana(Option count = default) + { + CountOption = count; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Count + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CountOption { get; private set; } + + /// + /// Gets or Sets Count + /// + [JsonPropertyName("count")] + public decimal? Count { get { return this.CountOption; } set { this.CountOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Banana {\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option count = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "count": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + count = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (count.IsSet && count.Value == null) + throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); + + return new Banana(count); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, banana, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + if (banana.CountOption.IsSet) + writer.WriteNumber("count", banana.CountOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs new file mode 100644 index 000000000000..64a206e3bd57 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -0,0 +1,244 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Fruit + /// + public partial class Fruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// color + public Fruit(Option apple, Option banana, Option color = default) + { + AppleOption = apple; + BananaOption = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AppleOption { get; private set; } + + /// + /// Gets or Sets Apple + /// + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BananaOption { get; private set; } + + /// + /// Gets or Sets Banana + /// + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Fruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple? apple = default; + Banana? banana = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new Fruit(appleParsedValue, bananaParsedValue, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (fruit.AppleOption.IsSet && fruit.AppleOption.Value != null) + { + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(writer, fruit.AppleOption.Value, jsonSerializerOptions); + } + + if (fruit.BananaOption.IsSet && fruit.BananaOption.Value != null) + { + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(writer, fruit.BananaOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, fruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..36cbc4f59ca3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,32 @@ + + + + true + net9.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + enable + false + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..0c161ca9de17 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOf/src/Org.OpenAPITools/README.md @@ -0,0 +1,177 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net9.0', + 'validatable=true', + 'nullableReferenceTypes=true', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + RootGetApiResponse apiResponse = await api.RootGetAsync("todo"); + Fruit model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.11.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: fruity +- appVersion: 0.0.1 +- appDescription: No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: false +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: true +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net9.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/.gitignore b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/.gitignore similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/.gitignore rename to samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/.gitignore diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/.openapi-generator-ignore similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/.openapi-generator-ignore rename to samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/.openapi-generator-ignore diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/.openapi-generator/FILES new file mode 100644 index 000000000000..dc42a5d47091 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/.openapi-generator/FILES @@ -0,0 +1,42 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/DefaultApi.md +docs/models/Apple.md +docs/models/Banana.md +docs/models/Fruit.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/Apple.cs +src/Org.OpenAPITools/Model/Banana.cs +src/Org.OpenAPITools/Model/Fruit.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/.openapi-generator/VERSION rename to samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/.openapi-generator/VERSION diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/Org.OpenAPITools.sln similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/Org.OpenAPITools.sln rename to samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/Org.OpenAPITools.sln diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/README.md b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/api/openapi.yaml new file mode 100644 index 000000000000..25b9adb5f50a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/api/openapi.yaml @@ -0,0 +1,42 @@ +openapi: 3.0.1 +info: + title: fruity + version: 0.0.1 +servers: +- url: / +paths: + /: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/fruit' + description: desc +components: + schemas: + fruit: + anyOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + example: + color: color + properties: + color: + type: string + title: fruit + type: object + apple: + properties: + kind: + type: string + title: apple + type: object + banana: + properties: + count: + type: number + title: banana + type: object + diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/appveyor.yml b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/appveyor.yml similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/appveyor.yml rename to samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/appveyor.yml diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/apis/DefaultApi.md new file mode 100644 index 000000000000..bccf3af9c516 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/apis/DefaultApi.md @@ -0,0 +1,90 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**RootGet**](DefaultApi.md#rootget) | **GET** / | | + + +# **RootGet** +> Fruit RootGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class RootGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://localhost"; + var apiInstance = new DefaultApi(config); + + try + { + Fruit result = apiInstance.RootGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.RootGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the RootGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.RootGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.RootGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**Fruit**](Fruit.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | desc | - | + +[[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/csharp/generichost/net9/AnyOfNoCompare/docs/models/Apple.md b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/models/Apple.md new file mode 100644 index 000000000000..95f575834399 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/models/Apple.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kind** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/models/Banana.md b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/models/Banana.md new file mode 100644 index 000000000000..c9aea6fb56c8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/models/Banana.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Count** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/models/Fruit.md b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/models/Fruit.md new file mode 100644 index 000000000000..b3bee18f7ba0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/models/Fruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Fruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..5a82cd6c99de --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,58 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 000000000000..b7bcc281037a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,64 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing DefaultApi + /// + public sealed class DefaultApiTests : ApiTestsBase + { + private readonly IDefaultApi _instance; + + public DefaultApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test RootGet + /// + [Fact (Skip = "not implemented")] + public async Task RootGetAsyncTest() + { + var response = await _instance.RootGetAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..4006d2fc6ba6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,103 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Model/AppleTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Model/AppleTests.cs new file mode 100644 index 000000000000..483628b6a4a0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Model/AppleTests.cs @@ -0,0 +1,65 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Apple + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Apple + //private Apple instance; + + public AppleTests() + { + // TODO uncomment below to create an instance of Apple + //instance = new Apple(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Apple + /// + [Fact] + public void AppleInstanceTest() + { + // TODO uncomment below to test "IsType" Apple + //Assert.IsType(instance); + } + + /// + /// Test the property 'Kind' + /// + [Fact] + public void KindTest() + { + // TODO unit test for the property 'Kind' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Model/BananaTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Model/BananaTests.cs new file mode 100644 index 000000000000..5befec8d7e5f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Model/BananaTests.cs @@ -0,0 +1,65 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Banana + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Banana + //private Banana instance; + + public BananaTests() + { + // TODO uncomment below to create an instance of Banana + //instance = new Banana(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Banana + /// + [Fact] + public void BananaInstanceTest() + { + // TODO uncomment below to test "IsType" Banana + //Assert.IsType(instance); + } + + /// + /// Test the property 'Count' + /// + [Fact] + public void CountTest() + { + // TODO unit test for the property 'Count' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Model/FruitTests.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Model/FruitTests.cs new file mode 100644 index 000000000000..a6607ae5d56d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Model/FruitTests.cs @@ -0,0 +1,65 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Fruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Fruit + //private Fruit instance; + + public FruitTests() + { + // TODO uncomment below to create an instance of Fruit + //instance = new Fruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Fruit + /// + [Fact] + public void FruitInstanceTest() + { + // TODO uncomment below to test "IsType" Fruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..a4e283f2d333 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net9.0 + false + enable + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..030cc3bf12e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,332 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IDefaultApi : IApi + { + /// + /// The class containing the events + /// + DefaultApiEvents Events { get; } + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task RootGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task RootGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IRootGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class DefaultApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnRootGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorRootGet; + + internal void ExecuteOnRootGet(DefaultApi.RootGetApiResponse apiResponse) + { + OnRootGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorRootGet(Exception exception) + { + OnErrorRootGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class DefaultApi : IDefaultApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public DefaultApiEvents Events { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = defaultApiEvents; + } + + /// + /// Processes the server response + /// + /// + private void AfterRootGetDefaultImplementation(IRootGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterRootGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterRootGet(ref bool suppressDefaultLog, IRootGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorRootGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorRootGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorRootGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task RootGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await RootGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task RootGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + RootGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/", requestedAtLocalVar, _jsonSerializerOptions); + + AfterRootGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnRootGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorRootGetDefaultImplementation(e, "/", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorRootGet(e); + throw; + } + } + + /// + /// The + /// + public partial class RootGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IRootGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public RootGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Fruit? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Fruit? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..6ca1d86d4a35 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,52 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string? ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..2675478b8b4f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,172 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string? ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri? RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string? ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri? RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk([NotNullWhen(true)]out TType? result); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..b19e837fb7e6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,318 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string? SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// 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) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string? SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://localhost"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = ""; + + /// + /// The host of the API + /// + public const string HOST = "localhost"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..85093b0c1fee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,20 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..5009ae5304f7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -0,0 +1,61 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..02dda463ab26 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -0,0 +1,66 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..4be8e3a725e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,75 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..06d46536f037 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,80 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..f711f9f3c7ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..0cffc3195908 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,135 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new AppleJsonConverter()); + _jsonOptions.Converters.Add(new BananaJsonConverter()); + _jsonOptions.Converters.Add(new FruitJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action? client = null, Action? builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..0184d9ad9446 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,27 @@ +// + +#nullable enable + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..6f4db75a4454 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,53 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..b10d5ac58f56 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -0,0 +1,57 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..3f713a2ef4bb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,71 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..7b0f23d28a4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,37 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..db3ce767d4af --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,44 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..f0f8143d7f5e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,59 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..d6540c10a71f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -0,0 +1,79 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..387a17e202fc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -0,0 +1,73 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static void AddApi(this IServiceCollection services) + { + HostConfiguration config = new(services); + AddApi(services, config); + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs new file mode 100644 index 000000000000..8531edebf731 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Apple.cs @@ -0,0 +1,175 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Apple + /// + public partial class Apple : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// kind + [JsonConstructor] + public Apple(Option kind = default) + { + KindOption = kind; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Kind + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option KindOption { get; private set; } + + /// + /// Gets or Sets Kind + /// + [JsonPropertyName("kind")] + public string? Kind { get { return this.KindOption; } set { this.KindOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Apple {\n"); + sb.Append(" Kind: ").Append(Kind).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option kind = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "kind": + kind = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (kind.IsSet && kind.Value == null) + throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); + + return new Apple(kind); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apple, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + if (apple.KindOption.IsSet && apple.Kind == null) + throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + + if (apple.KindOption.IsSet) + writer.WriteString("kind", apple.Kind); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs new file mode 100644 index 000000000000..36e0ac854e6d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Banana.cs @@ -0,0 +1,173 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Banana + /// + public partial class Banana : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// count + [JsonConstructor] + public Banana(Option count = default) + { + CountOption = count; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Count + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CountOption { get; private set; } + + /// + /// Gets or Sets Count + /// + [JsonPropertyName("count")] + public decimal? Count { get { return this.CountOption; } set { this.CountOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Banana {\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option count = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "count": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + count = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (count.IsSet && count.Value == null) + throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); + + return new Banana(count); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, banana, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + if (banana.CountOption.IsSet) + writer.WriteNumber("count", banana.CountOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs new file mode 100644 index 000000000000..73c92d0cded3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Model/Fruit.cs @@ -0,0 +1,243 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Fruit + /// + public partial class Fruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// color + public Fruit(Option apple, Option banana, Option color = default) + { + AppleOption = apple; + BananaOption = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AppleOption { get; private set; } + + /// + /// Gets or Sets Apple + /// + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BananaOption { get; private set; } + + /// + /// Gets or Sets Banana + /// + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Fruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple? apple = default; + Banana? banana = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new Fruit(appleParsedValue, bananaParsedValue, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (fruit.AppleOption.IsSet && fruit.AppleOption.Value != null) + { + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(writer, fruit.AppleOption.Value, jsonSerializerOptions); + } + + if (fruit.BananaOption.IsSet && fruit.BananaOption.Value != null) + { + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(writer, fruit.BananaOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, fruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..5e475211af94 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,31 @@ + + + + true + net9.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + enable + false + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..664ba80e8daa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/AnyOfNoCompare/src/Org.OpenAPITools/README.md @@ -0,0 +1,176 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net9.0', + 'validatable=true', + 'nullableReferenceTypes=true', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + RootGetApiResponse apiResponse = await api.RootGetAsync("todo"); + Fruit model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.11.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: fruity +- appVersion: 0.0.1 +- appDescription: No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: false +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: true +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net9.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/.gitignore b/samples/client/petstore/csharp/generichost/net9/FormModels/.gitignore similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/.gitignore rename to samples/client/petstore/csharp/generichost/net9/FormModels/.gitignore diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator/FILES new file mode 100644 index 000000000000..bc72f8c05ba1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator/FILES @@ -0,0 +1,292 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/AnotherFakeApi.md +docs/apis/DefaultApi.md +docs/apis/FakeApi.md +docs/apis/FakeClassnameTags123Api.md +docs/apis/PetApi.md +docs/apis/StoreApi.md +docs/apis/UserApi.md +docs/models/Activity.md +docs/models/ActivityOutputElementRepresentation.md +docs/models/AdditionalPropertiesClass.md +docs/models/Animal.md +docs/models/ApiResponse.md +docs/models/Apple.md +docs/models/AppleReq.md +docs/models/ArrayOfArrayOfNumberOnly.md +docs/models/ArrayOfNumberOnly.md +docs/models/ArrayTest.md +docs/models/Banana.md +docs/models/BananaReq.md +docs/models/BasquePig.md +docs/models/Capitalization.md +docs/models/Cat.md +docs/models/Category.md +docs/models/ChildCat.md +docs/models/ChildCatAllOfPetType.md +docs/models/ClassModel.md +docs/models/ComplexQuadrilateral.md +docs/models/DanishPig.md +docs/models/DateOnlyClass.md +docs/models/DeprecatedObject.md +docs/models/Dog.md +docs/models/Drawing.md +docs/models/EnumArrays.md +docs/models/EnumArraysArrayEnumInner.md +docs/models/EnumArraysJustSymbol.md +docs/models/EnumClass.md +docs/models/EnumTest.md +docs/models/EnumTestEnumInteger.md +docs/models/EnumTestEnumIntegerOnly.md +docs/models/EnumTestEnumString.md +docs/models/EquilateralTriangle.md +docs/models/File.md +docs/models/FileSchemaTestClass.md +docs/models/FindPetsByStatusStatusParameterInner.md +docs/models/Foo.md +docs/models/FooGetDefaultResponse.md +docs/models/FormatTest.md +docs/models/Fruit.md +docs/models/FruitReq.md +docs/models/GmFruit.md +docs/models/GrandparentAnimal.md +docs/models/HasOnlyReadOnly.md +docs/models/HealthCheckResult.md +docs/models/IsoscelesTriangle.md +docs/models/List.md +docs/models/LiteralStringClass.md +docs/models/Mammal.md +docs/models/MapTest.md +docs/models/MapTestMapOfEnumStringValue.md +docs/models/MixLog.md +docs/models/MixedAnyOf.md +docs/models/MixedAnyOfContent.md +docs/models/MixedOneOf.md +docs/models/MixedOneOfContent.md +docs/models/MixedPropertiesAndAdditionalPropertiesClass.md +docs/models/MixedSubId.md +docs/models/Model200Response.md +docs/models/ModelClient.md +docs/models/Name.md +docs/models/NotificationtestGetElementsV1ResponseMPayload.md +docs/models/NullableClass.md +docs/models/NullableGuidClass.md +docs/models/NullableShape.md +docs/models/NumberOnly.md +docs/models/ObjectWithDeprecatedFields.md +docs/models/OneOfString.md +docs/models/Order.md +docs/models/OrderStatus.md +docs/models/OuterComposite.md +docs/models/OuterEnum.md +docs/models/OuterEnumDefaultValue.md +docs/models/OuterEnumInteger.md +docs/models/OuterEnumIntegerDefaultValue.md +docs/models/OuterEnumTest.md +docs/models/ParentPet.md +docs/models/Pet.md +docs/models/PetStatus.md +docs/models/Pig.md +docs/models/PolymorphicProperty.md +docs/models/Quadrilateral.md +docs/models/QuadrilateralInterface.md +docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md +docs/models/RequiredClassRequiredNotnullableEnumInteger.md +docs/models/RequiredClassRequiredNotnullableEnumIntegerOnly.md +docs/models/RequiredClassRequiredNotnullableEnumString.md +docs/models/RequiredClassRequiredNullableEnumInteger.md +docs/models/RequiredClassRequiredNullableEnumIntegerOnly.md +docs/models/RequiredClassRequiredNullableEnumString.md +docs/models/Return.md +docs/models/RolesReportsHash.md +docs/models/RolesReportsHashRole.md +docs/models/ScaleneTriangle.md +docs/models/Shape.md +docs/models/ShapeInterface.md +docs/models/ShapeOrNull.md +docs/models/SimpleQuadrilateral.md +docs/models/SpecialModelName.md +docs/models/Tag.md +docs/models/TestCollectionEndingWithWordList.md +docs/models/TestCollectionEndingWithWordListObject.md +docs/models/TestEnumParametersEnumHeaderStringParameter.md +docs/models/TestEnumParametersEnumQueryDoubleParameter.md +docs/models/TestEnumParametersEnumQueryIntegerParameter.md +docs/models/TestEnumParametersRequestEnumFormString.md +docs/models/TestEnumParametersRequestEnumFormStringArrayInner.md +docs/models/TestInlineFreeformAdditionalPropertiesRequest.md +docs/models/Triangle.md +docs/models/TriangleInterface.md +docs/models/User.md +docs/models/Whale.md +docs/models/Zebra.md +docs/models/ZebraType.md +docs/models/ZeroBasedEnum.md +docs/models/ZeroBasedEnumClass.md +docs/models/ZeroBasedEnumClassZeroBasedEnum.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/AnotherFakeApi.cs +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/FakeApi.cs +src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Api/PetApi.cs +src/Org.OpenAPITools/Api/StoreApi.cs +src/Org.OpenAPITools/Api/UserApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiKeyToken.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/BasicToken.cs +src/Org.OpenAPITools/Client/BearerToken.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +src/Org.OpenAPITools/Client/HttpSigningToken.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/OAuthToken.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/Activity.cs +src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/Animal.cs +src/Org.OpenAPITools/Model/ApiResponse.cs +src/Org.OpenAPITools/Model/Apple.cs +src/Org.OpenAPITools/Model/AppleReq.cs +src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayTest.cs +src/Org.OpenAPITools/Model/Banana.cs +src/Org.OpenAPITools/Model/BananaReq.cs +src/Org.OpenAPITools/Model/BasquePig.cs +src/Org.OpenAPITools/Model/Capitalization.cs +src/Org.OpenAPITools/Model/Cat.cs +src/Org.OpenAPITools/Model/Category.cs +src/Org.OpenAPITools/Model/ChildCat.cs +src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs +src/Org.OpenAPITools/Model/ClassModel.cs +src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +src/Org.OpenAPITools/Model/DanishPig.cs +src/Org.OpenAPITools/Model/DateOnlyClass.cs +src/Org.OpenAPITools/Model/DeprecatedObject.cs +src/Org.OpenAPITools/Model/Dog.cs +src/Org.OpenAPITools/Model/Drawing.cs +src/Org.OpenAPITools/Model/EnumArrays.cs +src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs +src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs +src/Org.OpenAPITools/Model/EnumClass.cs +src/Org.OpenAPITools/Model/EnumTest.cs +src/Org.OpenAPITools/Model/EnumTestEnumInteger.cs +src/Org.OpenAPITools/Model/EnumTestEnumIntegerOnly.cs +src/Org.OpenAPITools/Model/EnumTestEnumString.cs +src/Org.OpenAPITools/Model/EquilateralTriangle.cs +src/Org.OpenAPITools/Model/File.cs +src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +src/Org.OpenAPITools/Model/FindPetsByStatusStatusParameterInner.cs +src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +src/Org.OpenAPITools/Model/FormatTest.cs +src/Org.OpenAPITools/Model/Fruit.cs +src/Org.OpenAPITools/Model/FruitReq.cs +src/Org.OpenAPITools/Model/GmFruit.cs +src/Org.OpenAPITools/Model/GrandparentAnimal.cs +src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +src/Org.OpenAPITools/Model/HealthCheckResult.cs +src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs +src/Org.OpenAPITools/Model/Mammal.cs +src/Org.OpenAPITools/Model/MapTest.cs +src/Org.OpenAPITools/Model/MapTestMapOfEnumStringValue.cs +src/Org.OpenAPITools/Model/MixLog.cs +src/Org.OpenAPITools/Model/MixedAnyOf.cs +src/Org.OpenAPITools/Model/MixedAnyOfContent.cs +src/Org.OpenAPITools/Model/MixedOneOf.cs +src/Org.OpenAPITools/Model/MixedOneOfContent.cs +src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/MixedSubId.cs +src/Org.OpenAPITools/Model/Model200Response.cs +src/Org.OpenAPITools/Model/ModelClient.cs +src/Org.OpenAPITools/Model/Name.cs +src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +src/Org.OpenAPITools/Model/NullableClass.cs +src/Org.OpenAPITools/Model/NullableGuidClass.cs +src/Org.OpenAPITools/Model/NullableShape.cs +src/Org.OpenAPITools/Model/NumberOnly.cs +src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +src/Org.OpenAPITools/Model/OneOfString.cs +src/Org.OpenAPITools/Model/Order.cs +src/Org.OpenAPITools/Model/OrderStatus.cs +src/Org.OpenAPITools/Model/OuterComposite.cs +src/Org.OpenAPITools/Model/OuterEnum.cs +src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumInteger.cs +src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumTest.cs +src/Org.OpenAPITools/Model/ParentPet.cs +src/Org.OpenAPITools/Model/Pet.cs +src/Org.OpenAPITools/Model/PetStatus.cs +src/Org.OpenAPITools/Model/Pig.cs +src/Org.OpenAPITools/Model/PolymorphicProperty.cs +src/Org.OpenAPITools/Model/Quadrilateral.cs +src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs +src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumInteger.cs +src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumIntegerOnly.cs +src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumString.cs +src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumInteger.cs +src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumIntegerOnly.cs +src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumString.cs +src/Org.OpenAPITools/Model/Return.cs +src/Org.OpenAPITools/Model/RolesReportsHash.cs +src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +src/Org.OpenAPITools/Model/ScaleneTriangle.cs +src/Org.OpenAPITools/Model/Shape.cs +src/Org.OpenAPITools/Model/ShapeInterface.cs +src/Org.OpenAPITools/Model/ShapeOrNull.cs +src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +src/Org.OpenAPITools/Model/SpecialModelName.cs +src/Org.OpenAPITools/Model/Tag.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +src/Org.OpenAPITools/Model/TestEnumParametersEnumHeaderStringParameter.cs +src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryDoubleParameter.cs +src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs +src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormString.cs +src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormStringArrayInner.cs +src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +src/Org.OpenAPITools/Model/Triangle.cs +src/Org.OpenAPITools/Model/TriangleInterface.cs +src/Org.OpenAPITools/Model/User.cs +src/Org.OpenAPITools/Model/Whale.cs +src/Org.OpenAPITools/Model/Zebra.cs +src/Org.OpenAPITools/Model/ZebraType.cs +src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClassZeroBasedEnum.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator/VERSION similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/.openapi-generator/VERSION rename to samples/client/petstore/csharp/generichost/net9/FormModels/.openapi-generator/VERSION diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net9/FormModels/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/README.md b/samples/client/petstore/csharp/generichost/net9/FormModels/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml new file mode 100644 index 000000000000..6b2a30f1db4c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml @@ -0,0 +1,3064 @@ +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: + /roles/report: + get: + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/RolesReport' + type: array + description: returns report + /hello: + get: + description: Hello + operationId: Hello + responses: + "200": + content: + application/json: + schema: + items: + format: uuid + type: string + type: array + description: UUIDs + summary: Hello + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/_foo_get_default_response' + description: response + /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 + 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 + 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: + $ref: '#/components/schemas/findPetsByStatus_status_parameter_inner' + type: array + style: form + responses: + "2XX": + description: Anything within 200-299 + "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 + "4XX": + description: Anything within 400-499 + security: + - http_signature_test: [] + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /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 + /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 + 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: [] + - api_key_query: [] + summary: Find pet by ID + tags: + - pet + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/updatePetWithForm_request' + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + 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 + /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 + /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 + /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 + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate 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 + /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 + /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 + /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 + /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: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + 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 + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /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 + 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 + "598": + description: Not a real HTTP status code + "599": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Not a real HTTP status code with a return object + summary: Get user by user name + tags: + - user + 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 + /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#$%^ + /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: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + 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: + $ref: '#/components/schemas/testEnumParameters_request_enum_form_string_array_inner' + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + $ref: '#/components/schemas/testEnumParameters_enum_header_string_parameter' + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + $ref: '#/components/schemas/testEnumParameters_request_enum_form_string_array_inner' + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + $ref: '#/components/schemas/testEnumParameters_enum_header_string_parameter' + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + $ref: '#/components/schemas/testEnumParameters_enum_query_integer_parameter' + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + $ref: '#/components/schemas/testEnumParameters_enum_query_double_parameter' + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEnumParameters_request' + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + 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 + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEndpointParameters_request' + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + /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 + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + parameters: + - description: Required UUID String + explode: true + in: query + name: required_string_uuid + required: true + schema: + format: uuid + type: string + style: form + 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 + /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 + /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 + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testJsonFormData_request' + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MapOfString' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + /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 + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/testInlineFreeformAdditionalProperties_request' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + /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 + /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? + /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 + /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 + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form + responses: + "200": + description: Success + tags: + - fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFileWithRequiredFile_request' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + /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 + /fake/mixed/anyOf: + get: + operationId: getMixedAnyOf + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MixedAnyOf' + description: Got mixed anyOf + summary: Test mixed type anyOf deserialization + tags: + - fake + /fake/mixed/oneOf: + get: + operationId: getMixedOneOf + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MixedOneOf' + description: Got mixed oneOf + summary: Test mixed type oneOf deserialization + tags: + - fake + /country: + post: + operationId: getCountry + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/getCountry_request' + responses: + "200": + description: OK + /test: + get: + operationId: Test + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/notificationtest-getElements-v1-Response-mPayload' + description: Successful response + summary: Retrieve an existing Notificationtest's Elements +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 + schemas: + RolesReport: + description: Roles report + items: + $ref: '#/components/schemas/RolesReportsHash' + type: array + RolesReportsHash: + description: Role report Hash + example: + role: + name: name + role_uuid: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + role_uuid: + format: uuid + type: string + role: + $ref: '#/components/schemas/RolesReportsHash_role' + type: object + 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: + $ref: '#/components/schemas/Order_status' + 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: + $ref: '#/components/schemas/Pet_status' + 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 + lock: + type: string + abstract: + nullable: true + type: string + unsafe: + type: string + required: + - abstract + - lock + 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' + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' + - properties: + declawed: + type: boolean + type: object + 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 + int32Range: + maximum: 2147483647 + minimum: -2147483648 + type: integer + int64Positive: + minimum: 2147483648 + type: integer + int64Negative: + maximum: -2147483649 + type: integer + int64PositiveExclusive: + exclusiveMinimum: true + minimum: 2147483647 + type: integer + int64NegativeExclusive: + exclusiveMaximum: true + maximum: -2147483648 + type: integer + unsigned_integer: + format: int32 + maximum: 200 + minimum: 20 + type: integer + x-unsigned: true + int64: + format: int64 + type: integer + unsigned_long: + format: int64 + type: integer + x-unsigned: true + 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 + pattern_with_backslash: + description: None + pattern: "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\\\ + /([0-9]|[1-2][0-9]|3[0-2]))$" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Outer_Enum_Test: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + type: string + Enum_Test: + properties: + enum_string: + $ref: '#/components/schemas/Enum_Test_enum_string' + enum_string_required: + $ref: '#/components/schemas/Enum_Test_enum_string' + enum_integer: + $ref: '#/components/schemas/Enum_Test_enum_integer' + enum_integer_only: + $ref: '#/components/schemas/Enum_Test_enum_integer_only' + enum_number: + $ref: '#/components/schemas/testEnumParameters_enum_query_double_parameter' + 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_with_pattern: + format: uuid + pattern: "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + type: string + 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: + $ref: '#/components/schemas/MapTest_map_of_enum_string_value' + 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 + x-cls-compliant: true + x-com-visible: true + 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: + $ref: '#/components/schemas/EnumArrays_just_symbol' + array_enum: + items: + $ref: '#/components/schemas/EnumArrays_array_enum_inner' + type: array + type: object + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + 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 + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + $ref: '#/components/schemas/RequiredClass_required_nullable_enum_integer' + required_notnullable_enum_integer: + $ref: '#/components/schemas/RequiredClass_required_notnullable_enum_integer' + notrequired_nullable_enum_integer: + $ref: '#/components/schemas/RequiredClass_required_nullable_enum_integer' + notrequired_notnullable_enum_integer: + $ref: '#/components/schemas/RequiredClass_required_notnullable_enum_integer' + required_nullable_enum_integer_only: + $ref: '#/components/schemas/RequiredClass_required_nullable_enum_integer_only' + required_notnullable_enum_integer_only: + $ref: '#/components/schemas/RequiredClass_required_notnullable_enum_integer_only' + notrequired_nullable_enum_integer_only: + $ref: '#/components/schemas/RequiredClass_required_nullable_enum_integer_only' + notrequired_notnullable_enum_integer_only: + $ref: '#/components/schemas/RequiredClass_required_notnullable_enum_integer_only' + required_notnullable_enum_string: + $ref: '#/components/schemas/RequiredClass_required_notnullable_enum_string' + required_nullable_enum_string: + $ref: '#/components/schemas/RequiredClass_required_nullable_enum_string' + notrequired_nullable_enum_string: + $ref: '#/components/schemas/RequiredClass_required_nullable_enum_string' + notrequired_notnullable_enum_string: + $ref: '#/components/schemas/RequiredClass_required_notnullable_enum_string' + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + 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 + color_code: + pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$" + 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: + $ref: '#/components/schemas/zebra_type' + 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 + nullable: true + oneOf: + - $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 + nullable: true + oneOf: + - $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' + - properties: + name: + type: string + pet_type: + $ref: '#/components/schemas/ChildCat_allOf_pet_type' + required: + - pet_type + type: object + 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 + PolymorphicProperty: + oneOf: + - type: boolean + - type: string + - type: object + - items: + $ref: '#/components/schemas/StringArrayItem' + type: array + StringArrayItem: + format: string + type: string + Activity: + description: test map of maps + properties: + activity_outputs: + additionalProperties: + $ref: '#/components/schemas/ActivityOutputRepresentation' + type: object + type: object + ActivityOutputRepresentation: + items: + $ref: '#/components/schemas/ActivityOutputElementRepresentation' + type: array + ActivityOutputElementRepresentation: + properties: + prop1: + type: string + prop2: + type: object + type: object + NullableGuidClass: + properties: + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + type: object + DateOnlyClass: + properties: + dateOnlyProperty: + example: 2017-07-21 + format: date + type: string + type: object + TestCollectionEndingWithWordListObject: + properties: + TestCollectionEndingWithWordList: + items: + $ref: '#/components/schemas/TestCollectionEndingWithWordList' + type: array + type: object + TestCollectionEndingWithWordList: + properties: + value: + type: string + type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object + OneOfString: + oneOf: + - pattern: ^a + type: string + - pattern: ^b + type: string + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + $ref: '#/components/schemas/ZeroBasedEnumClass_ZeroBasedEnum' + type: object + Custom-Variableobject-Response: + additionalProperties: true + description: A Variable object without predefined property names + type: object + Field-pkiNotificationtestID: + type: integer + notificationtest-getElements-v1-Response-mPayload: + example: + a_objVariableobject: + - null + - null + pkiNotificationtestID: 0 + properties: + pkiNotificationtestID: + type: integer + a_objVariableobject: + items: + $ref: '#/components/schemas/Custom-Variableobject-Response' + type: array + required: + - a_objVariableobject + - pkiNotificationtestID + type: object + MixedOneOf: + example: + content: MixedOneOf_content + properties: + content: + $ref: '#/components/schemas/MixedOneOf_content' + MixedAnyOf: + example: + content: MixedAnyOf_content + properties: + content: + $ref: '#/components/schemas/MixedAnyOf_content' + MixedSubId: + properties: + id: + type: string + MixLog: + properties: + id: + format: uuid + type: string + description: + type: string + mixDate: + format: date-time + type: string + shopId: + format: uuid + type: string + totalPrice: + format: float + nullable: true + type: number + totalRecalculations: + format: int32 + type: integer + totalOverPoors: + format: int32 + type: integer + totalSkips: + format: int32 + type: integer + totalUnderPours: + format: int32 + type: integer + formulaVersionDate: + format: date-time + type: string + someCode: + description: SomeCode is only required for color mixes + nullable: true + type: string + batchNumber: + type: string + brandCode: + description: BrandCode is only required for non-color mixes + type: string + brandId: + description: BrandId is only required for color mixes + type: string + brandName: + description: BrandName is only required for color mixes + type: string + categoryCode: + description: CategoryCode is not used anymore + type: string + color: + description: Color is only required for color mixes + type: string + colorDescription: + type: string + comment: + type: string + commercialProductCode: + type: string + productLineCode: + description: ProductLineCode is only required for color mixes + type: string + country: + type: string + createdBy: + type: string + createdByFirstName: + type: string + createdByLastName: + type: string + deltaECalculationRepaired: + type: string + deltaECalculationSprayout: + type: string + ownColorVariantNumber: + format: int32 + nullable: true + type: integer + primerProductId: + type: string + productId: + description: ProductId is only required for color mixes + type: string + productName: + description: ProductName is only required for color mixes + type: string + selectedVersionIndex: + format: int32 + type: integer + required: + - description + - formulaVersionDate + - id + - mixDate + - totalOverPoors + - totalRecalculations + - totalSkips + - totalUnderPours + type: object + uuid: + format: uuid + type: string + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + type: object + findPetsByStatus_status_parameter_inner: + default: available + enum: + - available + - pending + - sold + type: string + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request_enum_form_string_array_inner: + default: $ + enum: + - '>' + - $ + type: string + testEnumParameters_request_enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + testEnumParameters_request: + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + $ref: '#/components/schemas/testEnumParameters_request_enum_form_string_array_inner' + type: array + enum_form_string: + $ref: '#/components/schemas/testEnumParameters_request_enum_form_string' + type: object + testEnumParameters_enum_header_string_parameter: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + testEnumParameters_enum_query_integer_parameter: + enum: + - 1 + - -2 + format: int32 + type: integer + testEnumParameters_enum_query_double_parameter: + enum: + - 1.1 + - -1.2 + format: double + type: number + testEndpointParameters_request: + 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 + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + getCountry_request: + allOf: + - properties: + country: + type: string + required: + - country + type: object + RolesReportsHash_role: + example: + name: name + properties: + name: + type: string + type: object + Order_status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + Pet_status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + Enum_Test_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + type: string + Enum_Test_enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + Enum_Test_enum_integer_only: + enum: + - 2 + - -2 + type: integer + MapTest_map_of_enum_string_value: + enum: + - UPPER + - lower + type: string + EnumArrays_just_symbol: + enum: + - '>=' + - $ + type: string + EnumArrays_array_enum_inner: + enum: + - fish + - crab + type: string + RequiredClass_required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + RequiredClass_required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + RequiredClass_required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + RequiredClass_required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + RequiredClass_required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + RequiredClass_required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + zebra_type: + enum: + - plains + - mountain + - grevys + type: string + ChildCat_allOf_pet_type: + default: ChildCat + enum: + - ChildCat + type: string + x-enum-as-string: true + ZeroBasedEnumClass_ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + MixedOneOf_content: + description: Mixed oneOf types for testing + oneOf: + - type: string + - type: boolean + - format: uint8 + type: integer + - format: float32 + type: number + - $ref: '#/components/schemas/MixedSubId' + MixedAnyOf_content: + anyOf: + - type: string + - type: boolean + - format: uint8 + type: integer + - format: float32 + type: number + - $ref: '#/components/schemas/MixedSubId' + description: Mixed anyOf types for testing + 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/csharp/restsharp/net7/UseDateTimeForDate/appveyor.yml b/samples/client/petstore/csharp/generichost/net9/FormModels/appveyor.yml similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/appveyor.yml rename to samples/client/petstore/csharp/generichost/net9/FormModels/appveyor.yml diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/AnotherFakeApi.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/AnotherFakeApi.md new file mode 100644 index 000000000000..369488986579 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/AnotherFakeApi.md @@ -0,0 +1,99 @@ +# Org.OpenAPITools.Api.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** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class Call123TestSpecialTagsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new AnotherFakeApi(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test special tags + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the Call123TestSpecialTagsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test special tags + ApiResponse response = apiInstance.Call123TestSpecialTagsWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTagsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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/csharp/generichost/net9/FormModels/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/DefaultApi.md new file mode 100644 index 000000000000..0bdfd6af3474 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/DefaultApi.md @@ -0,0 +1,429 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | | +| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | | +| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello | +| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | | +| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements | + + +# **FooGet** +> FooGetDefaultResponse FooGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FooGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + FooGetDefaultResponse result = apiInstance.FooGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.FooGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FooGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FooGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.FooGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.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 | - | + +[[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) + + +# **GetCountry** +> void GetCountry (string country) + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetCountryExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + var country = "country_example"; // string | + + try + { + apiInstance.GetCountry(country); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.GetCountry: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetCountryWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.GetCountryWithHttpInfo(country); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.GetCountryWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **country** | **string** | | | + +### Return type + +void (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** | OK | - | + +[[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) + + +# **Hello** +> List<Guid> Hello () + +Hello + +Hello + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class HelloExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + // Hello + List result = apiInstance.Hello(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.Hello: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the HelloWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Hello + ApiResponse> response = apiInstance.HelloWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.HelloWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**List** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | UUIDs | - | + +[[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) + + +# **RolesReportGet** +> List<List<RolesReportsHash>> RolesReportGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class RolesReportGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + List> result = apiInstance.RolesReportGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.RolesReportGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the RolesReportGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse>> response = apiInstance.RolesReportGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.RolesReportGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**List>** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | returns report | - | + +[[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** +> NotificationtestGetElementsV1ResponseMPayload Test () + +Retrieve an existing Notificationtest's Elements + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + // Retrieve an existing Notificationtest's Elements + NotificationtestGetElementsV1ResponseMPayload result = apiInstance.Test(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.Test: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Retrieve an existing Notificationtest's Elements + ApiResponse response = apiInstance.TestWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.TestWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**NotificationtestGetElementsV1ResponseMPayload**](NotificationtestGetElementsV1ResponseMPayload.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful response | - | + +[[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/csharp/generichost/net9/FormModels/docs/apis/FakeApi.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/FakeApi.md new file mode 100644 index 000000000000..ff2e0dab1ad8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/FakeApi.md @@ -0,0 +1,1830 @@ +# Org.OpenAPITools.Api.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 | +| [**GetMixedAnyOf**](FakeApi.md#getmixedanyof) | **GET** /fake/mixed/anyOf | Test mixed type anyOf deserialization | +| [**GetMixedOneOf**](FakeApi.md#getmixedoneof) | **GET** /fake/mixed/oneOf | Test mixed type oneOf deserialization | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**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 | +| [**TestInlineFreeformAdditionalProperties**](FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**TestQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | | +| [**TestStringMapReference**](FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map | + + +# **FakeHealthGet** +> HealthCheckResult FakeHealthGet () + +Health check endpoint + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeHealthGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Health check endpoint + HealthCheckResult result = apiInstance.FakeHealthGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeHealthGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeHealthGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Health check endpoint + ApiResponse response = apiInstance.FakeHealthGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeHealthGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **FakeOuterBooleanSerialize** +> bool FakeOuterBooleanSerialize (bool body = null) + + + +Test serialization of outer boolean types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterBooleanSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var body = true; // bool | Input boolean as post body (optional) + + try + { + bool result = apiInstance.FakeOuterBooleanSerialize(body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterBooleanSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterBooleanSerializeWithHttpInfo(body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **body** | **bool** | Input boolean as post body | [optional] | + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + +[[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) + + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize (OuterComposite outerComposite = null) + + + +Test serialization of object with outer number type + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterCompositeSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body (optional) + + try + { + OuterComposite result = apiInstance.FakeOuterCompositeSerialize(outerComposite); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterCompositeSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterCompositeSerializeWithHttpInfo(outerComposite); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **FakeOuterNumberSerialize** +> decimal FakeOuterNumberSerialize (decimal body = null) + + + +Test serialization of outer number types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterNumberSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var body = 8.14D; // decimal | Input number as post body (optional) + + try + { + decimal result = apiInstance.FakeOuterNumberSerialize(body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterNumberSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterNumberSerializeWithHttpInfo(body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + +[[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) + + +# **FakeOuterStringSerialize** +> string FakeOuterStringSerialize (Guid requiredStringUuid, string body = null) + + + +Test serialization of outer string types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterStringSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requiredStringUuid = "requiredStringUuid_example"; // Guid | Required UUID String + var body = "body_example"; // string | Input string as post body (optional) + + try + { + string result = apiInstance.FakeOuterStringSerialize(requiredStringUuid, body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterStringSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterStringSerializeWithHttpInfo(requiredStringUuid, body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requiredStringUuid** | **Guid** | Required UUID String | | +| **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 | - | + +[[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) + + +# **GetArrayOfEnums** +> List<OuterEnum> GetArrayOfEnums () + +Array of Enums + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetArrayOfEnumsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Array of Enums + List result = apiInstance.GetArrayOfEnums(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetArrayOfEnums: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetArrayOfEnumsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Array of Enums + ApiResponse> response = apiInstance.GetArrayOfEnumsWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetArrayOfEnumsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **GetMixedAnyOf** +> MixedAnyOf GetMixedAnyOf () + +Test mixed type anyOf deserialization + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetMixedAnyOfExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Test mixed type anyOf deserialization + MixedAnyOf result = apiInstance.GetMixedAnyOf(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetMixedAnyOf: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetMixedAnyOfWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Test mixed type anyOf deserialization + ApiResponse response = apiInstance.GetMixedAnyOfWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetMixedAnyOfWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**MixedAnyOf**](MixedAnyOf.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 mixed anyOf | - | + +[[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) + + +# **GetMixedOneOf** +> MixedOneOf GetMixedOneOf () + +Test mixed type oneOf deserialization + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetMixedOneOfExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Test mixed type oneOf deserialization + MixedOneOf result = apiInstance.GetMixedOneOf(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetMixedOneOf: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetMixedOneOfWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Test mixed type oneOf deserialization + ApiResponse response = apiInstance.GetMixedOneOfWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetMixedOneOfWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**MixedOneOf**](MixedOneOf.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 mixed oneOf | - | + +[[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) + + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestBodyWithFileSchema** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestBodyWithFileSchemaWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchemaWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestBodyWithQueryParams** +> void TestBodyWithQueryParams (string query, User user) + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithQueryParamsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var query = "query_example"; // string | + var user = new User(); // User | + + try + { + apiInstance.TestBodyWithQueryParams(query, user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParams: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestBodyWithQueryParamsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestBodyWithQueryParamsWithHttpInfo(query, user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParamsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestClientModel** +> ModelClient TestClientModel (ModelClient modelClient) + +To test \"client\" model + +To test \"client\" model + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClientModelExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test \"client\" model + ModelClient result = apiInstance.TestClientModel(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestClientModelWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test \"client\" model + ApiResponse response = apiInstance.TestClientModelWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestClientModelWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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) + + +# **TestEndpointParameters** +> void TestEndpointParameters (decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, System.IO.Stream binary = null, string callback = null, DateOnly date = null, DateTime dateTime = null, int int32 = null, long int64 = null, int integer = null, string password = null, float varFloat = null, string varString = null) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEndpointParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure HTTP basic authorization: http_basic_test + config.Username = "YOUR_USERNAME"; + config.Password = "YOUR_PASSWORD"; + + var apiInstance = new FakeApi(config); + var number = 8.14D; // decimal | None + var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // string | None + var varByte = System.Text.Encoding.ASCII.GetBytes("BYTE_ARRAY_DATA_HERE"); // byte[] | None + var varDouble = 1.2D; // double | None + var binary = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | None (optional) + var callback = "callback_example"; // string | None (optional) + var date = DateOnly.Parse("2013-10-20"); // DateOnly | None (optional) + var dateTime = DateTime.Parse(""2010-02-01T10:20:10.111110+01:00""); // DateTime | None (optional) (default to "2010-02-01T10:20:10.111110+01:00") + var int32 = 56; // int | None (optional) + var int64 = 789L; // long | None (optional) + var integer = 56; // int | None (optional) + var password = "password_example"; // string | None (optional) + var varFloat = 3.4F; // float | None (optional) + var varString = "varString_example"; // string | None (optional) + + try + { + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + apiInstance.TestEndpointParameters(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestEndpointParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + apiInstance.TestEndpointParametersWithHttpInfo(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestEndpointParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **number** | **decimal** | None | | +| **patternWithoutDelimiter** | **string** | None | | +| **varByte** | **byte[]** | None | | +| **varDouble** | **double** | None | | +| **binary** | **System.IO.Stream****System.IO.Stream** | None | [optional] | +| **callback** | **string** | None | [optional] | +| **date** | **DateOnly** | None | [optional] | +| **dateTime** | **DateTime** | None | [optional] [default to "2010-02-01T10:20:10.111110+01:00"] | +| **int32** | **int** | None | [optional] | +| **int64** | **long** | None | [optional] | +| **integer** | **int** | None | [optional] | +| **password** | **string** | None | [optional] | +| **varFloat** | **float** | None | [optional] | +| **varString** | **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 + + +### 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) + + +# **TestEnumParameters** +> void TestEnumParameters (TestEnumParametersRequestEnumFormString enumFormString = null, List enumFormStringArray = null, TestEnumParametersEnumHeaderStringParameter enumHeaderString = null, List enumHeaderStringArray = null, TestEnumParametersEnumQueryDoubleParameter enumQueryDouble = null, TestEnumParametersEnumQueryIntegerParameter enumQueryInteger = null, TestEnumParametersEnumHeaderStringParameter enumQueryString = null, List enumQueryStringArray = null) + +To test enum parameters + +To test enum parameters + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEnumParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var enumFormString = (TestEnumParametersRequestEnumFormString) "_abc"; // TestEnumParametersRequestEnumFormString | (optional) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) + var enumHeaderString = (TestEnumParametersEnumHeaderStringParameter) "_abc"; // TestEnumParametersEnumHeaderStringParameter | Header parameter enum test (string) (optional) + var enumHeaderStringArray = new List(); // List | Header parameter enum test (string array) (optional) + var enumQueryDouble = (TestEnumParametersEnumQueryDoubleParameter) "1.1"; // TestEnumParametersEnumQueryDoubleParameter | Query parameter enum test (double) (optional) + var enumQueryInteger = (TestEnumParametersEnumQueryIntegerParameter) "1"; // TestEnumParametersEnumQueryIntegerParameter | Query parameter enum test (double) (optional) + var enumQueryString = (TestEnumParametersEnumHeaderStringParameter) "_abc"; // TestEnumParametersEnumHeaderStringParameter | Query parameter enum test (string) (optional) + var enumQueryStringArray = new List(); // List | Query parameter enum test (string array) (optional) + + try + { + // To test enum parameters + apiInstance.TestEnumParameters(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestEnumParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test enum parameters + apiInstance.TestEnumParametersWithHttpInfo(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestEnumParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **enumFormString** | **TestEnumParametersRequestEnumFormString** | | [optional] | +| **enumFormStringArray** | [**List<TestEnumParametersRequestEnumFormStringArrayInner>**](TestEnumParametersRequestEnumFormStringArrayInner.md) | Form parameter enum test (string array) | [optional] | +| **enumHeaderString** | **TestEnumParametersEnumHeaderStringParameter** | Header parameter enum test (string) | [optional] | +| **enumHeaderStringArray** | [**List<TestEnumParametersRequestEnumFormStringArrayInner>**](TestEnumParametersRequestEnumFormStringArrayInner.md) | Header parameter enum test (string array) | [optional] | +| **enumQueryDouble** | **TestEnumParametersEnumQueryDoubleParameter** | Query parameter enum test (double) | [optional] | +| **enumQueryInteger** | **TestEnumParametersEnumQueryIntegerParameter** | Query parameter enum test (double) | [optional] | +| **enumQueryString** | **TestEnumParametersEnumHeaderStringParameter** | Query parameter enum test (string) | [optional] | +| **enumQueryStringArray** | [**List<TestEnumParametersRequestEnumFormStringArrayInner>**](TestEnumParametersRequestEnumFormStringArrayInner.md) | Query parameter enum test (string array) | [optional] | + +### Return type + +void (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 | - | + +[[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) + + +# **TestGroupParameters** +> void TestGroupParameters (bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, bool booleanGroup = null, long int64Group = null, int stringGroup = null) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestGroupParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure Bearer token for authorization: bearer_test + config.AccessToken = "YOUR_BEARER_TOKEN"; + + var apiInstance = new FakeApi(config); + var requiredBooleanGroup = true; // bool | Required Boolean in group parameters + var requiredInt64Group = 789L; // long | Required Integer in group parameters + var requiredStringGroup = 56; // int | Required String in group parameters + var booleanGroup = true; // bool | Boolean in group parameters (optional) + var int64Group = 789L; // long | Integer in group parameters (optional) + var stringGroup = 56; // int | String in group parameters (optional) + + try + { + // Fake endpoint to test group parameters (optional) + apiInstance.TestGroupParameters(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestGroupParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestGroupParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Fake endpoint to test group parameters (optional) + apiInstance.TestGroupParametersWithHttpInfo(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestGroupParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requiredBooleanGroup** | **bool** | Required Boolean in group parameters | | +| **requiredInt64Group** | **long** | Required Integer in group parameters | | +| **requiredStringGroup** | **int** | Required String in group parameters | | +| **booleanGroup** | **bool** | Boolean in group parameters | [optional] | +| **int64Group** | **long** | Integer in group parameters | [optional] | +| **stringGroup** | **int** | String 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + +[[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) + + +# **TestInlineAdditionalProperties** +> void TestInlineAdditionalProperties (Dictionary requestBody) + +test inline additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestInlineAdditionalPropertiesExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test inline additionalProperties + apiInstance.TestInlineAdditionalProperties(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestInlineAdditionalPropertiesWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test inline additionalProperties + apiInstance.TestInlineAdditionalPropertiesWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalPropertiesWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, string>**](string.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestInlineFreeformAdditionalProperties** +> void TestInlineFreeformAdditionalProperties (TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestInlineFreeformAdditionalPropertiesExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + + try + { + // test inline free-form additionalProperties + apiInstance.TestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalProperties: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestInlineFreeformAdditionalPropertiesWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test inline free-form additionalProperties + apiInstance.TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalPropertiesWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestJsonFormData** +> void TestJsonFormData (string param, string param2) + +test json serialization of form data + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestJsonFormDataExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var param = "param_example"; // string | field1 + var param2 = "param2_example"; // string | field2 + + try + { + // test json serialization of form data + apiInstance.TestJsonFormData(param, param2); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestJsonFormDataWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test json serialization of form data + apiInstance.TestJsonFormDataWithHttpInfo(param, param2); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestJsonFormDataWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### 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) + + +# **TestQueryParameterCollectionFormat** +> void TestQueryParameterCollectionFormat (List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, string notRequiredNotNullable = null, string notRequiredNullable = null, string requiredNullable) + + + +To test the collection format in query parameters + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestQueryParameterCollectionFormatExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var context = new List(); // List | + var http = new List(); // List | + var ioutil = new List(); // List | + var pipe = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var url = new List(); // List | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) + var requiredNullable = "requiredNullable_example"; // string | + + try + { + apiInstance.TestQueryParameterCollectionFormat(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestQueryParameterCollectionFormat: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestQueryParameterCollectionFormatWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestQueryParameterCollectionFormatWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **context** | [**List<string>**](string.md) | | | +| **http** | [**List<string>**](string.md) | | | +| **ioutil** | [**List<string>**](string.md) | | | +| **pipe** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **url** | [**List<string>**](string.md) | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | +| **requiredNullable** | **string** | | | + +### 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 | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestStringMapReference** +> void TestStringMapReference (Dictionary requestBody) + +test referenced string map + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestStringMapReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced string map + apiInstance.TestStringMapReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestStringMapReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestStringMapReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced string map + apiInstance.TestStringMapReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestStringMapReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, string>**](string.md) | request body | | + +### Return type + +void (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 | - | + +[[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/csharp/generichost/net9/FormModels/docs/apis/FakeClassnameTags123Api.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..dfe1adefd0a7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/FakeClassnameTags123Api.md @@ -0,0 +1,104 @@ +# Org.OpenAPITools.Api.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** +> ModelClient TestClassname (ModelClient modelClient) + +To test class name in snake case + +To test class name in snake case + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClassnameExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key_query + config.AddApiKey("api_key_query", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key_query", "Bearer"); + + var apiInstance = new FakeClassnameTags123Api(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test class name in snake case + ModelClient result = apiInstance.TestClassname(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestClassnameWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test class name in snake case + ApiResponse response = apiInstance.TestClassnameWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassnameWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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/csharp/generichost/net9/FormModels/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/PetApi.md new file mode 100644 index 000000000000..f49e2200d1c9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/PetApi.md @@ -0,0 +1,862 @@ +# Org.OpenAPITools.Api.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** +> void AddPet (Pet pet) + +Add a new pet to the store + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class AddPetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(pet); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the AddPetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Add a new pet to the store + apiInstance.AddPetWithHttpInfo(pet); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.AddPetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **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) + + +# **DeletePet** +> void DeletePet (long petId, string apiKey = null) + +Deletes a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeletePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | Pet id to delete + var apiKey = "apiKey_example"; // string | (optional) + + try + { + // Deletes a pet + apiInstance.DeletePet(petId, apiKey); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeletePetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Deletes a pet + apiInstance.DeletePetWithHttpInfo(petId, apiKey); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.DeletePetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | Pet id to delete | | +| **apiKey** | **string** | | [optional] | + +### 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** +> List<Pet> FindPetsByStatus (List status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByStatusExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var status = new List(); // List | Status values that need to be considered for filter + + try + { + // Finds Pets by status + List result = apiInstance.FindPetsByStatus(status); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FindPetsByStatusWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Finds Pets by status + ApiResponse> response = apiInstance.FindPetsByStatusWithHttpInfo(status); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.FindPetsByStatusWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **status** | [**List<FindPetsByStatusStatusParameterInner>**](FindPetsByStatusStatusParameterInner.md) | Status values that need to be considered for filter | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | + +[[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** +> List<Pet> FindPetsByTags (List tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByTagsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var tags = new List(); // List | Tags to filter by + + try + { + // Finds Pets by tags + List result = apiInstance.FindPetsByTags(tags); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FindPetsByTagsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Finds Pets by tags + ApiResponse> response = apiInstance.FindPetsByTagsWithHttpInfo(tags); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.FindPetsByTagsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **tags** | [**List<string>**](string.md) | Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 (long petId) + +Find pet by ID + +Returns a single pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetPetByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api-key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api-key", "Bearer"); + // Configure API key authorization: api_key_query + config.AddApiKey("api_key_query", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key_query", "Bearer"); + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to return + + try + { + // Find pet by ID + Pet result = apiInstance.GetPetById(petId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetPetByIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Find pet by ID + ApiResponse response = apiInstance.GetPetByIdWithHttpInfo(petId); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.GetPetByIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key), [api_key_query](../README.md#api_key_query) + +### 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** +> void UpdatePet (Pet pet) + +Update an existing pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + apiInstance.UpdatePet(pet); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdatePetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Update an existing pet + apiInstance.UpdatePetWithHttpInfo(pet); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UpdatePetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 | - | + +[[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** +> void UpdatePetWithForm (long petId, string name = null, string status = null) + +Updates a pet in the store with form data + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetWithFormExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet that needs to be updated + var name = "name_example"; // string | Updated name of the pet (optional) + var status = "status_example"; // string | Updated status of the pet (optional) + + try + { + // Updates a pet in the store with form data + apiInstance.UpdatePetWithForm(petId, name, status); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdatePetWithFormWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Updates a pet in the store with form data + apiInstance.UpdatePetWithFormWithHttpInfo(petId, name, status); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UpdatePetWithFormWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet that needs to be updated | | +| **name** | **string** | Updated name of the pet | [optional] | +| **status** | **string** | Updated status of the pet | [optional] | + +### Return type + +void (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 (long petId, string additionalMetadata = null, System.IO.Stream file = null) + +uploads an image + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to update + var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional) + var file = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload (optional) + + try + { + // uploads an image + ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UploadFileWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // uploads an image + ApiResponse response = apiInstance.UploadFileWithHttpInfo(petId, additionalMetadata, file); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UploadFileWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to update | | +| **additionalMetadata** | **string** | Additional data to pass to server | [optional] | +| **file** | **System.IO.Stream****System.IO.Stream** | file to upload | [optional] | + +### Return type + +[**ApiResponse**](ApiResponse.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 | - | + +[[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) + + +# **UploadFileWithRequiredFile** +> ApiResponse UploadFileWithRequiredFile (long petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to update + var requiredFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload + var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UploadFileWithRequiredFileWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // uploads an image (required) + ApiResponse response = apiInstance.UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFileWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to update | | +| **requiredFile** | **System.IO.Stream****System.IO.Stream** | file to upload | | +| **additionalMetadata** | **string** | Additional data to pass to server | [optional] | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + +### 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/client/petstore/csharp/generichost/net9/FormModels/docs/apis/StoreApi.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/StoreApi.md new file mode 100644 index 000000000000..e169ad74f907 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/StoreApi.md @@ -0,0 +1,373 @@ +# Org.OpenAPITools.Api.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** +> void DeleteOrder (string 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 +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var orderId = "orderId_example"; // string | ID of the order that needs to be deleted + + try + { + // Delete purchase order by ID + apiInstance.DeleteOrder(orderId); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeleteOrderWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Delete purchase order by ID + apiInstance.DeleteOrderWithHttpInfo(orderId); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.DeleteOrderWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **orderId** | **string** | ID of the order that needs to be deleted | | + +### 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** +> Dictionary<string, int> GetInventory () + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetInventoryExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api-key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api-key", "Bearer"); + + var apiInstance = new StoreApi(config); + + try + { + // Returns pet inventories by status + Dictionary result = apiInstance.GetInventory(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetInventoryWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Returns pet inventories by status + ApiResponse> response = apiInstance.GetInventoryWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.GetInventoryWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**Dictionary** + +### 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 (long orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetOrderByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var orderId = 789L; // long | ID of pet that needs to be fetched + + try + { + // Find purchase order by ID + Order result = apiInstance.GetOrderById(orderId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetOrderByIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Find purchase order by ID + ApiResponse response = apiInstance.GetOrderByIdWithHttpInfo(orderId); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.GetOrderByIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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 order) + +Place an order for a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class PlaceOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var order = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + Order result = apiInstance.PlaceOrder(order); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the PlaceOrderWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Place an order for a pet + ApiResponse response = apiInstance.PlaceOrderWithHttpInfo(order); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.PlaceOrderWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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/csharp/generichost/net9/FormModels/docs/apis/UserApi.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/UserApi.md new file mode 100644 index 000000000000..34064e25c4a8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/UserApi.md @@ -0,0 +1,715 @@ +# Org.OpenAPITools.Api.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** +> void CreateUser (User user) + +Create user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Create user + apiInstance.CreateUserWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**User**](User.md) | Created user object | | + +### Return type + +void (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 | - | + +[[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** +> void CreateUsersWithArrayInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithArrayInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUsersWithArrayInputWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInputWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInputWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**List<User>**](User.md) | List of user object | | + +### Return type + +void (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 | - | + +[[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** +> void CreateUsersWithListInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithListInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUsersWithListInputWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Creates list of users with given input array + apiInstance.CreateUsersWithListInputWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUsersWithListInputWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**List<User>**](User.md) | List of user object | | + +### Return type + +void (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 | - | + +[[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** +> void DeleteUser (string username) + +Delete user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var username = "username_example"; // string | The name that needs to be deleted + + try + { + // Delete user + apiInstance.DeleteUser(username); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeleteUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Delete user + apiInstance.DeleteUserWithHttpInfo(username); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.DeleteUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **username** | **string** | The name that needs to be deleted | | + +### 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 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 (string username) + +Get user by user name + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetUserByNameExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var username = "username_example"; // string | The name that needs to be fetched. Use user1 for testing. + + try + { + // Get user by user name + User result = apiInstance.GetUserByName(username); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetUserByNameWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Get user by user name + ApiResponse response = apiInstance.GetUserByNameWithHttpInfo(username); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.GetUserByNameWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | +| **598** | Not a real HTTP status code | - | +| **599** | Not a real HTTP status code with a return object | - | + +[[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 (string password, string username) + +Logs user into the system + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LoginUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var password = "password_example"; // string | The password for login in clear text + var username = "username_example"; // string | The user name for login + + try + { + // Logs user into the system + string result = apiInstance.LoginUser(password, username); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the LoginUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Logs user into the system + ApiResponse response = apiInstance.LoginUserWithHttpInfo(password, username); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.LoginUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **password** | **string** | The password for login in clear text | | +| **username** | **string** | The user name for login | | + +### 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** +> void LogoutUser () + +Logs out current logged in user session + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LogoutUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + + try + { + // Logs out current logged in user session + apiInstance.LogoutUser(); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the LogoutUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Logs out current logged in user session + apiInstance.LogoutUserWithHttpInfo(); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.LogoutUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### 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 | +|-------------|-------------|------------------| +| **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** +> void UpdateUser (User user, string username) + +Updated user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new User(); // User | Updated user object + var username = "username_example"; // string | name that need to be deleted + + try + { + // Updated user + apiInstance.UpdateUser(user, username); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdateUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Updated user + apiInstance.UpdateUserWithHttpInfo(user, username); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.UpdateUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**User**](User.md) | Updated user object | | +| **username** | **string** | name that need to be deleted | | + +### Return type + +void (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 | - | + +[[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/csharp/generichost/net9/FormModels/docs/models/Activity.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Activity.md new file mode 100644 index 000000000000..6f69ec32545d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Activity.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Activity +test map of maps + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ActivityOutputs** | **Dictionary<string, List<ActivityOutputElementRepresentation>>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ActivityOutputElementRepresentation.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ActivityOutputElementRepresentation.md new file mode 100644 index 000000000000..33d79a27692f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ActivityOutputElementRepresentation.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ActivityOutputElementRepresentation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Prop1** | **string** | | [optional] +**Prop2** | **Object** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..2bbe882fcfcc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/AdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# Org.OpenAPITools.Model.AdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Anytype1** | **Object** | | [optional] +**EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] +**MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MapProperty** | **Dictionary<string, string>** | | [optional] +**MapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] +**MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] +**MapWithUndeclaredPropertiesAnytype3** | **Dictionary<string, Object>** | | [optional] +**MapWithUndeclaredPropertiesString** | **Dictionary<string, string>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Animal.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Animal.md new file mode 100644 index 000000000000..1a1760bd8697 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Animal.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Animal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] + +[[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/csharp/generichost/net9/FormModels/docs/models/ApiResponse.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ApiResponse.md new file mode 100644 index 000000000000..d89ed1a25dc7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ApiResponse.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.ApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int** | | [optional] +**Message** | **string** | | [optional] +**Type** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Apple.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Apple.md new file mode 100644 index 000000000000..9ad1da8cd688 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Apple.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ColorCode** | **string** | | [optional] +**Cultivar** | **string** | | [optional] +**Origin** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/AppleReq.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/AppleReq.md new file mode 100644 index 000000000000..325521123f12 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/AppleReq.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.AppleReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | **string** | | +**Mealy** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..a23ba59e609c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ArrayOfArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | **List<List<decimal>>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ArrayOfNumberOnly.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..10b8413439b8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | **List<decimal>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ArrayTest.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ArrayTest.md new file mode 100644 index 000000000000..ed572120cd6d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ArrayTest.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.ArrayTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayOfInteger** | **List<List<long>>** | | [optional] +**ArrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] +**ArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Banana.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Banana.md new file mode 100644 index 000000000000..d32e90cf2985 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Banana.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/BananaReq.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/BananaReq.md new file mode 100644 index 000000000000..c8372b73c5f7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/BananaReq.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.BananaReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **decimal** | | +**Sweet** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/BasquePig.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/BasquePig.md new file mode 100644 index 000000000000..db4f7a362268 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/BasquePig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.BasquePig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/Capitalization.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Capitalization.md new file mode 100644 index 000000000000..9e225c17232a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Capitalization.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Capitalization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ATT_NAME** | **string** | Name of the pet | [optional] +**CapitalCamel** | **string** | | [optional] +**CapitalSnake** | **string** | | [optional] +**SCAETHFlowPoints** | **string** | | [optional] +**SmallCamel** | **string** | | [optional] +**SmallSnake** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Cat.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Cat.md new file mode 100644 index 000000000000..310a5e6575ec --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Cat.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Cat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Declawed** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Category.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Category.md new file mode 100644 index 000000000000..6eb0a2e13eaa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Category.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] + +[[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/csharp/generichost/net9/FormModels/docs/models/ChildCat.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ChildCat.md new file mode 100644 index 000000000000..4085cdef26d3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ChildCat.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ChildCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **ChildCatAllOfPetType** | | +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ChildCatAllOfPetType.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ChildCatAllOfPetType.md new file mode 100644 index 000000000000..47a390dc5811 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ChildCatAllOfPetType.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ChildCatAllOfPetType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/ClassModel.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ClassModel.md new file mode 100644 index 000000000000..bb35816c9148 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ClassModel.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ClassModel +Model for testing model with \"_class\" property + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ComplexQuadrilateral.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ComplexQuadrilateral.md new file mode 100644 index 000000000000..fb00d4ebf089 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ComplexQuadrilateral.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ComplexQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/DanishPig.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/DanishPig.md new file mode 100644 index 000000000000..4d6ec1400a7e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/DanishPig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DanishPig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/DateOnlyClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/DateOnlyClass.md new file mode 100644 index 000000000000..4fc3775ed87d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/DateOnlyClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DateOnlyClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateOnlyProperty** | **DateOnly** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/DeprecatedObject.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/DeprecatedObject.md new file mode 100644 index 000000000000..e90c59555a0d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/DeprecatedObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DeprecatedObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Dog.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Dog.md new file mode 100644 index 000000000000..70cdc80e83e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Dog.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Dog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Breed** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Drawing.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Drawing.md new file mode 100644 index 000000000000..95f49b2ed600 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Drawing.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.Drawing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MainShape** | [**Shape**](Shape.md) | | [optional] +**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional] +**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**Shapes** | [**List<Shape>**](Shape.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArrays.md new file mode 100644 index 000000000000..ae3e81632c1b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArrays.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.EnumArrays + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayEnum** | [**List<EnumArraysArrayEnumInner>**](EnumArraysArrayEnumInner.md) | | [optional] +**JustSymbol** | **EnumArraysJustSymbol** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArraysArrayEnumInner.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArraysArrayEnumInner.md new file mode 100644 index 000000000000..9c08ed9cfedb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArraysArrayEnumInner.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.EnumArraysArrayEnumInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/EnumArraysJustSymbol.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArraysJustSymbol.md new file mode 100644 index 000000000000..4cf0e6434006 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumArraysJustSymbol.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.EnumArraysJustSymbol + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/EnumClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumClass.md new file mode 100644 index 000000000000..d259f0f46968 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumClass.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.EnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/EnumTest.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumTest.md new file mode 100644 index 000000000000..898c1ea1fb69 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumTest.md @@ -0,0 +1,18 @@ +# Org.OpenAPITools.Model.EnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **EnumTestEnumString** | | +**EnumInteger** | **EnumTestEnumInteger** | | [optional] +**EnumIntegerOnly** | **EnumTestEnumIntegerOnly** | | [optional] +**EnumNumber** | **TestEnumParametersEnumQueryDoubleParameter** | | [optional] +**EnumString** | **EnumTestEnumString** | | [optional] +**OuterEnum** | **OuterEnum** | | [optional] +**OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**OuterEnumInteger** | **OuterEnumInteger** | | [optional] +**OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumTestEnumInteger.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumTestEnumInteger.md new file mode 100644 index 000000000000..2476caf61c79 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumTestEnumInteger.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.EnumTestEnumInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/EnumTestEnumIntegerOnly.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumTestEnumIntegerOnly.md new file mode 100644 index 000000000000..08f59f08776f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumTestEnumIntegerOnly.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.EnumTestEnumIntegerOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/EnumTestEnumString.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumTestEnumString.md new file mode 100644 index 000000000000..783198941ba8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EnumTestEnumString.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.EnumTestEnumString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/EquilateralTriangle.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EquilateralTriangle.md new file mode 100644 index 000000000000..8360b5c16a5b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/EquilateralTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.EquilateralTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/File.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/File.md new file mode 100644 index 000000000000..58b9c2fc3698 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/File.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.File +Must be named `File` for test. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **string** | Test capitalization | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FileSchemaTestClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FileSchemaTestClass.md new file mode 100644 index 000000000000..a47efad77d8a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | [**File**](File.md) | | [optional] +**Files** | [**List<File>**](File.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FindPetsByStatusStatusParameterInner.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FindPetsByStatusStatusParameterInner.md new file mode 100644 index 000000000000..e4b9110e6a6e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FindPetsByStatusStatusParameterInner.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.FindPetsByStatusStatusParameterInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/Foo.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Foo.md new file mode 100644 index 000000000000..b9e7d261736f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Foo.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Foo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to "bar"] + +[[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/csharp/generichost/net9/FormModels/docs/models/FooGetDefaultResponse.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FooGetDefaultResponse.md new file mode 100644 index 000000000000..47e50daca3e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FormatTest.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FormatTest.md new file mode 100644 index 000000000000..1009f35198fb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FormatTest.md @@ -0,0 +1,33 @@ +# Org.OpenAPITools.Model.FormatTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Byte** | **byte[]** | | +**Date** | **DateOnly** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] +**DateTime** | **DateTime** | | [optional] +**Decimal** | **decimal** | | [optional] +**Double** | **double** | | [optional] +**Float** | **float** | | [optional] +**Int32** | **int** | | [optional] +**Int32Range** | **int** | | [optional] +**Int64** | **long** | | [optional] +**Int64Negative** | **long** | | [optional] +**Int64NegativeExclusive** | **long** | | [optional] +**Int64Positive** | **long** | | [optional] +**Int64PositiveExclusive** | **long** | | [optional] +**Integer** | **int** | | [optional] +**PatternWithBackslash** | **string** | None | [optional] +**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] +**String** | **string** | | [optional] +**UnsignedInteger** | **uint** | | [optional] +**UnsignedLong** | **ulong** | | [optional] +**Uuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Fruit.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Fruit.md new file mode 100644 index 000000000000..b3bee18f7ba0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Fruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Fruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FruitReq.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FruitReq.md new file mode 100644 index 000000000000..38ab0c1a6caa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/FruitReq.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.FruitReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/GmFruit.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/GmFruit.md new file mode 100644 index 000000000000..584c4fd323d8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/GmFruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.GmFruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/GrandparentAnimal.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/GrandparentAnimal.md new file mode 100644 index 000000000000..eca96162b6f8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/GrandparentAnimal.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.GrandparentAnimal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/HasOnlyReadOnly.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/HasOnlyReadOnly.md new file mode 100644 index 000000000000..060a614a6981 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.HasOnlyReadOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [readonly] +**Foo** | **string** | | [optional] [readonly] + +[[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/csharp/generichost/net9/FormModels/docs/models/HealthCheckResult.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/HealthCheckResult.md new file mode 100644 index 000000000000..682cfc50e3a4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/HealthCheckResult.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.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] + +[[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/csharp/generichost/net9/FormModels/docs/models/IsoscelesTriangle.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/IsoscelesTriangle.md new file mode 100644 index 000000000000..07c62ac93382 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/IsoscelesTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.IsoscelesTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/List.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/List.md new file mode 100644 index 000000000000..0b54858ac247 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/List.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.List + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Var123List** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/LiteralStringClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/LiteralStringClass.md new file mode 100644 index 000000000000..782021909655 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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/csharp/generichost/net9/FormModels/docs/models/Mammal.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Mammal.md new file mode 100644 index 000000000000..ac14f00c0ff0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Mammal.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Mammal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/MapTest.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MapTest.md new file mode 100644 index 000000000000..b2dea1b6cb44 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MapTest.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.MapTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DirectMap** | **Dictionary<string, bool>** | | [optional] +**IndirectMap** | **Dictionary<string, bool>** | | [optional] +**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MapOfEnumString** | [**Dictionary<string, MapTestMapOfEnumStringValue>**](MapTestMapOfEnumStringValue.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MapTestMapOfEnumStringValue.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MapTestMapOfEnumStringValue.md new file mode 100644 index 000000000000..f587f829988f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MapTestMapOfEnumStringValue.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.MapTestMapOfEnumStringValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/MixLog.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixLog.md new file mode 100644 index 000000000000..5184c03bea97 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixLog.md @@ -0,0 +1,41 @@ +# Org.OpenAPITools.Model.MixLog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Description** | **string** | | +**FormulaVersionDate** | **DateTime** | | +**Id** | **Guid** | | +**MixDate** | **DateTime** | | +**TotalOverPoors** | **int** | | +**TotalRecalculations** | **int** | | +**TotalSkips** | **int** | | +**TotalUnderPours** | **int** | | +**BatchNumber** | **string** | | [optional] +**BrandCode** | **string** | BrandCode is only required for non-color mixes | [optional] +**BrandId** | **string** | BrandId is only required for color mixes | [optional] +**BrandName** | **string** | BrandName is only required for color mixes | [optional] +**CategoryCode** | **string** | CategoryCode is not used anymore | [optional] +**Color** | **string** | Color is only required for color mixes | [optional] +**ColorDescription** | **string** | | [optional] +**Comment** | **string** | | [optional] +**CommercialProductCode** | **string** | | [optional] +**Country** | **string** | | [optional] +**CreatedBy** | **string** | | [optional] +**CreatedByFirstName** | **string** | | [optional] +**CreatedByLastName** | **string** | | [optional] +**DeltaECalculationRepaired** | **string** | | [optional] +**DeltaECalculationSprayout** | **string** | | [optional] +**OwnColorVariantNumber** | **int** | | [optional] +**PrimerProductId** | **string** | | [optional] +**ProductId** | **string** | ProductId is only required for color mixes | [optional] +**ProductLineCode** | **string** | ProductLineCode is only required for color mixes | [optional] +**ProductName** | **string** | ProductName is only required for color mixes | [optional] +**SelectedVersionIndex** | **int** | | [optional] +**ShopId** | **Guid** | | [optional] +**SomeCode** | **string** | SomeCode is only required for color mixes | [optional] +**TotalPrice** | **float** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedAnyOf.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedAnyOf.md new file mode 100644 index 000000000000..2e9a2ca23f67 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedAnyOf.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedAnyOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Content** | [**MixedAnyOfContent**](MixedAnyOfContent.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedAnyOfContent.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedAnyOfContent.md new file mode 100644 index 000000000000..141ffe5a41dc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedAnyOfContent.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedAnyOfContent +Mixed anyOf types for testing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/MixedOneOf.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedOneOf.md new file mode 100644 index 000000000000..6cb1d5adff01 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedOneOf.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Content** | [**MixedOneOfContent**](MixedOneOfContent.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedOneOfContent.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedOneOfContent.md new file mode 100644 index 000000000000..168d5ee83628 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedOneOfContent.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedOneOfContent +Mixed oneOf types for testing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..1bc0740add9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.MixedPropertiesAndAdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateTime** | **DateTime** | | [optional] +**Map** | [**Dictionary<string, Animal>**](Animal.md) | | [optional] +**Uuid** | **Guid** | | [optional] +**UuidWithPattern** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedSubId.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedSubId.md new file mode 100644 index 000000000000..1df3d4002bf5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/MixedSubId.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedSubId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Model200Response.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Model200Response.md new file mode 100644 index 000000000000..2752a0d87c82 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Model200Response.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Model200Response +Model for testing model name starting with number + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **string** | | [optional] +**Name** | **int** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ModelClient.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ModelClient.md new file mode 100644 index 000000000000..c658e84ef57e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ModelClient.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ModelClient + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarClient** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Name.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Name.md new file mode 100644 index 000000000000..ffe61a31d61b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Name.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Name +Model for testing model name same as property name + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarName** | **int** | | +**Property** | **string** | | [optional] +**SnakeCase** | **int** | | [optional] [readonly] +**Var123Number** | **int** | | [optional] [readonly] + +[[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/csharp/generichost/net9/FormModels/docs/models/NotificationtestGetElementsV1ResponseMPayload.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NotificationtestGetElementsV1ResponseMPayload.md new file mode 100644 index 000000000000..25f223a8360a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NotificationtestGetElementsV1ResponseMPayload.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AObjVariableobject** | **List<Dictionary<string, Object>>** | | +**PkiNotificationtestID** | **int** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/NullableClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NullableClass.md new file mode 100644 index 000000000000..c9afe86510da --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NullableClass.md @@ -0,0 +1,21 @@ +# Org.OpenAPITools.Model.NullableClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayAndItemsNullableProp** | **List<Object>** | | [optional] +**ArrayItemsNullable** | **List<Object>** | | [optional] +**ArrayNullableProp** | **List<Object>** | | [optional] +**BooleanProp** | **bool** | | [optional] +**DateProp** | **DateOnly** | | [optional] +**DatetimeProp** | **DateTime** | | [optional] +**IntegerProp** | **int** | | [optional] +**NumberProp** | **decimal** | | [optional] +**ObjectAndItemsNullableProp** | **Dictionary<string, Object>** | | [optional] +**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] +**ObjectNullableProp** | **Dictionary<string, Object>** | | [optional] +**StringProp** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NullableGuidClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NullableGuidClass.md new file mode 100644 index 000000000000..8d939afe9984 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NullableGuidClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.NullableGuidClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NullableShape.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NullableShape.md new file mode 100644 index 000000000000..2720167ccaaa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NullableShape.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.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. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/NumberOnly.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NumberOnly.md new file mode 100644 index 000000000000..1b83cce764d3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/NumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.NumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ObjectWithDeprecatedFields.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..9f44c24d19ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ObjectWithDeprecatedFields.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.ObjectWithDeprecatedFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bars** | **List<string>** | | [optional] +**DeprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**Id** | **decimal** | | [optional] +**Uuid** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OneOfString.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OneOfString.md new file mode 100644 index 000000000000..54caf618776c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OneOfString.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OneOfString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/Order.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Order.md new file mode 100644 index 000000000000..f3fcb0f21f87 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Order.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Complete** | **bool** | | [optional] [default to false] +**Id** | **long** | | [optional] +**PetId** | **long** | | [optional] +**Quantity** | **int** | | [optional] +**ShipDate** | **DateTime** | | [optional] +**Status** | **OrderStatus** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OrderStatus.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OrderStatus.md new file mode 100644 index 000000000000..5a80d8efa8ce --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OrderStatus.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.OrderStatus +Order Status + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/OuterComposite.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterComposite.md new file mode 100644 index 000000000000..8985c59d094f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterComposite.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.OuterComposite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyBoolean** | **bool** | | [optional] +**MyNumber** | **decimal** | | [optional] +**MyString** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnum.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnum.md new file mode 100644 index 000000000000..36844bc4b175 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnum.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/OuterEnumDefaultValue.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..351383f0aeae --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnumDefaultValue.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/OuterEnumInteger.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnumInteger.md new file mode 100644 index 000000000000..1013b5b19565 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnumInteger.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..55e314e3102d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumIntegerDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/OuterEnumTest.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnumTest.md new file mode 100644 index 000000000000..b99d27c2c2e7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/OuterEnumTest.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/ParentPet.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ParentPet.md new file mode 100644 index 000000000000..bdf570056372 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ParentPet.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ParentPet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/Pet.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Pet.md new file mode 100644 index 000000000000..2de6e7ef512f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Pet.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Pet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] +**Status** | **PetStatus** | | [optional] +**Tags** | [**List<Tag>**](Tag.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/PetStatus.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/PetStatus.md new file mode 100644 index 000000000000..c710ca8cbcef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/PetStatus.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.PetStatus +pet status in the store + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/Pig.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Pig.md new file mode 100644 index 000000000000..fd7bb9359ac4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Pig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Pig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/PolymorphicProperty.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/PolymorphicProperty.md new file mode 100644 index 000000000000..4507ec41cd51 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/PolymorphicProperty.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.PolymorphicProperty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/Quadrilateral.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Quadrilateral.md new file mode 100644 index 000000000000..fbbf4f81cec6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Quadrilateral.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Quadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/QuadrilateralInterface.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/QuadrilateralInterface.md new file mode 100644 index 000000000000..756ba09c6ddf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/QuadrilateralInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.QuadrilateralInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/ReadOnlyFirst.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ReadOnlyFirst.md new file mode 100644 index 000000000000..afaf2ee4fb6c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ReadOnlyFirst + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [readonly] +**Baz** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClass.md new file mode 100644 index 000000000000..2c792f6b2197 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateOnly** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **RequiredClassRequiredNotnullableEnumInteger** | | +**RequiredNotnullableEnumIntegerOnly** | **RequiredClassRequiredNotnullableEnumIntegerOnly** | | +**RequiredNotnullableEnumString** | **RequiredClassRequiredNotnullableEnumString** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateOnly** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotRequiredNullableDateProp** | **DateOnly** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **RequiredClassRequiredNotnullableEnumInteger** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **RequiredClassRequiredNotnullableEnumIntegerOnly** | | [optional] +**NotrequiredNotnullableEnumString** | **RequiredClassRequiredNotnullableEnumString** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **RequiredClassRequiredNullableEnumInteger** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **RequiredClassRequiredNullableEnumIntegerOnly** | | [optional] +**NotrequiredNullableEnumString** | **RequiredClassRequiredNullableEnumString** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateOnly** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **RequiredClassRequiredNullableEnumInteger** | | +**RequiredNullableEnumIntegerOnly** | **RequiredClassRequiredNullableEnumIntegerOnly** | | +**RequiredNullableEnumString** | **RequiredClassRequiredNullableEnumString** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNotnullableEnumInteger.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNotnullableEnumInteger.md new file mode 100644 index 000000000000..e229576c45b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNotnullableEnumInteger.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.RequiredClassRequiredNotnullableEnumInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNotnullableEnumIntegerOnly.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNotnullableEnumIntegerOnly.md new file mode 100644 index 000000000000..da648bc919dc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNotnullableEnumIntegerOnly.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.RequiredClassRequiredNotnullableEnumIntegerOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNotnullableEnumString.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNotnullableEnumString.md new file mode 100644 index 000000000000..d0e080d727c8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNotnullableEnumString.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.RequiredClassRequiredNotnullableEnumString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNullableEnumInteger.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNullableEnumInteger.md new file mode 100644 index 000000000000..7f04aa4d2457 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNullableEnumInteger.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.RequiredClassRequiredNullableEnumInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNullableEnumIntegerOnly.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNullableEnumIntegerOnly.md new file mode 100644 index 000000000000..2d0eb8b05c51 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNullableEnumIntegerOnly.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.RequiredClassRequiredNullableEnumIntegerOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNullableEnumString.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNullableEnumString.md new file mode 100644 index 000000000000..cb0fbdac213d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RequiredClassRequiredNullableEnumString.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.RequiredClassRequiredNullableEnumString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/Return.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Return.md new file mode 100644 index 000000000000..ad96a170bbbb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Return.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Return +Model for testing reserved words + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Lock** | **string** | | +**Abstract** | **string** | | +**VarReturn** | **int** | | [optional] +**Unsafe** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RolesReportsHash.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RolesReportsHash.md new file mode 100644 index 000000000000..d92c01de9ef7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RolesReportsHash.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.RolesReportsHash +Role report Hash + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Role** | [**RolesReportsHashRole**](RolesReportsHashRole.md) | | [optional] +**RoleUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RolesReportsHashRole.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RolesReportsHashRole.md new file mode 100644 index 000000000000..760f77b30e78 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/RolesReportsHashRole.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.RolesReportsHashRole + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ScaleneTriangle.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ScaleneTriangle.md new file mode 100644 index 000000000000..d3f15354bccc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ScaleneTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ScaleneTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/Shape.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Shape.md new file mode 100644 index 000000000000..ae75c5925401 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Shape.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Shape + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/ShapeInterface.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ShapeInterface.md new file mode 100644 index 000000000000..882d31868305 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ShapeInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ShapeInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/ShapeOrNull.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ShapeOrNull.md new file mode 100644 index 000000000000..7fcd31a3a5e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ShapeOrNull.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ShapeOrNull +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/SimpleQuadrilateral.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/SimpleQuadrilateral.md new file mode 100644 index 000000000000..a9c7f93b67ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/SimpleQuadrilateral.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.SimpleQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/SpecialModelName.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/SpecialModelName.md new file mode 100644 index 000000000000..890bcd923dee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/SpecialModelName.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.SpecialModelName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarSpecialModelName** | **string** | | [optional] +**SpecialPropertyName** | **long** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Tag.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Tag.md new file mode 100644 index 000000000000..2b2d9674d619 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Tag.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestCollectionEndingWithWordList.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestCollectionEndingWithWordList.md new file mode 100644 index 000000000000..5c5eb22d9a8a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestCollectionEndingWithWordList.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestCollectionEndingWithWordList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Value** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestCollectionEndingWithWordListObject.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestCollectionEndingWithWordListObject.md new file mode 100644 index 000000000000..cfa933cc576e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestCollectionEndingWithWordListObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestCollectionEndingWithWordListObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TestCollectionEndingWithWordList** | [**List<TestCollectionEndingWithWordList>**](TestCollectionEndingWithWordList.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersEnumHeaderStringParameter.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersEnumHeaderStringParameter.md new file mode 100644 index 000000000000..b5768f76fa5c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersEnumHeaderStringParameter.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.TestEnumParametersEnumHeaderStringParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersEnumQueryDoubleParameter.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersEnumQueryDoubleParameter.md new file mode 100644 index 000000000000..72510955c1a9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersEnumQueryDoubleParameter.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.TestEnumParametersEnumQueryDoubleParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersEnumQueryIntegerParameter.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersEnumQueryIntegerParameter.md new file mode 100644 index 000000000000..b2c9b9c5a9d9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersEnumQueryIntegerParameter.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.TestEnumParametersEnumQueryIntegerParameter + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersRequestEnumFormString.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersRequestEnumFormString.md new file mode 100644 index 000000000000..b734496b5fb8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersRequestEnumFormString.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestEnumParametersRequestEnumFormString +Form parameter enum test (string) + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersRequestEnumFormStringArrayInner.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersRequestEnumFormStringArrayInner.md new file mode 100644 index 000000000000..ca4e762853a0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestEnumParametersRequestEnumFormStringArrayInner.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.TestEnumParametersRequestEnumFormStringArrayInner + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..b6f9fc948474 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestInlineFreeformAdditionalPropertiesRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SomeProperty** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Triangle.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Triangle.md new file mode 100644 index 000000000000..e15109911958 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Triangle.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Triangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/TriangleInterface.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TriangleInterface.md new file mode 100644 index 000000000000..4127c08b14f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/TriangleInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TriangleInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/FormModels/docs/models/User.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/User.md new file mode 100644 index 000000000000..b5700f1c75d9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/User.md @@ -0,0 +1,21 @@ +# Org.OpenAPITools.Model.User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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] +**Email** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**Id** | **long** | | [optional] +**LastName** | **string** | | [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] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int** | User Status | [optional] +**Username** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Whale.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Whale.md new file mode 100644 index 000000000000..1c633fdce61b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Whale.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Whale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**HasBaleen** | **bool** | | [optional] +**HasTeeth** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Zebra.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Zebra.md new file mode 100644 index 000000000000..5b0d67809694 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/Zebra.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Zebra + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Type** | **ZebraType** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZebraType.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZebraType.md new file mode 100644 index 000000000000..d31970174902 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZebraType.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ZebraType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/ZeroBasedEnum.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZeroBasedEnum.md new file mode 100644 index 000000000000..cb71966c4c81 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZeroBasedEnum.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ZeroBasedEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/models/ZeroBasedEnumClass.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZeroBasedEnumClass.md new file mode 100644 index 000000000000..afb2e8630644 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **ZeroBasedEnumClassZeroBasedEnum** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZeroBasedEnumClassZeroBasedEnum.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZeroBasedEnumClassZeroBasedEnum.md new file mode 100644 index 000000000000..bf5145894ad6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/models/ZeroBasedEnumClassZeroBasedEnum.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClassZeroBasedEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/FormModels/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs new file mode 100644 index 000000000000..cf82a3e39bd6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing AnotherFakeApi + /// + public sealed class AnotherFakeApiTests : ApiTestsBase + { + private readonly IAnotherFakeApi _instance; + + public AnotherFakeApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test Call123TestSpecialTags + /// + [Fact (Skip = "not implemented")] + public async Task Call123TestSpecialTagsAsyncTest() + { + ModelClient modelClient = default; + var response = await _instance.Call123TestSpecialTagsAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..03ad026fa146 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,81 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + string apiKeyTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken2 = new(apiKeyTokenValue2, ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + string bearerTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + BearerToken bearerToken1 = new(bearerTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + string basicTokenUsername1 = context.Configuration[""] ?? throw new Exception("Username not found."); + string basicTokenPassword1 = context.Configuration[""] ?? throw new Exception("Password not found."); + BasicToken basicToken1 = new(basicTokenUsername1, basicTokenPassword1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 000000000000..88cf05ba9ed8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing DefaultApi + /// + public sealed class DefaultApiTests : ApiTestsBase + { + private readonly IDefaultApi _instance; + + public DefaultApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test FooGet + /// + [Fact (Skip = "not implemented")] + public async Task FooGetAsyncTest() + { + var response = await _instance.FooGetAsync(); + var model = response.Default(); + Assert.IsType(model); + } + + /// + /// Test GetCountry + /// + [Fact (Skip = "not implemented")] + public async Task GetCountryAsyncTest() + { + string country = default; + await _instance.GetCountryAsync(country); + } + + /// + /// Test Hello + /// + [Fact (Skip = "not implemented")] + public async Task HelloAsyncTest() + { + var response = await _instance.HelloAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test RolesReportGet + /// + [Fact (Skip = "not implemented")] + public async Task RolesReportGetAsyncTest() + { + var response = await _instance.RolesReportGetAsync(); + var model = response.Ok(); + Assert.IsType>>(model); + } + + /// + /// Test Test + /// + [Fact (Skip = "not implemented")] + public async Task TestAsyncTest() + { + var response = await _instance.TestAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..028d71f43359 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,243 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var anotherFakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var anotherFakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var anotherFakeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var anotherFakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs new file mode 100644 index 000000000000..495d785314c5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -0,0 +1,303 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing FakeApi + /// + public sealed class FakeApiTests : ApiTestsBase + { + private readonly IFakeApi _instance; + + public FakeApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test FakeHealthGet + /// + [Fact (Skip = "not implemented")] + public async Task FakeHealthGetAsyncTest() + { + var response = await _instance.FakeHealthGetAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterBooleanSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterBooleanSerializeAsyncTest() + { + Client.Option body = default; + var response = await _instance.FakeOuterBooleanSerializeAsync(body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterCompositeSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterCompositeSerializeAsyncTest() + { + Client.Option outerComposite = default; + var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterNumberSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterNumberSerializeAsyncTest() + { + Client.Option body = default; + var response = await _instance.FakeOuterNumberSerializeAsync(body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterStringSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterStringSerializeAsyncTest() + { + Guid requiredStringUuid = default; + Client.Option body = default; + var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test GetArrayOfEnums + /// + [Fact (Skip = "not implemented")] + public async Task GetArrayOfEnumsAsyncTest() + { + var response = await _instance.GetArrayOfEnumsAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetMixedAnyOf + /// + [Fact (Skip = "not implemented")] + public async Task GetMixedAnyOfAsyncTest() + { + var response = await _instance.GetMixedAnyOfAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test GetMixedOneOf + /// + [Fact (Skip = "not implemented")] + public async Task GetMixedOneOfAsyncTest() + { + var response = await _instance.GetMixedOneOfAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test TestAdditionalPropertiesReference + /// + [Fact (Skip = "not implemented")] + public async Task TestAdditionalPropertiesReferenceAsyncTest() + { + Dictionary requestBody = default; + await _instance.TestAdditionalPropertiesReferenceAsync(requestBody); + } + + /// + /// Test TestBodyWithFileSchema + /// + [Fact (Skip = "not implemented")] + public async Task TestBodyWithFileSchemaAsyncTest() + { + FileSchemaTestClass fileSchemaTestClass = default; + await _instance.TestBodyWithFileSchemaAsync(fileSchemaTestClass); + } + + /// + /// Test TestBodyWithQueryParams + /// + [Fact (Skip = "not implemented")] + public async Task TestBodyWithQueryParamsAsyncTest() + { + string query = default; + User user = default; + await _instance.TestBodyWithQueryParamsAsync(query, user); + } + + /// + /// Test TestClientModel + /// + [Fact (Skip = "not implemented")] + public async Task TestClientModelAsyncTest() + { + ModelClient modelClient = default; + var response = await _instance.TestClientModelAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test TestEndpointParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestEndpointParametersAsyncTest() + { + decimal number = default; + string patternWithoutDelimiter = default; + byte[] varByte = default; + double varDouble = default; + Client.Option binary = default; + Client.Option callback = default; + Client.Option date = default; + Client.Option dateTime = default; + Client.Option int32 = default; + Client.Option int64 = default; + Client.Option integer = default; + Client.Option password = default; + Client.Option varFloat = default; + Client.Option varString = default; + await _instance.TestEndpointParametersAsync(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + } + + /// + /// Test TestEnumParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestEnumParametersAsyncTest() + { + Client.Option enumFormString = default; + Client.Option> enumFormStringArray = default; + Client.Option enumHeaderString = default; + Client.Option> enumHeaderStringArray = default; + Client.Option enumQueryDouble = default; + Client.Option enumQueryInteger = default; + Client.Option enumQueryString = default; + Client.Option> enumQueryStringArray = default; + await _instance.TestEnumParametersAsync(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + } + + /// + /// Test TestGroupParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestGroupParametersAsyncTest() + { + bool requiredBooleanGroup = default; + long requiredInt64Group = default; + int requiredStringGroup = default; + Client.Option booleanGroup = default; + Client.Option int64Group = default; + Client.Option stringGroup = default; + await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + } + + /// + /// Test TestInlineAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineAdditionalPropertiesAsyncTest() + { + Dictionary requestBody = default; + await _instance.TestInlineAdditionalPropertiesAsync(requestBody); + } + + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + + /// + /// Test TestJsonFormData + /// + [Fact (Skip = "not implemented")] + public async Task TestJsonFormDataAsyncTest() + { + string param = default; + string param2 = default; + await _instance.TestJsonFormDataAsync(param, param2); + } + + /// + /// Test TestQueryParameterCollectionFormat + /// + [Fact (Skip = "not implemented")] + public async Task TestQueryParameterCollectionFormatAsyncTest() + { + List context = default; + List http = default; + List ioutil = default; + List pipe = default; + string requiredNotNullable = default; + List url = default; + Client.Option notRequiredNotNullable = default; + Client.Option notRequiredNullable = default; + string requiredNullable = default; + await _instance.TestQueryParameterCollectionFormatAsync(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + } + + /// + /// Test TestStringMapReference + /// + [Fact (Skip = "not implemented")] + public async Task TestStringMapReferenceAsyncTest() + { + Dictionary requestBody = default; + await _instance.TestStringMapReferenceAsync(requestBody); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs new file mode 100644 index 000000000000..5964bf6e51d6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing FakeClassnameTags123Api + /// + public sealed class FakeClassnameTags123ApiTests : ApiTestsBase + { + private readonly IFakeClassnameTags123Api _instance; + + public FakeClassnameTags123ApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test TestClassname + /// + [Fact (Skip = "not implemented")] + public async Task TestClassnameAsyncTest() + { + ModelClient modelClient = default; + var response = await _instance.TestClassnameAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/PetApiTests.cs new file mode 100644 index 000000000000..1f1d7f6c4576 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -0,0 +1,160 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing PetApi + /// + public sealed class PetApiTests : ApiTestsBase + { + private readonly IPetApi _instance; + + public PetApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test AddPet + /// + [Fact (Skip = "not implemented")] + public async Task AddPetAsyncTest() + { + Pet pet = default; + await _instance.AddPetAsync(pet); + } + + /// + /// Test DeletePet + /// + [Fact (Skip = "not implemented")] + public async Task DeletePetAsyncTest() + { + long petId = default; + Client.Option apiKey = default; + await _instance.DeletePetAsync(petId, apiKey); + } + + /// + /// Test FindPetsByStatus + /// + [Fact (Skip = "not implemented")] + public async Task FindPetsByStatusAsyncTest() + { + List status = default; + var response = await _instance.FindPetsByStatusAsync(status); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test FindPetsByTags + /// + [Fact (Skip = "not implemented")] + public async Task FindPetsByTagsAsyncTest() + { + List tags = default; + var response = await _instance.FindPetsByTagsAsync(tags); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetPetById + /// + [Fact (Skip = "not implemented")] + public async Task GetPetByIdAsyncTest() + { + long petId = default; + var response = await _instance.GetPetByIdAsync(petId); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test UpdatePet + /// + [Fact (Skip = "not implemented")] + public async Task UpdatePetAsyncTest() + { + Pet pet = default; + await _instance.UpdatePetAsync(pet); + } + + /// + /// Test UpdatePetWithForm + /// + [Fact (Skip = "not implemented")] + public async Task UpdatePetWithFormAsyncTest() + { + long petId = default; + Client.Option name = default; + Client.Option status = default; + await _instance.UpdatePetWithFormAsync(petId, name, status); + } + + /// + /// Test UploadFile + /// + [Fact (Skip = "not implemented")] + public async Task UploadFileAsyncTest() + { + long petId = default; + Client.Option additionalMetadata = default; + Client.Option file = default; + var response = await _instance.UploadFileAsync(petId, additionalMetadata, file); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test UploadFileWithRequiredFile + /// + [Fact (Skip = "not implemented")] + public async Task UploadFileWithRequiredFileAsyncTest() + { + long petId = default; + System.IO.Stream requiredFile = default; + Client.Option additionalMetadata = default; + var response = await _instance.UploadFileWithRequiredFileAsync(petId, requiredFile, additionalMetadata); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs new file mode 100644 index 000000000000..1b75e3417005 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing StoreApi + /// + public sealed class StoreApiTests : ApiTestsBase + { + private readonly IStoreApi _instance; + + public StoreApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test DeleteOrder + /// + [Fact (Skip = "not implemented")] + public async Task DeleteOrderAsyncTest() + { + string orderId = default; + await _instance.DeleteOrderAsync(orderId); + } + + /// + /// Test GetInventory + /// + [Fact (Skip = "not implemented")] + public async Task GetInventoryAsyncTest() + { + var response = await _instance.GetInventoryAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetOrderById + /// + [Fact (Skip = "not implemented")] + public async Task GetOrderByIdAsyncTest() + { + long orderId = default; + var response = await _instance.GetOrderByIdAsync(orderId); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test PlaceOrder + /// + [Fact (Skip = "not implemented")] + public async Task PlaceOrderAsyncTest() + { + Order order = default; + var response = await _instance.PlaceOrderAsync(order); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/UserApiTests.cs new file mode 100644 index 000000000000..5a655797609e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/UserApiTests.cs @@ -0,0 +1,138 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing UserApi + /// + public sealed class UserApiTests : ApiTestsBase + { + private readonly IUserApi _instance; + + public UserApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test CreateUser + /// + [Fact (Skip = "not implemented")] + public async Task CreateUserAsyncTest() + { + User user = default; + await _instance.CreateUserAsync(user); + } + + /// + /// Test CreateUsersWithArrayInput + /// + [Fact (Skip = "not implemented")] + public async Task CreateUsersWithArrayInputAsyncTest() + { + List user = default; + await _instance.CreateUsersWithArrayInputAsync(user); + } + + /// + /// Test CreateUsersWithListInput + /// + [Fact (Skip = "not implemented")] + public async Task CreateUsersWithListInputAsyncTest() + { + List user = default; + await _instance.CreateUsersWithListInputAsync(user); + } + + /// + /// Test DeleteUser + /// + [Fact (Skip = "not implemented")] + public async Task DeleteUserAsyncTest() + { + string username = default; + await _instance.DeleteUserAsync(username); + } + + /// + /// Test GetUserByName + /// + [Fact (Skip = "not implemented")] + public async Task GetUserByNameAsyncTest() + { + string username = default; + var response = await _instance.GetUserByNameAsync(username); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test LoginUser + /// + [Fact (Skip = "not implemented")] + public async Task LoginUserAsyncTest() + { + string password = default; + string username = default; + var response = await _instance.LoginUserAsync(password, username); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test LogoutUser + /// + [Fact (Skip = "not implemented")] + public async Task LogoutUserAsyncTest() + { + await _instance.LogoutUserAsync(); + } + + /// + /// Test UpdateUser + /// + [Fact (Skip = "not implemented")] + public async Task UpdateUserAsyncTest() + { + User user = default; + string username = default; + await _instance.UpdateUserAsync(user, username); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs new file mode 100644 index 000000000000..adbf639fd720 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ActivityOutputElementRepresentation + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActivityOutputElementRepresentationTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ActivityOutputElementRepresentation + //private ActivityOutputElementRepresentation instance; + + public ActivityOutputElementRepresentationTests() + { + // TODO uncomment below to create an instance of ActivityOutputElementRepresentation + //instance = new ActivityOutputElementRepresentation(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ActivityOutputElementRepresentation + /// + [Fact] + public void ActivityOutputElementRepresentationInstanceTest() + { + // TODO uncomment below to test "IsType" ActivityOutputElementRepresentation + //Assert.IsType(instance); + } + + /// + /// Test the property 'Prop1' + /// + [Fact] + public void Prop1Test() + { + // TODO unit test for the property 'Prop1' + } + + /// + /// Test the property 'Prop2' + /// + [Fact] + public void Prop2Test() + { + // TODO unit test for the property 'Prop2' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ActivityTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ActivityTests.cs new file mode 100644 index 000000000000..6cc2927eaaf3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ActivityTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Activity + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActivityTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Activity + //private Activity instance; + + public ActivityTests() + { + // TODO uncomment below to create an instance of Activity + //instance = new Activity(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Activity + /// + [Fact] + public void ActivityInstanceTest() + { + // TODO uncomment below to test "IsType" Activity + //Assert.IsType(instance); + } + + /// + /// Test the property 'ActivityOutputs' + /// + [Fact] + public void ActivityOutputsTest() + { + // TODO unit test for the property 'ActivityOutputs' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs new file mode 100644 index 000000000000..e157b477193e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -0,0 +1,128 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing AdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for AdditionalPropertiesClass + //private AdditionalPropertiesClass instance; + + public AdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of AdditionalPropertiesClass + //instance = new AdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AdditionalPropertiesClass + /// + [Fact] + public void AdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsType" AdditionalPropertiesClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'Anytype1' + /// + [Fact] + public void Anytype1Test() + { + // TODO unit test for the property 'Anytype1' + } + + /// + /// Test the property 'EmptyMap' + /// + [Fact] + public void EmptyMapTest() + { + // TODO unit test for the property 'EmptyMap' + } + + /// + /// Test the property 'MapOfMapProperty' + /// + [Fact] + public void MapOfMapPropertyTest() + { + // TODO unit test for the property 'MapOfMapProperty' + } + + /// + /// Test the property 'MapProperty' + /// + [Fact] + public void MapPropertyTest() + { + // TODO unit test for the property 'MapProperty' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype1' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype1Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype1' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype2' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype2Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype2' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype3' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype3Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype3' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesString' + /// + [Fact] + public void MapWithUndeclaredPropertiesStringTest() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AnimalTests.cs new file mode 100644 index 000000000000..1db9725afb85 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AnimalTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Animal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AnimalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Animal + //private Animal instance; + + public AnimalTests() + { + // TODO uncomment below to create an instance of Animal + //instance = new Animal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Animal + /// + [Fact] + public void AnimalInstanceTest() + { + // TODO uncomment below to test "IsType" Animal + //Assert.IsType(instance); + } + + /// + /// Test deserialize a Cat from type Animal + /// + [Fact] + public void CatDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Cat from type Animal + //Assert.IsType(JsonConvert.DeserializeObject(new Cat().ToJson())); + } + + /// + /// Test deserialize a Dog from type Animal + /// + [Fact] + public void DogDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Dog from type Animal + //Assert.IsType(JsonConvert.DeserializeObject(new Dog().ToJson())); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs new file mode 100644 index 000000000000..c296a82116a7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ApiResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ApiResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ApiResponse + //private ApiResponse instance; + + public ApiResponseTests() + { + // TODO uncomment below to create an instance of ApiResponse + //instance = new ApiResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ApiResponse + /// + [Fact] + public void ApiResponseInstanceTest() + { + // TODO uncomment below to test "IsType" ApiResponse + //Assert.IsType(instance); + } + + /// + /// Test the property 'Code' + /// + [Fact] + public void CodeTest() + { + // TODO unit test for the property 'Code' + } + + /// + /// Test the property 'Message' + /// + [Fact] + public void MessageTest() + { + // TODO unit test for the property 'Message' + } + + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs new file mode 100644 index 000000000000..d698ee445048 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing AppleReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for AppleReq + //private AppleReq instance; + + public AppleReqTests() + { + // TODO uncomment below to create an instance of AppleReq + //instance = new AppleReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AppleReq + /// + [Fact] + public void AppleReqInstanceTest() + { + // TODO uncomment below to test "IsType" AppleReq + //Assert.IsType(instance); + } + + /// + /// Test the property 'Cultivar' + /// + [Fact] + public void CultivarTest() + { + // TODO unit test for the property 'Cultivar' + } + + /// + /// Test the property 'Mealy' + /// + [Fact] + public void MealyTest() + { + // TODO unit test for the property 'Mealy' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AppleTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AppleTests.cs new file mode 100644 index 000000000000..c7c8ccd47c11 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/AppleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Apple + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Apple + //private Apple instance; + + public AppleTests() + { + // TODO uncomment below to create an instance of Apple + //instance = new Apple(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Apple + /// + [Fact] + public void AppleInstanceTest() + { + // TODO uncomment below to test "IsType" Apple + //Assert.IsType(instance); + } + + /// + /// Test the property 'ColorCode' + /// + [Fact] + public void ColorCodeTest() + { + // TODO unit test for the property 'ColorCode' + } + + /// + /// Test the property 'Cultivar' + /// + [Fact] + public void CultivarTest() + { + // TODO unit test for the property 'Cultivar' + } + + /// + /// Test the property 'Origin' + /// + [Fact] + public void OriginTest() + { + // TODO unit test for the property 'Origin' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs new file mode 100644 index 000000000000..29fe9cfb1d47 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayOfArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfArrayOfNumberOnly + //private ArrayOfArrayOfNumberOnly instance; + + public ArrayOfArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfArrayOfNumberOnly + //instance = new ArrayOfArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfArrayOfNumberOnly + /// + [Fact] + public void ArrayOfArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayOfArrayOfNumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayArrayNumber' + /// + [Fact] + public void ArrayArrayNumberTest() + { + // TODO unit test for the property 'ArrayArrayNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs new file mode 100644 index 000000000000..2b0956c0b984 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfNumberOnly + //private ArrayOfNumberOnly instance; + + public ArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfNumberOnly + //instance = new ArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfNumberOnly + /// + [Fact] + public void ArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayOfNumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayNumber' + /// + [Fact] + public void ArrayNumberTest() + { + // TODO unit test for the property 'ArrayNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs new file mode 100644 index 000000000000..3b01d0b7abbc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayTest + //private ArrayTest instance; + + public ArrayTestTests() + { + // TODO uncomment below to create an instance of ArrayTest + //instance = new ArrayTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayTest + /// + [Fact] + public void ArrayTestInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayArrayOfInteger' + /// + [Fact] + public void ArrayArrayOfIntegerTest() + { + // TODO unit test for the property 'ArrayArrayOfInteger' + } + + /// + /// Test the property 'ArrayArrayOfModel' + /// + [Fact] + public void ArrayArrayOfModelTest() + { + // TODO unit test for the property 'ArrayArrayOfModel' + } + + /// + /// Test the property 'ArrayOfString' + /// + [Fact] + public void ArrayOfStringTest() + { + // TODO unit test for the property 'ArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs new file mode 100644 index 000000000000..1e54c1f3e41d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing BananaReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for BananaReq + //private BananaReq instance; + + public BananaReqTests() + { + // TODO uncomment below to create an instance of BananaReq + //instance = new BananaReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of BananaReq + /// + [Fact] + public void BananaReqInstanceTest() + { + // TODO uncomment below to test "IsType" BananaReq + //Assert.IsType(instance); + } + + /// + /// Test the property 'LengthCm' + /// + [Fact] + public void LengthCmTest() + { + // TODO unit test for the property 'LengthCm' + } + + /// + /// Test the property 'Sweet' + /// + [Fact] + public void SweetTest() + { + // TODO unit test for the property 'Sweet' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/BananaTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/BananaTests.cs new file mode 100644 index 000000000000..5a88e9dabbdf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/BananaTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Banana + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Banana + //private Banana instance; + + public BananaTests() + { + // TODO uncomment below to create an instance of Banana + //instance = new Banana(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Banana + /// + [Fact] + public void BananaInstanceTest() + { + // TODO uncomment below to test "IsType" Banana + //Assert.IsType(instance); + } + + /// + /// Test the property 'LengthCm' + /// + [Fact] + public void LengthCmTest() + { + // TODO unit test for the property 'LengthCm' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs new file mode 100644 index 000000000000..4ffd6c2c0c87 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing BasquePig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BasquePigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for BasquePig + //private BasquePig instance; + + public BasquePigTests() + { + // TODO uncomment below to create an instance of BasquePig + //instance = new BasquePig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of BasquePig + /// + [Fact] + public void BasquePigInstanceTest() + { + // TODO uncomment below to test "IsType" BasquePig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs new file mode 100644 index 000000000000..d0391fb47f8f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Capitalization + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CapitalizationTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Capitalization + //private Capitalization instance; + + public CapitalizationTests() + { + // TODO uncomment below to create an instance of Capitalization + //instance = new Capitalization(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Capitalization + /// + [Fact] + public void CapitalizationInstanceTest() + { + // TODO uncomment below to test "IsType" Capitalization + //Assert.IsType(instance); + } + + /// + /// Test the property 'ATT_NAME' + /// + [Fact] + public void ATT_NAMETest() + { + // TODO unit test for the property 'ATT_NAME' + } + + /// + /// Test the property 'CapitalCamel' + /// + [Fact] + public void CapitalCamelTest() + { + // TODO unit test for the property 'CapitalCamel' + } + + /// + /// Test the property 'CapitalSnake' + /// + [Fact] + public void CapitalSnakeTest() + { + // TODO unit test for the property 'CapitalSnake' + } + + /// + /// Test the property 'SCAETHFlowPoints' + /// + [Fact] + public void SCAETHFlowPointsTest() + { + // TODO unit test for the property 'SCAETHFlowPoints' + } + + /// + /// Test the property 'SmallCamel' + /// + [Fact] + public void SmallCamelTest() + { + // TODO unit test for the property 'SmallCamel' + } + + /// + /// Test the property 'SmallSnake' + /// + [Fact] + public void SmallSnakeTest() + { + // TODO unit test for the property 'SmallSnake' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CatTests.cs new file mode 100644 index 000000000000..a5d4bf43bbfd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CatTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Cat + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CatTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Cat + //private Cat instance; + + public CatTests() + { + // TODO uncomment below to create an instance of Cat + //instance = new Cat(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Cat + /// + [Fact] + public void CatInstanceTest() + { + // TODO uncomment below to test "IsType" Cat + //Assert.IsType(instance); + } + + /// + /// Test the property 'Declawed' + /// + [Fact] + public void DeclawedTest() + { + // TODO unit test for the property 'Declawed' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CategoryTests.cs new file mode 100644 index 000000000000..7fe8f333c81a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Category + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CategoryTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Category + //private Category instance; + + public CategoryTests() + { + // TODO uncomment below to create an instance of Category + //instance = new Category(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Category + /// + [Fact] + public void CategoryInstanceTest() + { + // TODO uncomment below to test "IsType" Category + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ChildCatAllOfPetTypeTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ChildCatAllOfPetTypeTests.cs new file mode 100644 index 000000000000..f24fa44b0e0f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ChildCatAllOfPetTypeTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ChildCatAllOfPetType + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ChildCatAllOfPetTypeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ChildCatAllOfPetType + //private ChildCatAllOfPetType instance; + + public ChildCatAllOfPetTypeTests() + { + // TODO uncomment below to create an instance of ChildCatAllOfPetType + //instance = new ChildCatAllOfPetType(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ChildCatAllOfPetType + /// + [Fact] + public void ChildCatAllOfPetTypeInstanceTest() + { + // TODO uncomment below to test "IsType" ChildCatAllOfPetType + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs new file mode 100644 index 000000000000..4aecdf9bed37 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ChildCat + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ChildCatTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ChildCat + //private ChildCat instance; + + public ChildCatTests() + { + // TODO uncomment below to create an instance of ChildCat + //instance = new ChildCat(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ChildCat + /// + [Fact] + public void ChildCatInstanceTest() + { + // TODO uncomment below to test "IsType" ChildCat + //Assert.IsType(instance); + } + + /// + /// Test the property 'PetType' + /// + [Fact] + public void PetTypeTest() + { + // TODO unit test for the property 'PetType' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs new file mode 100644 index 000000000000..a866bfbe242d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ClassModel + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ClassModelTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ClassModel + //private ClassModel instance; + + public ClassModelTests() + { + // TODO uncomment below to create an instance of ClassModel + //instance = new ClassModel(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ClassModel + /// + [Fact] + public void ClassModelInstanceTest() + { + // TODO uncomment below to test "IsType" ClassModel + //Assert.IsType(instance); + } + + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs new file mode 100644 index 000000000000..a7a864154acf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ComplexQuadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ComplexQuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ComplexQuadrilateral + //private ComplexQuadrilateral instance; + + public ComplexQuadrilateralTests() + { + // TODO uncomment below to create an instance of ComplexQuadrilateral + //instance = new ComplexQuadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ComplexQuadrilateral + /// + [Fact] + public void ComplexQuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" ComplexQuadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs new file mode 100644 index 000000000000..e7c505b5136d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DanishPig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DanishPigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DanishPig + //private DanishPig instance; + + public DanishPigTests() + { + // TODO uncomment below to create an instance of DanishPig + //instance = new DanishPig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DanishPig + /// + [Fact] + public void DanishPigInstanceTest() + { + // TODO uncomment below to test "IsType" DanishPig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs new file mode 100644 index 000000000000..83a4185e53d2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DateOnlyClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DateOnlyClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DateOnlyClass + //private DateOnlyClass instance; + + public DateOnlyClassTests() + { + // TODO uncomment below to create an instance of DateOnlyClass + //instance = new DateOnlyClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DateOnlyClass + /// + [Fact] + public void DateOnlyClassInstanceTest() + { + // TODO uncomment below to test "IsType" DateOnlyClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'DateOnlyProperty' + /// + [Fact] + public void DateOnlyPropertyTest() + { + // TODO unit test for the property 'DateOnlyProperty' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs new file mode 100644 index 000000000000..95e56f782da3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DeprecatedObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DeprecatedObjectTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DeprecatedObject + //private DeprecatedObject instance; + + public DeprecatedObjectTests() + { + // TODO uncomment below to create an instance of DeprecatedObject + //instance = new DeprecatedObject(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DeprecatedObject + /// + [Fact] + public void DeprecatedObjectInstanceTest() + { + // TODO uncomment below to test "IsType" DeprecatedObject + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DogTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DogTests.cs new file mode 100644 index 000000000000..b8e8bca05384 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DogTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Dog + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DogTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Dog + //private Dog instance; + + public DogTests() + { + // TODO uncomment below to create an instance of Dog + //instance = new Dog(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Dog + /// + [Fact] + public void DogInstanceTest() + { + // TODO uncomment below to test "IsType" Dog + //Assert.IsType(instance); + } + + /// + /// Test the property 'Breed' + /// + [Fact] + public void BreedTest() + { + // TODO unit test for the property 'Breed' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DrawingTests.cs new file mode 100644 index 000000000000..a2de4a1b97b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/DrawingTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Drawing + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DrawingTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Drawing + //private Drawing instance; + + public DrawingTests() + { + // TODO uncomment below to create an instance of Drawing + //instance = new Drawing(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Drawing + /// + [Fact] + public void DrawingInstanceTest() + { + // TODO uncomment below to test "IsType" Drawing + //Assert.IsType(instance); + } + + /// + /// Test the property 'MainShape' + /// + [Fact] + public void MainShapeTest() + { + // TODO unit test for the property 'MainShape' + } + + /// + /// Test the property 'NullableShape' + /// + [Fact] + public void NullableShapeTest() + { + // TODO unit test for the property 'NullableShape' + } + + /// + /// Test the property 'ShapeOrNull' + /// + [Fact] + public void ShapeOrNullTest() + { + // TODO unit test for the property 'ShapeOrNull' + } + + /// + /// Test the property 'Shapes' + /// + [Fact] + public void ShapesTest() + { + // TODO unit test for the property 'Shapes' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysArrayEnumInnerTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysArrayEnumInnerTests.cs new file mode 100644 index 000000000000..131ed18d63fd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysArrayEnumInnerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumArraysArrayEnumInner + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumArraysArrayEnumInnerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumArraysArrayEnumInner + //private EnumArraysArrayEnumInner instance; + + public EnumArraysArrayEnumInnerTests() + { + // TODO uncomment below to create an instance of EnumArraysArrayEnumInner + //instance = new EnumArraysArrayEnumInner(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumArraysArrayEnumInner + /// + [Fact] + public void EnumArraysArrayEnumInnerInstanceTest() + { + // TODO uncomment below to test "IsType" EnumArraysArrayEnumInner + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysJustSymbolTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysJustSymbolTests.cs new file mode 100644 index 000000000000..98fb4af3a1ce --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysJustSymbolTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumArraysJustSymbol + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumArraysJustSymbolTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumArraysJustSymbol + //private EnumArraysJustSymbol instance; + + public EnumArraysJustSymbolTests() + { + // TODO uncomment below to create an instance of EnumArraysJustSymbol + //instance = new EnumArraysJustSymbol(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumArraysJustSymbol + /// + [Fact] + public void EnumArraysJustSymbolInstanceTest() + { + // TODO uncomment below to test "IsType" EnumArraysJustSymbol + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs new file mode 100644 index 000000000000..c6fee27690b7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumArrays + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumArraysTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumArrays + //private EnumArrays instance; + + public EnumArraysTests() + { + // TODO uncomment below to create an instance of EnumArrays + //instance = new EnumArrays(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumArrays + /// + [Fact] + public void EnumArraysInstanceTest() + { + // TODO uncomment below to test "IsType" EnumArrays + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayEnum' + /// + [Fact] + public void ArrayEnumTest() + { + // TODO unit test for the property 'ArrayEnum' + } + + /// + /// Test the property 'JustSymbol' + /// + [Fact] + public void JustSymbolTest() + { + // TODO unit test for the property 'JustSymbol' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs new file mode 100644 index 000000000000..44dbbe4d324a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumClass + //private EnumClass instance; + + public EnumClassTests() + { + // TODO uncomment below to create an instance of EnumClass + //instance = new EnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumClass + /// + [Fact] + public void EnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" EnumClass + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestEnumIntegerOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestEnumIntegerOnlyTests.cs new file mode 100644 index 000000000000..5354a6a395c7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestEnumIntegerOnlyTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumTestEnumIntegerOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumTestEnumIntegerOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumTestEnumIntegerOnly + //private EnumTestEnumIntegerOnly instance; + + public EnumTestEnumIntegerOnlyTests() + { + // TODO uncomment below to create an instance of EnumTestEnumIntegerOnly + //instance = new EnumTestEnumIntegerOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumTestEnumIntegerOnly + /// + [Fact] + public void EnumTestEnumIntegerOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" EnumTestEnumIntegerOnly + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestEnumIntegerTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestEnumIntegerTests.cs new file mode 100644 index 000000000000..da32ebb09ad8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestEnumIntegerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumTestEnumInteger + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumTestEnumIntegerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumTestEnumInteger + //private EnumTestEnumInteger instance; + + public EnumTestEnumIntegerTests() + { + // TODO uncomment below to create an instance of EnumTestEnumInteger + //instance = new EnumTestEnumInteger(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumTestEnumInteger + /// + [Fact] + public void EnumTestEnumIntegerInstanceTest() + { + // TODO uncomment below to test "IsType" EnumTestEnumInteger + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestEnumStringTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestEnumStringTests.cs new file mode 100644 index 000000000000..02321eb5de63 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestEnumStringTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumTestEnumString + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumTestEnumStringTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumTestEnumString + //private EnumTestEnumString instance; + + public EnumTestEnumStringTests() + { + // TODO uncomment below to create an instance of EnumTestEnumString + //instance = new EnumTestEnumString(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumTestEnumString + /// + [Fact] + public void EnumTestEnumStringInstanceTest() + { + // TODO uncomment below to test "IsType" EnumTestEnumString + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs new file mode 100644 index 000000000000..3781eebbfcf2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumTest + //private EnumTest instance; + + public EnumTestTests() + { + // TODO uncomment below to create an instance of EnumTest + //instance = new EnumTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumTest + /// + [Fact] + public void EnumTestInstanceTest() + { + // TODO uncomment below to test "IsType" EnumTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + + /// + /// Test the property 'EnumInteger' + /// + [Fact] + public void EnumIntegerTest() + { + // TODO unit test for the property 'EnumInteger' + } + + /// + /// Test the property 'EnumIntegerOnly' + /// + [Fact] + public void EnumIntegerOnlyTest() + { + // TODO unit test for the property 'EnumIntegerOnly' + } + + /// + /// Test the property 'EnumNumber' + /// + [Fact] + public void EnumNumberTest() + { + // TODO unit test for the property 'EnumNumber' + } + + /// + /// Test the property 'EnumString' + /// + [Fact] + public void EnumStringTest() + { + // TODO unit test for the property 'EnumString' + } + + /// + /// Test the property 'OuterEnum' + /// + [Fact] + public void OuterEnumTest() + { + // TODO unit test for the property 'OuterEnum' + } + + /// + /// Test the property 'OuterEnumDefaultValue' + /// + [Fact] + public void OuterEnumDefaultValueTest() + { + // TODO unit test for the property 'OuterEnumDefaultValue' + } + + /// + /// Test the property 'OuterEnumInteger' + /// + [Fact] + public void OuterEnumIntegerTest() + { + // TODO unit test for the property 'OuterEnumInteger' + } + + /// + /// Test the property 'OuterEnumIntegerDefaultValue' + /// + [Fact] + public void OuterEnumIntegerDefaultValueTest() + { + // TODO unit test for the property 'OuterEnumIntegerDefaultValue' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs new file mode 100644 index 000000000000..f8d3daec3fe1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EquilateralTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EquilateralTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EquilateralTriangle + //private EquilateralTriangle instance; + + public EquilateralTriangleTests() + { + // TODO uncomment below to create an instance of EquilateralTriangle + //instance = new EquilateralTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EquilateralTriangle + /// + [Fact] + public void EquilateralTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" EquilateralTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 000000000000..e2685848d5ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FileSchemaTestClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + public FileSchemaTestClassTests() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Fact] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsType" FileSchemaTestClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'File' + /// + [Fact] + public void FileTest() + { + // TODO unit test for the property 'File' + } + + /// + /// Test the property 'Files' + /// + [Fact] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 000000000000..c305c5356b05 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FileTests : IDisposable + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + public FileTests() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of File + /// + [Fact] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsType" File + //Assert.IsType(instance); + } + + /// + /// Test the property 'SourceURI' + /// + [Fact] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FindPetsByStatusStatusParameterInnerTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FindPetsByStatusStatusParameterInnerTests.cs new file mode 100644 index 000000000000..33d0a40c8032 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FindPetsByStatusStatusParameterInnerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FindPetsByStatusStatusParameterInner + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FindPetsByStatusStatusParameterInnerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FindPetsByStatusStatusParameterInner + //private FindPetsByStatusStatusParameterInner instance; + + public FindPetsByStatusStatusParameterInnerTests() + { + // TODO uncomment below to create an instance of FindPetsByStatusStatusParameterInner + //instance = new FindPetsByStatusStatusParameterInner(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FindPetsByStatusStatusParameterInner + /// + [Fact] + public void FindPetsByStatusStatusParameterInnerInstanceTest() + { + // TODO uncomment below to test "IsType" FindPetsByStatusStatusParameterInner + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 000000000000..55086a7cf24b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FooTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FooTests.cs new file mode 100644 index 000000000000..871506eeaac5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FooTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Foo + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Foo + //private Foo instance; + + public FooTests() + { + // TODO uncomment below to create an instance of Foo + //instance = new Foo(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Foo + /// + [Fact] + public void FooInstanceTest() + { + // TODO uncomment below to test "IsType" Foo + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs new file mode 100644 index 000000000000..7dad1b08bc02 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FormatTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FormatTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FormatTest + //private FormatTest instance; + + public FormatTestTests() + { + // TODO uncomment below to create an instance of FormatTest + //instance = new FormatTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FormatTest + /// + [Fact] + public void FormatTestInstanceTest() + { + // TODO uncomment below to test "IsType" FormatTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'Byte' + /// + [Fact] + public void ByteTest() + { + // TODO unit test for the property 'Byte' + } + + /// + /// Test the property 'Date' + /// + [Fact] + public void DateTest() + { + // TODO unit test for the property 'Date' + } + + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + + /// + /// Test the property 'Decimal' + /// + [Fact] + public void DecimalTest() + { + // TODO unit test for the property 'Decimal' + } + + /// + /// Test the property 'Double' + /// + [Fact] + public void DoubleTest() + { + // TODO unit test for the property 'Double' + } + + /// + /// Test the property 'Float' + /// + [Fact] + public void FloatTest() + { + // TODO unit test for the property 'Float' + } + + /// + /// Test the property 'Int32' + /// + [Fact] + public void Int32Test() + { + // TODO unit test for the property 'Int32' + } + + /// + /// Test the property 'Int32Range' + /// + [Fact] + public void Int32RangeTest() + { + // TODO unit test for the property 'Int32Range' + } + + /// + /// Test the property 'Int64' + /// + [Fact] + public void Int64Test() + { + // TODO unit test for the property 'Int64' + } + + /// + /// Test the property 'Int64Negative' + /// + [Fact] + public void Int64NegativeTest() + { + // TODO unit test for the property 'Int64Negative' + } + + /// + /// Test the property 'Int64NegativeExclusive' + /// + [Fact] + public void Int64NegativeExclusiveTest() + { + // TODO unit test for the property 'Int64NegativeExclusive' + } + + /// + /// Test the property 'Int64Positive' + /// + [Fact] + public void Int64PositiveTest() + { + // TODO unit test for the property 'Int64Positive' + } + + /// + /// Test the property 'Int64PositiveExclusive' + /// + [Fact] + public void Int64PositiveExclusiveTest() + { + // TODO unit test for the property 'Int64PositiveExclusive' + } + + /// + /// Test the property 'Integer' + /// + [Fact] + public void IntegerTest() + { + // TODO unit test for the property 'Integer' + } + + /// + /// Test the property 'PatternWithBackslash' + /// + [Fact] + public void PatternWithBackslashTest() + { + // TODO unit test for the property 'PatternWithBackslash' + } + + /// + /// Test the property 'PatternWithDigits' + /// + [Fact] + public void PatternWithDigitsTest() + { + // TODO unit test for the property 'PatternWithDigits' + } + + /// + /// Test the property 'PatternWithDigitsAndDelimiter' + /// + [Fact] + public void PatternWithDigitsAndDelimiterTest() + { + // TODO unit test for the property 'PatternWithDigitsAndDelimiter' + } + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + /// + /// Test the property 'UnsignedInteger' + /// + [Fact] + public void UnsignedIntegerTest() + { + // TODO unit test for the property 'UnsignedInteger' + } + + /// + /// Test the property 'UnsignedLong' + /// + [Fact] + public void UnsignedLongTest() + { + // TODO unit test for the property 'UnsignedLong' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs new file mode 100644 index 000000000000..a33c55ae4875 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FruitReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FruitReq + //private FruitReq instance; + + public FruitReqTests() + { + // TODO uncomment below to create an instance of FruitReq + //instance = new FruitReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FruitReq + /// + [Fact] + public void FruitReqInstanceTest() + { + // TODO uncomment below to test "IsType" FruitReq + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FruitTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FruitTests.cs new file mode 100644 index 000000000000..46448efc62f4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/FruitTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Fruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Fruit + //private Fruit instance; + + public FruitTests() + { + // TODO uncomment below to create an instance of Fruit + //instance = new Fruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Fruit + /// + [Fact] + public void FruitInstanceTest() + { + // TODO uncomment below to test "IsType" Fruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs new file mode 100644 index 000000000000..7e79cd067925 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing GmFruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class GmFruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for GmFruit + //private GmFruit instance; + + public GmFruitTests() + { + // TODO uncomment below to create an instance of GmFruit + //instance = new GmFruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of GmFruit + /// + [Fact] + public void GmFruitInstanceTest() + { + // TODO uncomment below to test "IsType" GmFruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs new file mode 100644 index 000000000000..5f0e8672ed5f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing GrandparentAnimal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class GrandparentAnimalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for GrandparentAnimal + //private GrandparentAnimal instance; + + public GrandparentAnimalTests() + { + // TODO uncomment below to create an instance of GrandparentAnimal + //instance = new GrandparentAnimal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of GrandparentAnimal + /// + [Fact] + public void GrandparentAnimalInstanceTest() + { + // TODO uncomment below to test "IsType" GrandparentAnimal + //Assert.IsType(instance); + } + + /// + /// Test deserialize a ChildCat from type ParentPet + /// + [Fact] + public void ChildCatDeserializeFromParentPetTest() + { + // TODO uncomment below to test deserialize a ChildCat from type ParentPet + //Assert.IsType(JsonConvert.DeserializeObject(new ChildCat().ToJson())); + } + + /// + /// Test deserialize a ParentPet from type GrandparentAnimal + /// + [Fact] + public void ParentPetDeserializeFromGrandparentAnimalTest() + { + // TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal + //Assert.IsType(JsonConvert.DeserializeObject(new ParentPet().ToJson())); + } + + /// + /// Test the property 'PetType' + /// + [Fact] + public void PetTypeTest() + { + // TODO unit test for the property 'PetType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs new file mode 100644 index 000000000000..134a7d515ebb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing HasOnlyReadOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class HasOnlyReadOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for HasOnlyReadOnly + //private HasOnlyReadOnly instance; + + public HasOnlyReadOnlyTests() + { + // TODO uncomment below to create an instance of HasOnlyReadOnly + //instance = new HasOnlyReadOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of HasOnlyReadOnly + /// + [Fact] + public void HasOnlyReadOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" HasOnlyReadOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + /// + /// Test the property 'Foo' + /// + [Fact] + public void FooTest() + { + // TODO unit test for the property 'Foo' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs new file mode 100644 index 000000000000..18bb8672e980 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing HealthCheckResult + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class HealthCheckResultTests : IDisposable + { + // TODO uncomment below to declare an instance variable for HealthCheckResult + //private HealthCheckResult instance; + + public HealthCheckResultTests() + { + // TODO uncomment below to create an instance of HealthCheckResult + //instance = new HealthCheckResult(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of HealthCheckResult + /// + [Fact] + public void HealthCheckResultInstanceTest() + { + // TODO uncomment below to test "IsType" HealthCheckResult + //Assert.IsType(instance); + } + + /// + /// Test the property 'NullableMessage' + /// + [Fact] + public void NullableMessageTest() + { + // TODO unit test for the property 'NullableMessage' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs new file mode 100644 index 000000000000..464750233cd2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing IsoscelesTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class IsoscelesTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for IsoscelesTriangle + //private IsoscelesTriangle instance; + + public IsoscelesTriangleTests() + { + // TODO uncomment below to create an instance of IsoscelesTriangle + //instance = new IsoscelesTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of IsoscelesTriangle + /// + [Fact] + public void IsoscelesTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" IsoscelesTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ListTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ListTests.cs new file mode 100644 index 000000000000..d95303d97517 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ListTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing List + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ListTests : IDisposable + { + // TODO uncomment below to declare an instance variable for List + //private List instance; + + public ListTests() + { + // TODO uncomment below to create an instance of List + //instance = new List(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of List + /// + [Fact] + public void ListInstanceTest() + { + // TODO uncomment below to test "IsType" List + //Assert.IsType(instance); + } + + /// + /// Test the property 'Var123List' + /// + [Fact] + public void Var123ListTest() + { + // TODO unit test for the property 'Var123List' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 000000000000..31d21de5b60c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MammalTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MammalTests.cs new file mode 100644 index 000000000000..64bd9e890343 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MammalTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Mammal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MammalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Mammal + //private Mammal instance; + + public MammalTests() + { + // TODO uncomment below to create an instance of Mammal + //instance = new Mammal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Mammal + /// + [Fact] + public void MammalInstanceTest() + { + // TODO uncomment below to test "IsType" Mammal + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MapTestMapOfEnumStringValueTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MapTestMapOfEnumStringValueTests.cs new file mode 100644 index 000000000000..37713bb0496d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MapTestMapOfEnumStringValueTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MapTestMapOfEnumStringValue + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MapTestMapOfEnumStringValueTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MapTestMapOfEnumStringValue + //private MapTestMapOfEnumStringValue instance; + + public MapTestMapOfEnumStringValueTests() + { + // TODO uncomment below to create an instance of MapTestMapOfEnumStringValue + //instance = new MapTestMapOfEnumStringValue(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MapTestMapOfEnumStringValue + /// + [Fact] + public void MapTestMapOfEnumStringValueInstanceTest() + { + // TODO uncomment below to test "IsType" MapTestMapOfEnumStringValue + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MapTestTests.cs new file mode 100644 index 000000000000..2dc6d8d8e04b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MapTestTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MapTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MapTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MapTest + //private MapTest instance; + + public MapTestTests() + { + // TODO uncomment below to create an instance of MapTest + //instance = new MapTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MapTest + /// + [Fact] + public void MapTestInstanceTest() + { + // TODO uncomment below to test "IsType" MapTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'DirectMap' + /// + [Fact] + public void DirectMapTest() + { + // TODO unit test for the property 'DirectMap' + } + + /// + /// Test the property 'IndirectMap' + /// + [Fact] + public void IndirectMapTest() + { + // TODO unit test for the property 'IndirectMap' + } + + /// + /// Test the property 'MapMapOfString' + /// + [Fact] + public void MapMapOfStringTest() + { + // TODO unit test for the property 'MapMapOfString' + } + + /// + /// Test the property 'MapOfEnumString' + /// + [Fact] + public void MapOfEnumStringTest() + { + // TODO unit test for the property 'MapOfEnumString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixLogTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixLogTests.cs new file mode 100644 index 000000000000..3f108758fd2e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixLogTests.cs @@ -0,0 +1,344 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixLog + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixLogTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixLog + //private MixLog instance; + + public MixLogTests() + { + // TODO uncomment below to create an instance of MixLog + //instance = new MixLog(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixLog + /// + [Fact] + public void MixLogInstanceTest() + { + // TODO uncomment below to test "IsType" MixLog + //Assert.IsType(instance); + } + + /// + /// Test the property 'Description' + /// + [Fact] + public void DescriptionTest() + { + // TODO unit test for the property 'Description' + } + + /// + /// Test the property 'FormulaVersionDate' + /// + [Fact] + public void FormulaVersionDateTest() + { + // TODO unit test for the property 'FormulaVersionDate' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'MixDate' + /// + [Fact] + public void MixDateTest() + { + // TODO unit test for the property 'MixDate' + } + + /// + /// Test the property 'TotalOverPoors' + /// + [Fact] + public void TotalOverPoorsTest() + { + // TODO unit test for the property 'TotalOverPoors' + } + + /// + /// Test the property 'TotalRecalculations' + /// + [Fact] + public void TotalRecalculationsTest() + { + // TODO unit test for the property 'TotalRecalculations' + } + + /// + /// Test the property 'TotalSkips' + /// + [Fact] + public void TotalSkipsTest() + { + // TODO unit test for the property 'TotalSkips' + } + + /// + /// Test the property 'TotalUnderPours' + /// + [Fact] + public void TotalUnderPoursTest() + { + // TODO unit test for the property 'TotalUnderPours' + } + + /// + /// Test the property 'BatchNumber' + /// + [Fact] + public void BatchNumberTest() + { + // TODO unit test for the property 'BatchNumber' + } + + /// + /// Test the property 'BrandCode' + /// + [Fact] + public void BrandCodeTest() + { + // TODO unit test for the property 'BrandCode' + } + + /// + /// Test the property 'BrandId' + /// + [Fact] + public void BrandIdTest() + { + // TODO unit test for the property 'BrandId' + } + + /// + /// Test the property 'BrandName' + /// + [Fact] + public void BrandNameTest() + { + // TODO unit test for the property 'BrandName' + } + + /// + /// Test the property 'CategoryCode' + /// + [Fact] + public void CategoryCodeTest() + { + // TODO unit test for the property 'CategoryCode' + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + + /// + /// Test the property 'ColorDescription' + /// + [Fact] + public void ColorDescriptionTest() + { + // TODO unit test for the property 'ColorDescription' + } + + /// + /// Test the property 'Comment' + /// + [Fact] + public void CommentTest() + { + // TODO unit test for the property 'Comment' + } + + /// + /// Test the property 'CommercialProductCode' + /// + [Fact] + public void CommercialProductCodeTest() + { + // TODO unit test for the property 'CommercialProductCode' + } + + /// + /// Test the property 'Country' + /// + [Fact] + public void CountryTest() + { + // TODO unit test for the property 'Country' + } + + /// + /// Test the property 'CreatedBy' + /// + [Fact] + public void CreatedByTest() + { + // TODO unit test for the property 'CreatedBy' + } + + /// + /// Test the property 'CreatedByFirstName' + /// + [Fact] + public void CreatedByFirstNameTest() + { + // TODO unit test for the property 'CreatedByFirstName' + } + + /// + /// Test the property 'CreatedByLastName' + /// + [Fact] + public void CreatedByLastNameTest() + { + // TODO unit test for the property 'CreatedByLastName' + } + + /// + /// Test the property 'DeltaECalculationRepaired' + /// + [Fact] + public void DeltaECalculationRepairedTest() + { + // TODO unit test for the property 'DeltaECalculationRepaired' + } + + /// + /// Test the property 'DeltaECalculationSprayout' + /// + [Fact] + public void DeltaECalculationSprayoutTest() + { + // TODO unit test for the property 'DeltaECalculationSprayout' + } + + /// + /// Test the property 'OwnColorVariantNumber' + /// + [Fact] + public void OwnColorVariantNumberTest() + { + // TODO unit test for the property 'OwnColorVariantNumber' + } + + /// + /// Test the property 'PrimerProductId' + /// + [Fact] + public void PrimerProductIdTest() + { + // TODO unit test for the property 'PrimerProductId' + } + + /// + /// Test the property 'ProductId' + /// + [Fact] + public void ProductIdTest() + { + // TODO unit test for the property 'ProductId' + } + + /// + /// Test the property 'ProductLineCode' + /// + [Fact] + public void ProductLineCodeTest() + { + // TODO unit test for the property 'ProductLineCode' + } + + /// + /// Test the property 'ProductName' + /// + [Fact] + public void ProductNameTest() + { + // TODO unit test for the property 'ProductName' + } + + /// + /// Test the property 'SelectedVersionIndex' + /// + [Fact] + public void SelectedVersionIndexTest() + { + // TODO unit test for the property 'SelectedVersionIndex' + } + + /// + /// Test the property 'ShopId' + /// + [Fact] + public void ShopIdTest() + { + // TODO unit test for the property 'ShopId' + } + + /// + /// Test the property 'SomeCode' + /// + [Fact] + public void SomeCodeTest() + { + // TODO unit test for the property 'SomeCode' + } + + /// + /// Test the property 'TotalPrice' + /// + [Fact] + public void TotalPriceTest() + { + // TODO unit test for the property 'TotalPrice' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs new file mode 100644 index 000000000000..4ce302d1d047 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedAnyOfContent + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedAnyOfContentTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedAnyOfContent + //private MixedAnyOfContent instance; + + public MixedAnyOfContentTests() + { + // TODO uncomment below to create an instance of MixedAnyOfContent + //instance = new MixedAnyOfContent(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedAnyOfContent + /// + [Fact] + public void MixedAnyOfContentInstanceTest() + { + // TODO uncomment below to test "IsType" MixedAnyOfContent + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs new file mode 100644 index 000000000000..53b28cc0658d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedAnyOf + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedAnyOfTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedAnyOf + //private MixedAnyOf instance; + + public MixedAnyOfTests() + { + // TODO uncomment below to create an instance of MixedAnyOf + //instance = new MixedAnyOf(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedAnyOf + /// + [Fact] + public void MixedAnyOfInstanceTest() + { + // TODO uncomment below to test "IsType" MixedAnyOf + //Assert.IsType(instance); + } + + /// + /// Test the property 'Content' + /// + [Fact] + public void ContentTest() + { + // TODO unit test for the property 'Content' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs new file mode 100644 index 000000000000..781b72025008 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedOneOfContent + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedOneOfContentTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedOneOfContent + //private MixedOneOfContent instance; + + public MixedOneOfContentTests() + { + // TODO uncomment below to create an instance of MixedOneOfContent + //instance = new MixedOneOfContent(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedOneOfContent + /// + [Fact] + public void MixedOneOfContentInstanceTest() + { + // TODO uncomment below to test "IsType" MixedOneOfContent + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs new file mode 100644 index 000000000000..ee8b73d44f24 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedOneOf + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedOneOfTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedOneOf + //private MixedOneOf instance; + + public MixedOneOfTests() + { + // TODO uncomment below to create an instance of MixedOneOf + //instance = new MixedOneOf(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedOneOf + /// + [Fact] + public void MixedOneOfInstanceTest() + { + // TODO uncomment below to test "IsType" MixedOneOf + //Assert.IsType(instance); + } + + /// + /// Test the property 'Content' + /// + [Fact] + public void ContentTest() + { + // TODO unit test for the property 'Content' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs new file mode 100644 index 000000000000..d3689c15f401 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedPropertiesAndAdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedPropertiesAndAdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedPropertiesAndAdditionalPropertiesClass + //private MixedPropertiesAndAdditionalPropertiesClass instance; + + public MixedPropertiesAndAdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of MixedPropertiesAndAdditionalPropertiesClass + //instance = new MixedPropertiesAndAdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedPropertiesAndAdditionalPropertiesClass + /// + [Fact] + public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsType" MixedPropertiesAndAdditionalPropertiesClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + + /// + /// Test the property 'Map' + /// + [Fact] + public void MapTest() + { + // TODO unit test for the property 'Map' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + + /// + /// Test the property 'UuidWithPattern' + /// + [Fact] + public void UuidWithPatternTest() + { + // TODO unit test for the property 'UuidWithPattern' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs new file mode 100644 index 000000000000..2ed728a41b84 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedSubId + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedSubIdTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedSubId + //private MixedSubId instance; + + public MixedSubIdTests() + { + // TODO uncomment below to create an instance of MixedSubId + //instance = new MixedSubId(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedSubId + /// + [Fact] + public void MixedSubIdInstanceTest() + { + // TODO uncomment below to test "IsType" MixedSubId + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs new file mode 100644 index 000000000000..3b5e94c5f8f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Model200Response + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class Model200ResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Model200Response + //private Model200Response instance; + + public Model200ResponseTests() + { + // TODO uncomment below to create an instance of Model200Response + //instance = new Model200Response(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Model200Response + /// + [Fact] + public void Model200ResponseInstanceTest() + { + // TODO uncomment below to test "IsType" Model200Response + //Assert.IsType(instance); + } + + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs new file mode 100644 index 000000000000..5a986cfdc6c2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ModelClient + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ModelClientTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ModelClient + //private ModelClient instance; + + public ModelClientTests() + { + // TODO uncomment below to create an instance of ModelClient + //instance = new ModelClient(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ModelClient + /// + [Fact] + public void ModelClientInstanceTest() + { + // TODO uncomment below to test "IsType" ModelClient + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarClient' + /// + [Fact] + public void VarClientTest() + { + // TODO unit test for the property 'VarClient' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NameTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NameTests.cs new file mode 100644 index 000000000000..3aac92ae4683 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NameTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Name + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Name + //private Name instance; + + public NameTests() + { + // TODO uncomment below to create an instance of Name + //instance = new Name(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Name + /// + [Fact] + public void NameInstanceTest() + { + // TODO uncomment below to test "IsType" Name + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarName' + /// + [Fact] + public void VarNameTest() + { + // TODO unit test for the property 'VarName' + } + + /// + /// Test the property 'Property' + /// + [Fact] + public void PropertyTest() + { + // TODO unit test for the property 'Property' + } + + /// + /// Test the property 'SnakeCase' + /// + [Fact] + public void SnakeCaseTest() + { + // TODO unit test for the property 'SnakeCase' + } + + /// + /// Test the property 'Var123Number' + /// + [Fact] + public void Var123NumberTest() + { + // TODO unit test for the property 'Var123Number' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs new file mode 100644 index 000000000000..dd3b74e33061 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NotificationtestGetElementsV1ResponseMPayload + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NotificationtestGetElementsV1ResponseMPayloadTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NotificationtestGetElementsV1ResponseMPayload + //private NotificationtestGetElementsV1ResponseMPayload instance; + + public NotificationtestGetElementsV1ResponseMPayloadTests() + { + // TODO uncomment below to create an instance of NotificationtestGetElementsV1ResponseMPayload + //instance = new NotificationtestGetElementsV1ResponseMPayload(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NotificationtestGetElementsV1ResponseMPayload + /// + [Fact] + public void NotificationtestGetElementsV1ResponseMPayloadInstanceTest() + { + // TODO uncomment below to test "IsType" NotificationtestGetElementsV1ResponseMPayload + //Assert.IsType(instance); + } + + /// + /// Test the property 'AObjVariableobject' + /// + [Fact] + public void AObjVariableobjectTest() + { + // TODO unit test for the property 'AObjVariableobject' + } + + /// + /// Test the property 'PkiNotificationtestID' + /// + [Fact] + public void PkiNotificationtestIDTest() + { + // TODO unit test for the property 'PkiNotificationtestID' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs new file mode 100644 index 000000000000..1e19aa6b8231 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableClass + //private NullableClass instance; + + public NullableClassTests() + { + // TODO uncomment below to create an instance of NullableClass + //instance = new NullableClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableClass + /// + [Fact] + public void NullableClassInstanceTest() + { + // TODO uncomment below to test "IsType" NullableClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayAndItemsNullableProp' + /// + [Fact] + public void ArrayAndItemsNullablePropTest() + { + // TODO unit test for the property 'ArrayAndItemsNullableProp' + } + + /// + /// Test the property 'ArrayItemsNullable' + /// + [Fact] + public void ArrayItemsNullableTest() + { + // TODO unit test for the property 'ArrayItemsNullable' + } + + /// + /// Test the property 'ArrayNullableProp' + /// + [Fact] + public void ArrayNullablePropTest() + { + // TODO unit test for the property 'ArrayNullableProp' + } + + /// + /// Test the property 'BooleanProp' + /// + [Fact] + public void BooleanPropTest() + { + // TODO unit test for the property 'BooleanProp' + } + + /// + /// Test the property 'DateProp' + /// + [Fact] + public void DatePropTest() + { + // TODO unit test for the property 'DateProp' + } + + /// + /// Test the property 'DatetimeProp' + /// + [Fact] + public void DatetimePropTest() + { + // TODO unit test for the property 'DatetimeProp' + } + + /// + /// Test the property 'IntegerProp' + /// + [Fact] + public void IntegerPropTest() + { + // TODO unit test for the property 'IntegerProp' + } + + /// + /// Test the property 'NumberProp' + /// + [Fact] + public void NumberPropTest() + { + // TODO unit test for the property 'NumberProp' + } + + /// + /// Test the property 'ObjectAndItemsNullableProp' + /// + [Fact] + public void ObjectAndItemsNullablePropTest() + { + // TODO unit test for the property 'ObjectAndItemsNullableProp' + } + + /// + /// Test the property 'ObjectItemsNullable' + /// + [Fact] + public void ObjectItemsNullableTest() + { + // TODO unit test for the property 'ObjectItemsNullable' + } + + /// + /// Test the property 'ObjectNullableProp' + /// + [Fact] + public void ObjectNullablePropTest() + { + // TODO unit test for the property 'ObjectNullableProp' + } + + /// + /// Test the property 'StringProp' + /// + [Fact] + public void StringPropTest() + { + // TODO unit test for the property 'StringProp' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs new file mode 100644 index 000000000000..db8c9aa09568 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableGuidClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableGuidClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableGuidClass + //private NullableGuidClass instance; + + public NullableGuidClassTests() + { + // TODO uncomment below to create an instance of NullableGuidClass + //instance = new NullableGuidClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableGuidClass + /// + [Fact] + public void NullableGuidClassInstanceTest() + { + // TODO uncomment below to test "IsType" NullableGuidClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs new file mode 100644 index 000000000000..e65ba44efa2e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableShape + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableShapeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableShape + //private NullableShape instance; + + public NullableShapeTests() + { + // TODO uncomment below to create an instance of NullableShape + //instance = new NullableShape(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableShape + /// + [Fact] + public void NullableShapeInstanceTest() + { + // TODO uncomment below to test "IsType" NullableShape + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs new file mode 100644 index 000000000000..2b88fb1a609e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NumberOnly + //private NumberOnly instance; + + public NumberOnlyTests() + { + // TODO uncomment below to create an instance of NumberOnly + //instance = new NumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NumberOnly + /// + [Fact] + public void NumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" NumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'JustNumber' + /// + [Fact] + public void JustNumberTest() + { + // TODO unit test for the property 'JustNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs new file mode 100644 index 000000000000..078655aaba70 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ObjectWithDeprecatedFields + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ObjectWithDeprecatedFieldsTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ObjectWithDeprecatedFields + //private ObjectWithDeprecatedFields instance; + + public ObjectWithDeprecatedFieldsTests() + { + // TODO uncomment below to create an instance of ObjectWithDeprecatedFields + //instance = new ObjectWithDeprecatedFields(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ObjectWithDeprecatedFields + /// + [Fact] + public void ObjectWithDeprecatedFieldsInstanceTest() + { + // TODO uncomment below to test "IsType" ObjectWithDeprecatedFields + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bars' + /// + [Fact] + public void BarsTest() + { + // TODO unit test for the property 'Bars' + } + + /// + /// Test the property 'DeprecatedRef' + /// + [Fact] + public void DeprecatedRefTest() + { + // TODO unit test for the property 'DeprecatedRef' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs new file mode 100644 index 000000000000..8ef411a15eb6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OneOfString + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OneOfStringTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OneOfString + //private OneOfString instance; + + public OneOfStringTests() + { + // TODO uncomment below to create an instance of OneOfString + //instance = new OneOfString(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OneOfString + /// + [Fact] + public void OneOfStringInstanceTest() + { + // TODO uncomment below to test "IsType" OneOfString + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OrderStatusTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OrderStatusTests.cs new file mode 100644 index 000000000000..4b9bcdbbc92e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OrderStatusTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OrderStatus + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OrderStatusTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OrderStatus + //private OrderStatus instance; + + public OrderStatusTests() + { + // TODO uncomment below to create an instance of OrderStatus + //instance = new OrderStatus(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OrderStatus + /// + [Fact] + public void OrderStatusInstanceTest() + { + // TODO uncomment below to test "IsType" OrderStatus + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OrderTests.cs new file mode 100644 index 000000000000..e7187bbdc92c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Order + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OrderTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Order + //private Order instance; + + public OrderTests() + { + // TODO uncomment below to create an instance of Order + //instance = new Order(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Order + /// + [Fact] + public void OrderInstanceTest() + { + // TODO uncomment below to test "IsType" Order + //Assert.IsType(instance); + } + + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'PetId' + /// + [Fact] + public void PetIdTest() + { + // TODO unit test for the property 'PetId' + } + + /// + /// Test the property 'Quantity' + /// + [Fact] + public void QuantityTest() + { + // TODO unit test for the property 'Quantity' + } + + /// + /// Test the property 'ShipDate' + /// + [Fact] + public void ShipDateTest() + { + // TODO unit test for the property 'ShipDate' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs new file mode 100644 index 000000000000..0bb8ce5e5d9b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterComposite + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterCompositeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterComposite + //private OuterComposite instance; + + public OuterCompositeTests() + { + // TODO uncomment below to create an instance of OuterComposite + //instance = new OuterComposite(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterComposite + /// + [Fact] + public void OuterCompositeInstanceTest() + { + // TODO uncomment below to test "IsType" OuterComposite + //Assert.IsType(instance); + } + + /// + /// Test the property 'MyBoolean' + /// + [Fact] + public void MyBooleanTest() + { + // TODO unit test for the property 'MyBoolean' + } + + /// + /// Test the property 'MyNumber' + /// + [Fact] + public void MyNumberTest() + { + // TODO unit test for the property 'MyNumber' + } + + /// + /// Test the property 'MyString' + /// + [Fact] + public void MyStringTest() + { + // TODO unit test for the property 'MyString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs new file mode 100644 index 000000000000..a1d1e1527771 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumDefaultValue + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumDefaultValueTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumDefaultValue + //private OuterEnumDefaultValue instance; + + public OuterEnumDefaultValueTests() + { + // TODO uncomment below to create an instance of OuterEnumDefaultValue + //instance = new OuterEnumDefaultValue(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumDefaultValue + /// + [Fact] + public void OuterEnumDefaultValueInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumDefaultValue + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs new file mode 100644 index 000000000000..030326d75792 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumIntegerDefaultValue + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumIntegerDefaultValueTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumIntegerDefaultValue + //private OuterEnumIntegerDefaultValue instance; + + public OuterEnumIntegerDefaultValueTests() + { + // TODO uncomment below to create an instance of OuterEnumIntegerDefaultValue + //instance = new OuterEnumIntegerDefaultValue(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumIntegerDefaultValue + /// + [Fact] + public void OuterEnumIntegerDefaultValueInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumIntegerDefaultValue + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs new file mode 100644 index 000000000000..1f3bfe459e76 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumInteger + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumIntegerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumInteger + //private OuterEnumInteger instance; + + public OuterEnumIntegerTests() + { + // TODO uncomment below to create an instance of OuterEnumInteger + //instance = new OuterEnumInteger(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumInteger + /// + [Fact] + public void OuterEnumIntegerInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumInteger + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs new file mode 100644 index 000000000000..c4cb8eeecee8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumTest + //private OuterEnumTest instance; + + public OuterEnumTestTests() + { + // TODO uncomment below to create an instance of OuterEnumTest + //instance = new OuterEnumTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumTest + /// + [Fact] + public void OuterEnumTestInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumTest + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs new file mode 100644 index 000000000000..2859494010b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnum + //private OuterEnum instance; + + public OuterEnumTests() + { + // TODO uncomment below to create an instance of OuterEnum + //instance = new OuterEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnum + /// + [Fact] + public void OuterEnumInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnum + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs new file mode 100644 index 000000000000..b0ebddd374f9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ParentPet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ParentPetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ParentPet + //private ParentPet instance; + + public ParentPetTests() + { + // TODO uncomment below to create an instance of ParentPet + //instance = new ParentPet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ParentPet + /// + [Fact] + public void ParentPetInstanceTest() + { + // TODO uncomment below to test "IsType" ParentPet + //Assert.IsType(instance); + } + + /// + /// Test deserialize a ChildCat from type ParentPet + /// + [Fact] + public void ChildCatDeserializeFromParentPetTest() + { + // TODO uncomment below to test deserialize a ChildCat from type ParentPet + //Assert.IsType(JsonConvert.DeserializeObject(new ChildCat().ToJson())); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PetStatusTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PetStatusTests.cs new file mode 100644 index 000000000000..0b3bb9f168b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PetStatusTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing PetStatus + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PetStatusTests : IDisposable + { + // TODO uncomment below to declare an instance variable for PetStatus + //private PetStatus instance; + + public PetStatusTests() + { + // TODO uncomment below to create an instance of PetStatus + //instance = new PetStatus(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of PetStatus + /// + [Fact] + public void PetStatusInstanceTest() + { + // TODO uncomment below to test "IsType" PetStatus + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PetTests.cs new file mode 100644 index 000000000000..8485d1213ce6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Pet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pet + //private Pet instance; + + public PetTests() + { + // TODO uncomment below to create an instance of Pet + //instance = new Pet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pet + /// + [Fact] + public void PetInstanceTest() + { + // TODO uncomment below to test "IsType" Pet + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + /// + /// Test the property 'PhotoUrls' + /// + [Fact] + public void PhotoUrlsTest() + { + // TODO unit test for the property 'PhotoUrls' + } + + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + + /// + /// Test the property 'Tags' + /// + [Fact] + public void TagsTest() + { + // TODO unit test for the property 'Tags' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PigTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PigTests.cs new file mode 100644 index 000000000000..bd052bc705b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Pig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pig + //private Pig instance; + + public PigTests() + { + // TODO uncomment below to create an instance of Pig + //instance = new Pig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pig + /// + [Fact] + public void PigInstanceTest() + { + // TODO uncomment below to test "IsType" Pig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs new file mode 100644 index 000000000000..23120ba7bdfa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing PolymorphicProperty + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PolymorphicPropertyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for PolymorphicProperty + //private PolymorphicProperty instance; + + public PolymorphicPropertyTests() + { + // TODO uncomment below to create an instance of PolymorphicProperty + //instance = new PolymorphicProperty(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of PolymorphicProperty + /// + [Fact] + public void PolymorphicPropertyInstanceTest() + { + // TODO uncomment below to test "IsType" PolymorphicProperty + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs new file mode 100644 index 000000000000..2ddd31cfcbba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing QuadrilateralInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class QuadrilateralInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for QuadrilateralInterface + //private QuadrilateralInterface instance; + + public QuadrilateralInterfaceTests() + { + // TODO uncomment below to create an instance of QuadrilateralInterface + //instance = new QuadrilateralInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of QuadrilateralInterface + /// + [Fact] + public void QuadrilateralInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" QuadrilateralInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs new file mode 100644 index 000000000000..65673847d759 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Quadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class QuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Quadrilateral + //private Quadrilateral instance; + + public QuadrilateralTests() + { + // TODO uncomment below to create an instance of Quadrilateral + //instance = new Quadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Quadrilateral + /// + [Fact] + public void QuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" Quadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs new file mode 100644 index 000000000000..a4c91cf44a57 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ReadOnlyFirst + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReadOnlyFirstTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ReadOnlyFirst + //private ReadOnlyFirst instance; + + public ReadOnlyFirstTests() + { + // TODO uncomment below to create an instance of ReadOnlyFirst + //instance = new ReadOnlyFirst(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ReadOnlyFirst + /// + [Fact] + public void ReadOnlyFirstInstanceTest() + { + // TODO uncomment below to test "IsType" ReadOnlyFirst + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + /// + /// Test the property 'Baz' + /// + [Fact] + public void BazTest() + { + // TODO unit test for the property 'Baz' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNotnullableEnumIntegerOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNotnullableEnumIntegerOnlyTests.cs new file mode 100644 index 000000000000..d0f0ae6b6f94 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNotnullableEnumIntegerOnlyTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClassRequiredNotnullableEnumIntegerOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassRequiredNotnullableEnumIntegerOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClassRequiredNotnullableEnumIntegerOnly + //private RequiredClassRequiredNotnullableEnumIntegerOnly instance; + + public RequiredClassRequiredNotnullableEnumIntegerOnlyTests() + { + // TODO uncomment below to create an instance of RequiredClassRequiredNotnullableEnumIntegerOnly + //instance = new RequiredClassRequiredNotnullableEnumIntegerOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClassRequiredNotnullableEnumIntegerOnly + /// + [Fact] + public void RequiredClassRequiredNotnullableEnumIntegerOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClassRequiredNotnullableEnumIntegerOnly + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNotnullableEnumIntegerTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNotnullableEnumIntegerTests.cs new file mode 100644 index 000000000000..60c35933cc96 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNotnullableEnumIntegerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClassRequiredNotnullableEnumInteger + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassRequiredNotnullableEnumIntegerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClassRequiredNotnullableEnumInteger + //private RequiredClassRequiredNotnullableEnumInteger instance; + + public RequiredClassRequiredNotnullableEnumIntegerTests() + { + // TODO uncomment below to create an instance of RequiredClassRequiredNotnullableEnumInteger + //instance = new RequiredClassRequiredNotnullableEnumInteger(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClassRequiredNotnullableEnumInteger + /// + [Fact] + public void RequiredClassRequiredNotnullableEnumIntegerInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClassRequiredNotnullableEnumInteger + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNotnullableEnumStringTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNotnullableEnumStringTests.cs new file mode 100644 index 000000000000..0cd9b817a017 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNotnullableEnumStringTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClassRequiredNotnullableEnumString + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassRequiredNotnullableEnumStringTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClassRequiredNotnullableEnumString + //private RequiredClassRequiredNotnullableEnumString instance; + + public RequiredClassRequiredNotnullableEnumStringTests() + { + // TODO uncomment below to create an instance of RequiredClassRequiredNotnullableEnumString + //instance = new RequiredClassRequiredNotnullableEnumString(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClassRequiredNotnullableEnumString + /// + [Fact] + public void RequiredClassRequiredNotnullableEnumStringInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClassRequiredNotnullableEnumString + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNullableEnumIntegerOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNullableEnumIntegerOnlyTests.cs new file mode 100644 index 000000000000..890639ce9057 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNullableEnumIntegerOnlyTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClassRequiredNullableEnumIntegerOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassRequiredNullableEnumIntegerOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClassRequiredNullableEnumIntegerOnly + //private RequiredClassRequiredNullableEnumIntegerOnly instance; + + public RequiredClassRequiredNullableEnumIntegerOnlyTests() + { + // TODO uncomment below to create an instance of RequiredClassRequiredNullableEnumIntegerOnly + //instance = new RequiredClassRequiredNullableEnumIntegerOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClassRequiredNullableEnumIntegerOnly + /// + [Fact] + public void RequiredClassRequiredNullableEnumIntegerOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClassRequiredNullableEnumIntegerOnly + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNullableEnumIntegerTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNullableEnumIntegerTests.cs new file mode 100644 index 000000000000..ed87acb3c0b6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNullableEnumIntegerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClassRequiredNullableEnumInteger + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassRequiredNullableEnumIntegerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClassRequiredNullableEnumInteger + //private RequiredClassRequiredNullableEnumInteger instance; + + public RequiredClassRequiredNullableEnumIntegerTests() + { + // TODO uncomment below to create an instance of RequiredClassRequiredNullableEnumInteger + //instance = new RequiredClassRequiredNullableEnumInteger(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClassRequiredNullableEnumInteger + /// + [Fact] + public void RequiredClassRequiredNullableEnumIntegerInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClassRequiredNullableEnumInteger + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNullableEnumStringTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNullableEnumStringTests.cs new file mode 100644 index 000000000000..965d4bbd2e3a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassRequiredNullableEnumStringTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClassRequiredNullableEnumString + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassRequiredNullableEnumStringTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClassRequiredNullableEnumString + //private RequiredClassRequiredNullableEnumString instance; + + public RequiredClassRequiredNullableEnumStringTests() + { + // TODO uncomment below to create an instance of RequiredClassRequiredNullableEnumString + //instance = new RequiredClassRequiredNullableEnumString(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClassRequiredNullableEnumString + /// + [Fact] + public void RequiredClassRequiredNullableEnumStringInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClassRequiredNullableEnumString + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..d1da68281ff0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ReturnTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ReturnTests.cs new file mode 100644 index 000000000000..bbea79ed9511 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ReturnTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Return + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReturnTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Return + //private Return instance; + + public ReturnTests() + { + // TODO uncomment below to create an instance of Return + //instance = new Return(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Return + /// + [Fact] + public void ReturnInstanceTest() + { + // TODO uncomment below to test "IsType" Return + //Assert.IsType(instance); + } + + /// + /// Test the property 'Lock' + /// + [Fact] + public void LockTest() + { + // TODO unit test for the property 'Lock' + } + + /// + /// Test the property 'Abstract' + /// + [Fact] + public void AbstractTest() + { + // TODO unit test for the property 'Abstract' + } + + /// + /// Test the property 'VarReturn' + /// + [Fact] + public void VarReturnTest() + { + // TODO unit test for the property 'VarReturn' + } + + /// + /// Test the property 'Unsafe' + /// + [Fact] + public void UnsafeTest() + { + // TODO unit test for the property 'Unsafe' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs new file mode 100644 index 000000000000..5f21a874c4f0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RolesReportsHashRole + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RolesReportsHashRoleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RolesReportsHashRole + //private RolesReportsHashRole instance; + + public RolesReportsHashRoleTests() + { + // TODO uncomment below to create an instance of RolesReportsHashRole + //instance = new RolesReportsHashRole(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RolesReportsHashRole + /// + [Fact] + public void RolesReportsHashRoleInstanceTest() + { + // TODO uncomment below to test "IsType" RolesReportsHashRole + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs new file mode 100644 index 000000000000..cddb8dc6f0b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RolesReportsHash + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RolesReportsHashTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RolesReportsHash + //private RolesReportsHash instance; + + public RolesReportsHashTests() + { + // TODO uncomment below to create an instance of RolesReportsHash + //instance = new RolesReportsHash(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RolesReportsHash + /// + [Fact] + public void RolesReportsHashInstanceTest() + { + // TODO uncomment below to test "IsType" RolesReportsHash + //Assert.IsType(instance); + } + + /// + /// Test the property 'Role' + /// + [Fact] + public void RoleTest() + { + // TODO unit test for the property 'Role' + } + + /// + /// Test the property 'RoleUuid' + /// + [Fact] + public void RoleUuidTest() + { + // TODO unit test for the property 'RoleUuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs new file mode 100644 index 000000000000..085d3e550a10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ScaleneTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ScaleneTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ScaleneTriangle + //private ScaleneTriangle instance; + + public ScaleneTriangleTests() + { + // TODO uncomment below to create an instance of ScaleneTriangle + //instance = new ScaleneTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ScaleneTriangle + /// + [Fact] + public void ScaleneTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" ScaleneTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs new file mode 100644 index 000000000000..62d6d69ff72d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ShapeInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ShapeInterface + //private ShapeInterface instance; + + public ShapeInterfaceTests() + { + // TODO uncomment below to create an instance of ShapeInterface + //instance = new ShapeInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ShapeInterface + /// + [Fact] + public void ShapeInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" ShapeInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs new file mode 100644 index 000000000000..dc6970b16f15 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ShapeOrNull + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeOrNullTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ShapeOrNull + //private ShapeOrNull instance; + + public ShapeOrNullTests() + { + // TODO uncomment below to create an instance of ShapeOrNull + //instance = new ShapeOrNull(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ShapeOrNull + /// + [Fact] + public void ShapeOrNullInstanceTest() + { + // TODO uncomment below to test "IsType" ShapeOrNull + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ShapeTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ShapeTests.cs new file mode 100644 index 000000000000..dbdf012c5ba4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ShapeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Shape + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Shape + //private Shape instance; + + public ShapeTests() + { + // TODO uncomment below to create an instance of Shape + //instance = new Shape(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Shape + /// + [Fact] + public void ShapeInstanceTest() + { + // TODO uncomment below to test "IsType" Shape + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs new file mode 100644 index 000000000000..baa6e1e9f6fd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing SimpleQuadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class SimpleQuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for SimpleQuadrilateral + //private SimpleQuadrilateral instance; + + public SimpleQuadrilateralTests() + { + // TODO uncomment below to create an instance of SimpleQuadrilateral + //instance = new SimpleQuadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of SimpleQuadrilateral + /// + [Fact] + public void SimpleQuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" SimpleQuadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs new file mode 100644 index 000000000000..23763d9c3af0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing SpecialModelName + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class SpecialModelNameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for SpecialModelName + //private SpecialModelName instance; + + public SpecialModelNameTests() + { + // TODO uncomment below to create an instance of SpecialModelName + //instance = new SpecialModelName(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of SpecialModelName + /// + [Fact] + public void SpecialModelNameInstanceTest() + { + // TODO uncomment below to test "IsType" SpecialModelName + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarSpecialModelName' + /// + [Fact] + public void VarSpecialModelNameTest() + { + // TODO unit test for the property 'VarSpecialModelName' + } + + /// + /// Test the property 'SpecialPropertyName' + /// + [Fact] + public void SpecialPropertyNameTest() + { + // TODO unit test for the property 'SpecialPropertyName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TagTests.cs new file mode 100644 index 000000000000..fe7f3d82baba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TagTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Tag + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TagTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Tag + //private Tag instance; + + public TagTests() + { + // TODO uncomment below to create an instance of Tag + //instance = new Tag(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Tag + /// + [Fact] + public void TagInstanceTest() + { + // TODO uncomment below to test "IsType" Tag + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs new file mode 100644 index 000000000000..eca020ce1fae --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestCollectionEndingWithWordListObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestCollectionEndingWithWordListObjectTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestCollectionEndingWithWordListObject + //private TestCollectionEndingWithWordListObject instance; + + public TestCollectionEndingWithWordListObjectTests() + { + // TODO uncomment below to create an instance of TestCollectionEndingWithWordListObject + //instance = new TestCollectionEndingWithWordListObject(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestCollectionEndingWithWordListObject + /// + [Fact] + public void TestCollectionEndingWithWordListObjectInstanceTest() + { + // TODO uncomment below to test "IsType" TestCollectionEndingWithWordListObject + //Assert.IsType(instance); + } + + /// + /// Test the property 'TestCollectionEndingWithWordList' + /// + [Fact] + public void TestCollectionEndingWithWordListTest() + { + // TODO unit test for the property 'TestCollectionEndingWithWordList' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs new file mode 100644 index 000000000000..e3c86aefabe3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestCollectionEndingWithWordList + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestCollectionEndingWithWordListTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestCollectionEndingWithWordList + //private TestCollectionEndingWithWordList instance; + + public TestCollectionEndingWithWordListTests() + { + // TODO uncomment below to create an instance of TestCollectionEndingWithWordList + //instance = new TestCollectionEndingWithWordList(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestCollectionEndingWithWordList + /// + [Fact] + public void TestCollectionEndingWithWordListInstanceTest() + { + // TODO uncomment below to test "IsType" TestCollectionEndingWithWordList + //Assert.IsType(instance); + } + + /// + /// Test the property 'Value' + /// + [Fact] + public void ValueTest() + { + // TODO unit test for the property 'Value' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersEnumHeaderStringParameterTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersEnumHeaderStringParameterTests.cs new file mode 100644 index 000000000000..13a2e1eb54fc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersEnumHeaderStringParameterTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestEnumParametersEnumHeaderStringParameter + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestEnumParametersEnumHeaderStringParameterTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestEnumParametersEnumHeaderStringParameter + //private TestEnumParametersEnumHeaderStringParameter instance; + + public TestEnumParametersEnumHeaderStringParameterTests() + { + // TODO uncomment below to create an instance of TestEnumParametersEnumHeaderStringParameter + //instance = new TestEnumParametersEnumHeaderStringParameter(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestEnumParametersEnumHeaderStringParameter + /// + [Fact] + public void TestEnumParametersEnumHeaderStringParameterInstanceTest() + { + // TODO uncomment below to test "IsType" TestEnumParametersEnumHeaderStringParameter + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersEnumQueryDoubleParameterTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersEnumQueryDoubleParameterTests.cs new file mode 100644 index 000000000000..4d7a6d9b6655 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersEnumQueryDoubleParameterTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestEnumParametersEnumQueryDoubleParameter + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestEnumParametersEnumQueryDoubleParameterTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestEnumParametersEnumQueryDoubleParameter + //private TestEnumParametersEnumQueryDoubleParameter instance; + + public TestEnumParametersEnumQueryDoubleParameterTests() + { + // TODO uncomment below to create an instance of TestEnumParametersEnumQueryDoubleParameter + //instance = new TestEnumParametersEnumQueryDoubleParameter(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestEnumParametersEnumQueryDoubleParameter + /// + [Fact] + public void TestEnumParametersEnumQueryDoubleParameterInstanceTest() + { + // TODO uncomment below to test "IsType" TestEnumParametersEnumQueryDoubleParameter + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersEnumQueryIntegerParameterTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersEnumQueryIntegerParameterTests.cs new file mode 100644 index 000000000000..700dbb98ec92 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersEnumQueryIntegerParameterTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestEnumParametersEnumQueryIntegerParameter + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestEnumParametersEnumQueryIntegerParameterTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestEnumParametersEnumQueryIntegerParameter + //private TestEnumParametersEnumQueryIntegerParameter instance; + + public TestEnumParametersEnumQueryIntegerParameterTests() + { + // TODO uncomment below to create an instance of TestEnumParametersEnumQueryIntegerParameter + //instance = new TestEnumParametersEnumQueryIntegerParameter(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestEnumParametersEnumQueryIntegerParameter + /// + [Fact] + public void TestEnumParametersEnumQueryIntegerParameterInstanceTest() + { + // TODO uncomment below to test "IsType" TestEnumParametersEnumQueryIntegerParameter + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersRequestEnumFormStringArrayInnerTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersRequestEnumFormStringArrayInnerTests.cs new file mode 100644 index 000000000000..9dd379868e64 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersRequestEnumFormStringArrayInnerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestEnumParametersRequestEnumFormStringArrayInner + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestEnumParametersRequestEnumFormStringArrayInnerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestEnumParametersRequestEnumFormStringArrayInner + //private TestEnumParametersRequestEnumFormStringArrayInner instance; + + public TestEnumParametersRequestEnumFormStringArrayInnerTests() + { + // TODO uncomment below to create an instance of TestEnumParametersRequestEnumFormStringArrayInner + //instance = new TestEnumParametersRequestEnumFormStringArrayInner(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestEnumParametersRequestEnumFormStringArrayInner + /// + [Fact] + public void TestEnumParametersRequestEnumFormStringArrayInnerInstanceTest() + { + // TODO uncomment below to test "IsType" TestEnumParametersRequestEnumFormStringArrayInner + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersRequestEnumFormStringTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersRequestEnumFormStringTests.cs new file mode 100644 index 000000000000..a99aa2d7d3e8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestEnumParametersRequestEnumFormStringTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestEnumParametersRequestEnumFormString + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestEnumParametersRequestEnumFormStringTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestEnumParametersRequestEnumFormString + //private TestEnumParametersRequestEnumFormString instance; + + public TestEnumParametersRequestEnumFormStringTests() + { + // TODO uncomment below to create an instance of TestEnumParametersRequestEnumFormString + //instance = new TestEnumParametersRequestEnumFormString(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestEnumParametersRequestEnumFormString + /// + [Fact] + public void TestEnumParametersRequestEnumFormStringInstanceTest() + { + // TODO uncomment below to test "IsType" TestEnumParametersRequestEnumFormString + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs new file mode 100644 index 000000000000..23e08d8e4e9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestInlineFreeformAdditionalPropertiesRequest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestInlineFreeformAdditionalPropertiesRequestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestInlineFreeformAdditionalPropertiesRequest + //private TestInlineFreeformAdditionalPropertiesRequest instance; + + public TestInlineFreeformAdditionalPropertiesRequestTests() + { + // TODO uncomment below to create an instance of TestInlineFreeformAdditionalPropertiesRequest + //instance = new TestInlineFreeformAdditionalPropertiesRequest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestInlineFreeformAdditionalPropertiesRequest + /// + [Fact] + public void TestInlineFreeformAdditionalPropertiesRequestInstanceTest() + { + // TODO uncomment below to test "IsType" TestInlineFreeformAdditionalPropertiesRequest + //Assert.IsType(instance); + } + + /// + /// Test the property 'SomeProperty' + /// + [Fact] + public void SomePropertyTest() + { + // TODO unit test for the property 'SomeProperty' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs new file mode 100644 index 000000000000..1293a2b212ed --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TriangleInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TriangleInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TriangleInterface + //private TriangleInterface instance; + + public TriangleInterfaceTests() + { + // TODO uncomment below to create an instance of TriangleInterface + //instance = new TriangleInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TriangleInterface + /// + [Fact] + public void TriangleInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" TriangleInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TriangleTests.cs new file mode 100644 index 000000000000..4cb535223483 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/TriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Triangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Triangle + //private Triangle instance; + + public TriangleTests() + { + // TODO uncomment below to create an instance of Triangle + //instance = new Triangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Triangle + /// + [Fact] + public void TriangleInstanceTest() + { + // TODO uncomment below to test "IsType" Triangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/UserTests.cs new file mode 100644 index 000000000000..6415f8561f1f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing User + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class UserTests : IDisposable + { + // TODO uncomment below to declare an instance variable for User + //private User instance; + + public UserTests() + { + // TODO uncomment below to create an instance of User + //instance = new User(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of User + /// + [Fact] + public void UserInstanceTest() + { + // TODO uncomment below to test "IsType" User + //Assert.IsType(instance); + } + + /// + /// Test the property 'AnyTypeProp' + /// + [Fact] + public void AnyTypePropTest() + { + // TODO unit test for the property 'AnyTypeProp' + } + + /// + /// Test the property 'AnyTypePropNullable' + /// + [Fact] + public void AnyTypePropNullableTest() + { + // TODO unit test for the property 'AnyTypePropNullable' + } + + /// + /// Test the property 'Email' + /// + [Fact] + public void EmailTest() + { + // TODO unit test for the property 'Email' + } + + /// + /// Test the property 'FirstName' + /// + [Fact] + public void FirstNameTest() + { + // TODO unit test for the property 'FirstName' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'LastName' + /// + [Fact] + public void LastNameTest() + { + // TODO unit test for the property 'LastName' + } + + /// + /// Test the property 'ObjectWithNoDeclaredProps' + /// + [Fact] + public void ObjectWithNoDeclaredPropsTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredProps' + } + + /// + /// Test the property 'ObjectWithNoDeclaredPropsNullable' + /// + [Fact] + public void ObjectWithNoDeclaredPropsNullableTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Phone' + /// + [Fact] + public void PhoneTest() + { + // TODO unit test for the property 'Phone' + } + + /// + /// Test the property 'UserStatus' + /// + [Fact] + public void UserStatusTest() + { + // TODO unit test for the property 'UserStatus' + } + + /// + /// Test the property 'Username' + /// + [Fact] + public void UsernameTest() + { + // TODO unit test for the property 'Username' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/WhaleTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/WhaleTests.cs new file mode 100644 index 000000000000..7d05cc5e59ab --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/WhaleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Whale + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class WhaleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Whale + //private Whale instance; + + public WhaleTests() + { + // TODO uncomment below to create an instance of Whale + //instance = new Whale(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Whale + /// + [Fact] + public void WhaleInstanceTest() + { + // TODO uncomment below to test "IsType" Whale + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'HasBaleen' + /// + [Fact] + public void HasBaleenTest() + { + // TODO unit test for the property 'HasBaleen' + } + + /// + /// Test the property 'HasTeeth' + /// + [Fact] + public void HasTeethTest() + { + // TODO unit test for the property 'HasTeeth' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZebraTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZebraTests.cs new file mode 100644 index 000000000000..cd0d1c1c361c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZebraTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Zebra + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZebraTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Zebra + //private Zebra instance; + + public ZebraTests() + { + // TODO uncomment below to create an instance of Zebra + //instance = new Zebra(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Zebra + /// + [Fact] + public void ZebraInstanceTest() + { + // TODO uncomment below to test "IsType" Zebra + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZebraTypeTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZebraTypeTests.cs new file mode 100644 index 000000000000..d257a4a319e7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZebraTypeTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZebraType + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZebraTypeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZebraType + //private ZebraType instance; + + public ZebraTypeTests() + { + // TODO uncomment below to create an instance of ZebraType + //instance = new ZebraType(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZebraType + /// + [Fact] + public void ZebraTypeInstanceTest() + { + // TODO uncomment below to test "IsType" ZebraType + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 000000000000..b432edb28c23 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassZeroBasedEnumTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassZeroBasedEnumTests.cs new file mode 100644 index 000000000000..42fabdfc6a75 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassZeroBasedEnumTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClassZeroBasedEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassZeroBasedEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClassZeroBasedEnum + //private ZeroBasedEnumClassZeroBasedEnum instance; + + public ZeroBasedEnumClassZeroBasedEnumTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClassZeroBasedEnum + //instance = new ZeroBasedEnumClassZeroBasedEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClassZeroBasedEnum + /// + [Fact] + public void ZeroBasedEnumClassZeroBasedEnumInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClassZeroBasedEnum + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs new file mode 100644 index 000000000000..3689a873c342 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnum + //private ZeroBasedEnum instance; + + public ZeroBasedEnumTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnum + //instance = new ZeroBasedEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnum + /// + [Fact] + public void ZeroBasedEnumInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnum + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..012d0f37d648 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,19 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net9.0 + false + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs new file mode 100644 index 000000000000..3d7d0c482339 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -0,0 +1,403 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IAnotherFakeApi : IApi + { + /// + /// The class containing the events + /// + AnotherFakeApiEvents Events { get; } + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task Call123TestSpecialTagsOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ICall123TestSpecialTagsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class AnotherFakeApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnCall123TestSpecialTags; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorCall123TestSpecialTags; + + internal void ExecuteOnCall123TestSpecialTags(AnotherFakeApi.Call123TestSpecialTagsApiResponse apiResponse) + { + OnCall123TestSpecialTags?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCall123TestSpecialTags(Exception exception) + { + OnErrorCall123TestSpecialTags?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class AnotherFakeApi : IAnotherFakeApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public AnotherFakeApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, AnotherFakeApiEvents anotherFakeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = anotherFakeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatCall123TestSpecialTags(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCall123TestSpecialTags(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCall123TestSpecialTagsDefaultImplementation(ICall123TestSpecialTagsApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterCall123TestSpecialTags(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCall123TestSpecialTags(ref bool suppressDefaultLog, ICall123TestSpecialTagsApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCall123TestSpecialTagsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCall123TestSpecialTags(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCall123TestSpecialTags(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task Call123TestSpecialTagsOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await Call123TestSpecialTagsAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCall123TestSpecialTags(modelClient); + + FormatCall123TestSpecialTags(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/another-fake/dummy"; + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + Call123TestSpecialTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCall123TestSpecialTagsDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnCall123TestSpecialTags(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCall123TestSpecialTagsDefaultImplementation(e, "/another-fake/dummy", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorCall123TestSpecialTags(e); + throw; + } + } + + /// + /// The + /// + public partial class Call123TestSpecialTagsApiResponse : Org.OpenAPITools.Client.ApiResponse, ICall123TestSpecialTagsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public Call123TestSpecialTagsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..84ec2eff6bff --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,1356 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IDefaultApi : IApi + { + /// + /// The class containing the events + /// + DefaultApiEvents Events { get; } + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task FooGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetCountryAsync(string country, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetCountryOrDefaultAsync(string country, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task HelloAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Cancellation Token to cancel the request. + /// <> + Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task RolesReportGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task TestAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IFooGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IGetCountryApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class DefaultApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnFooGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFooGet; + + internal void ExecuteOnFooGet(DefaultApi.FooGetApiResponse apiResponse) + { + OnFooGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFooGet(Exception exception) + { + OnErrorFooGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetCountry; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetCountry; + + internal void ExecuteOnGetCountry(DefaultApi.GetCountryApiResponse apiResponse) + { + OnGetCountry?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetCountry(Exception exception) + { + OnErrorGetCountry?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnHello; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorHello; + + internal void ExecuteOnHello(DefaultApi.HelloApiResponse apiResponse) + { + OnHello?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorHello(Exception exception) + { + OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnRolesReportGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorRolesReportGet; + + internal void ExecuteOnRolesReportGet(DefaultApi.RolesReportGetApiResponse apiResponse) + { + OnRolesReportGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorRolesReportGet(Exception exception) + { + OnErrorRolesReportGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTest; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTest; + + internal void ExecuteOnTest(DefaultApi.TestApiResponse apiResponse) + { + OnTest?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTest(Exception exception) + { + OnErrorTest?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class DefaultApi : IDefaultApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public DefaultApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = defaultApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + /// + /// Processes the server response + /// + /// + private void AfterFooGetDefaultImplementation(IFooGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterFooGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterFooGet(ref bool suppressDefaultLog, IFooGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorFooGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFooGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorFooGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FooGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/foo"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FooGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFooGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnFooGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFooGetDefaultImplementation(e, "/foo", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorFooGet(e); + throw; + } + } + + /// + /// The + /// + public partial class FooGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IFooGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FooGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + /// + /// Deserializes the response if the response is 0 Default + /// + /// + public Org.OpenAPITools.Model.FooGetDefaultResponse Default() + { + // This logic may be modified with the AsModel.mustache template + return IsDefault + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 0 Default and the deserialized response is not null + /// + /// + /// + public bool TryDefault([NotNullWhen(true)]out Org.OpenAPITools.Model.FooGetDefaultResponse result) + { + result = null; + + try + { + result = Default(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetCountry(ref string country); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateGetCountry(string country) + { + if (country == null) + throw new ArgumentNullException(nameof(country)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetCountryDefaultImplementation(IGetCountryApiResponse apiResponseLocalVar, string country) + { + bool suppressDefaultLog = false; + AfterGetCountry(ref suppressDefaultLog, apiResponseLocalVar, country); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetCountry(ref bool suppressDefaultLog, IGetCountryApiResponse apiResponseLocalVar, string country); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetCountryDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string country) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetCountry(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, country); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetCountry(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string country); + + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetCountryOrDefaultAsync(string country, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetCountryAsync(country, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetCountryAsync(string country, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateGetCountry(country); + + FormatGetCountry(ref country); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/country"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("country", ClientUtils.ParameterToString(country))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetCountryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetCountryDefaultImplementation(apiResponseLocalVar, country); + + Events.ExecuteOnGetCountry(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetCountryDefaultImplementation(e, "/country", uriBuilderLocalVar.Path, country); + Events.ExecuteOnErrorGetCountry(e); + throw; + } + } + + /// + /// The + /// + public partial class GetCountryApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetCountryApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetCountryApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterHelloDefaultImplementation(IHelloApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterHello(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterHello(ref bool suppressDefaultLog, IHelloApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorHelloDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorHello(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorHello(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Hello Hello + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await HelloAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task HelloAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/hello"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + HelloApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); + + AfterHelloDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnHello(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorHelloDefaultImplementation(e, "/hello", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorHello(e); + throw; + } + } + + /// + /// The + /// + public partial class HelloApiResponse : Org.OpenAPITools.Client.ApiResponse, IHelloApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public HelloApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterRolesReportGetDefaultImplementation(IRolesReportGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterRolesReportGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterRolesReportGet(ref bool suppressDefaultLog, IRolesReportGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorRolesReportGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorRolesReportGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorRolesReportGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task RolesReportGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await RolesReportGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/roles/report"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + RolesReportGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); + + AfterRolesReportGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnRolesReportGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorRolesReportGetDefaultImplementation(e, "/roles/report", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorRolesReportGet(e); + throw; + } + } + + /// + /// The + /// + public partial class RolesReportGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IRolesReportGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public RolesReportGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterTestDefaultImplementation(ITestApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterTest(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterTest(ref bool suppressDefaultLog, ITestApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorTestDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTest(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorTest(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/test"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnTest(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestDefaultImplementation(e, "/test", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorTest(e); + throw; + } + } + + /// + /// The + /// + public partial class TestApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs new file mode 100644 index 000000000000..567ffe1fa4d2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/FakeApi.cs @@ -0,0 +1,5676 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IFakeApi : IApi + { + /// + /// The class containing the events + /// + FakeApiEvents Events { get; } + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task FakeHealthGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task FakeHealthGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetArrayOfEnumsAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithFileSchemaOrDefaultAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithQueryParamsAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithQueryParamsOrDefaultAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClientModelOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEndpointParametersAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEndpointParametersOrDefaultAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// (optional) + /// Form parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEnumParametersAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// (optional) + /// Form parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEnumParametersOrDefaultAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestGroupParametersAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineAdditionalPropertiesOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineFreeformAdditionalPropertiesOrDefaultAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + Task TestJsonFormDataAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + Task TestJsonFormDataOrDefaultAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestQueryParameterCollectionFormatAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string requiredNullable = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestQueryParameterCollectionFormatOrDefaultAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string requiredNullable = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestStringMapReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced string map + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestStringMapReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IFakeHealthGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterBooleanSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterCompositeSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterNumberSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterStringSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetArrayOfEnumsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetMixedAnyOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetMixedOneOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestBodyWithFileSchemaApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestBodyWithQueryParamsApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestClientModelApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestEndpointParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface ITestEnumParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface ITestGroupParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface ITestInlineAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestInlineFreeformAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestJsonFormDataApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestQueryParameterCollectionFormatApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestStringMapReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeHealthGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeHealthGet; + + internal void ExecuteOnFakeHealthGet(FakeApi.FakeHealthGetApiResponse apiResponse) + { + OnFakeHealthGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeHealthGet(Exception exception) + { + OnErrorFakeHealthGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeOuterBooleanSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeOuterBooleanSerialize; + + internal void ExecuteOnFakeOuterBooleanSerialize(FakeApi.FakeOuterBooleanSerializeApiResponse apiResponse) + { + OnFakeOuterBooleanSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterBooleanSerialize(Exception exception) + { + OnErrorFakeOuterBooleanSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeOuterCompositeSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeOuterCompositeSerialize; + + internal void ExecuteOnFakeOuterCompositeSerialize(FakeApi.FakeOuterCompositeSerializeApiResponse apiResponse) + { + OnFakeOuterCompositeSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterCompositeSerialize(Exception exception) + { + OnErrorFakeOuterCompositeSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeOuterNumberSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeOuterNumberSerialize; + + internal void ExecuteOnFakeOuterNumberSerialize(FakeApi.FakeOuterNumberSerializeApiResponse apiResponse) + { + OnFakeOuterNumberSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterNumberSerialize(Exception exception) + { + OnErrorFakeOuterNumberSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeOuterStringSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeOuterStringSerialize; + + internal void ExecuteOnFakeOuterStringSerialize(FakeApi.FakeOuterStringSerializeApiResponse apiResponse) + { + OnFakeOuterStringSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterStringSerialize(Exception exception) + { + OnErrorFakeOuterStringSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetArrayOfEnums; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetArrayOfEnums; + + internal void ExecuteOnGetArrayOfEnums(FakeApi.GetArrayOfEnumsApiResponse apiResponse) + { + OnGetArrayOfEnums?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetArrayOfEnums(Exception exception) + { + OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetMixedAnyOf; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetMixedAnyOf; + + internal void ExecuteOnGetMixedAnyOf(FakeApi.GetMixedAnyOfApiResponse apiResponse) + { + OnGetMixedAnyOf?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetMixedAnyOf(Exception exception) + { + OnErrorGetMixedAnyOf?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetMixedOneOf; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetMixedOneOf; + + internal void ExecuteOnGetMixedOneOf(FakeApi.GetMixedOneOfApiResponse apiResponse) + { + OnGetMixedOneOf?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetMixedOneOf(Exception exception) + { + OnErrorGetMixedOneOf?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestAdditionalPropertiesReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestAdditionalPropertiesReference; + + internal void ExecuteOnTestAdditionalPropertiesReference(FakeApi.TestAdditionalPropertiesReferenceApiResponse apiResponse) + { + OnTestAdditionalPropertiesReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestAdditionalPropertiesReference(Exception exception) + { + OnErrorTestAdditionalPropertiesReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestBodyWithFileSchema; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestBodyWithFileSchema; + + internal void ExecuteOnTestBodyWithFileSchema(FakeApi.TestBodyWithFileSchemaApiResponse apiResponse) + { + OnTestBodyWithFileSchema?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestBodyWithFileSchema(Exception exception) + { + OnErrorTestBodyWithFileSchema?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestBodyWithQueryParams; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestBodyWithQueryParams; + + internal void ExecuteOnTestBodyWithQueryParams(FakeApi.TestBodyWithQueryParamsApiResponse apiResponse) + { + OnTestBodyWithQueryParams?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestBodyWithQueryParams(Exception exception) + { + OnErrorTestBodyWithQueryParams?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestClientModel; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestClientModel; + + internal void ExecuteOnTestClientModel(FakeApi.TestClientModelApiResponse apiResponse) + { + OnTestClientModel?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestClientModel(Exception exception) + { + OnErrorTestClientModel?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestEndpointParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestEndpointParameters; + + internal void ExecuteOnTestEndpointParameters(FakeApi.TestEndpointParametersApiResponse apiResponse) + { + OnTestEndpointParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestEndpointParameters(Exception exception) + { + OnErrorTestEndpointParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestEnumParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestEnumParameters; + + internal void ExecuteOnTestEnumParameters(FakeApi.TestEnumParametersApiResponse apiResponse) + { + OnTestEnumParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestEnumParameters(Exception exception) + { + OnErrorTestEnumParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestGroupParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestGroupParameters; + + internal void ExecuteOnTestGroupParameters(FakeApi.TestGroupParametersApiResponse apiResponse) + { + OnTestGroupParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestGroupParameters(Exception exception) + { + OnErrorTestGroupParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestInlineAdditionalProperties; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestInlineAdditionalProperties; + + internal void ExecuteOnTestInlineAdditionalProperties(FakeApi.TestInlineAdditionalPropertiesApiResponse apiResponse) + { + OnTestInlineAdditionalProperties?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestInlineAdditionalProperties(Exception exception) + { + OnErrorTestInlineAdditionalProperties?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestInlineFreeformAdditionalProperties; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestInlineFreeformAdditionalProperties; + + internal void ExecuteOnTestInlineFreeformAdditionalProperties(FakeApi.TestInlineFreeformAdditionalPropertiesApiResponse apiResponse) + { + OnTestInlineFreeformAdditionalProperties?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestInlineFreeformAdditionalProperties(Exception exception) + { + OnErrorTestInlineFreeformAdditionalProperties?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestJsonFormData; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestJsonFormData; + + internal void ExecuteOnTestJsonFormData(FakeApi.TestJsonFormDataApiResponse apiResponse) + { + OnTestJsonFormData?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestJsonFormData(Exception exception) + { + OnErrorTestJsonFormData?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestQueryParameterCollectionFormat; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestQueryParameterCollectionFormat; + + internal void ExecuteOnTestQueryParameterCollectionFormat(FakeApi.TestQueryParameterCollectionFormatApiResponse apiResponse) + { + OnTestQueryParameterCollectionFormat?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestQueryParameterCollectionFormat(Exception exception) + { + OnErrorTestQueryParameterCollectionFormat?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestStringMapReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestStringMapReference; + + internal void ExecuteOnTestStringMapReference(FakeApi.TestStringMapReferenceApiResponse apiResponse) + { + OnTestStringMapReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestStringMapReference(Exception exception) + { + OnErrorTestStringMapReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class FakeApi : IFakeApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public FakeApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, FakeApiEvents fakeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = fakeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + /// + /// Processes the server response + /// + /// + private void AfterFakeHealthGetDefaultImplementation(IFakeHealthGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterFakeHealthGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterFakeHealthGet(ref bool suppressDefaultLog, IFakeHealthGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorFakeHealthGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeHealthGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorFakeHealthGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Health check endpoint + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeHealthGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeHealthGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeHealthGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/health"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeHealthGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeHealthGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnFakeHealthGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeHealthGetDefaultImplementation(e, "/fake/health", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorFakeHealthGet(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeHealthGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeHealthGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeHealthGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.HealthCheckResult Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.HealthCheckResult result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterBooleanSerialize(ref Option body); + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterBooleanSerializeDefaultImplementation(IFakeOuterBooleanSerializeApiResponse apiResponseLocalVar, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterBooleanSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, IFakeOuterBooleanSerializeApiResponse apiResponseLocalVar, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterBooleanSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterBooleanSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body); + + /// + /// Test serialization of outer boolean types + /// + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterBooleanSerializeAsync(body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatFakeOuterBooleanSerialize(ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/boolean"; + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterBooleanSerializeDefaultImplementation(apiResponseLocalVar, body); + + Events.ExecuteOnFakeOuterBooleanSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterBooleanSerializeDefaultImplementation(e, "/fake/outer/boolean", uriBuilderLocalVar.Path, body); + Events.ExecuteOnErrorFakeOuterBooleanSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterBooleanSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterBooleanSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterBooleanSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public bool? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out bool? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterCompositeSerialize(Option outerComposite); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterCompositeSerialize(Option outerComposite) + { + if (outerComposite.IsSet && outerComposite.Value == null) + throw new ArgumentNullException(nameof(outerComposite)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterCompositeSerializeDefaultImplementation(IFakeOuterCompositeSerializeApiResponse apiResponseLocalVar, Option outerComposite) + { + bool suppressDefaultLog = false; + AfterFakeOuterCompositeSerialize(ref suppressDefaultLog, apiResponseLocalVar, outerComposite); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, IFakeOuterCompositeSerializeApiResponse apiResponseLocalVar, Option outerComposite); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option outerComposite) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterCompositeSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, outerComposite); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterCompositeSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option outerComposite); + + /// + /// Test serialization of object with outer number type + /// + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterCompositeSerializeAsync(outerComposite, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFakeOuterCompositeSerialize(outerComposite); + + FormatFakeOuterCompositeSerialize(outerComposite); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/composite"; + + if (outerComposite.IsSet) + httpRequestMessageLocalVar.Content = (outerComposite.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterCompositeSerializeDefaultImplementation(apiResponseLocalVar, outerComposite); + + Events.ExecuteOnFakeOuterCompositeSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterCompositeSerializeDefaultImplementation(e, "/fake/outer/composite", uriBuilderLocalVar.Path, outerComposite); + Events.ExecuteOnErrorFakeOuterCompositeSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterCompositeSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterCompositeSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterCompositeSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.OuterComposite Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.OuterComposite result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterNumberSerialize(ref Option body); + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterNumberSerializeDefaultImplementation(IFakeOuterNumberSerializeApiResponse apiResponseLocalVar, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterNumberSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, IFakeOuterNumberSerializeApiResponse apiResponseLocalVar, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterNumberSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterNumberSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body); + + /// + /// Test serialization of outer number types + /// + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterNumberSerializeAsync(body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatFakeOuterNumberSerialize(ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/number"; + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterNumberSerializeDefaultImplementation(apiResponseLocalVar, body); + + Events.ExecuteOnFakeOuterNumberSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterNumberSerializeDefaultImplementation(e, "/fake/outer/number", uriBuilderLocalVar.Path, body); + Events.ExecuteOnErrorFakeOuterNumberSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterNumberSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterNumberSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterNumberSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public decimal? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out decimal? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref Option body); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterStringSerialize(Option body) + { + if (body.IsSet && body.Value == null) + throw new ArgumentNullException(nameof(body)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterFakeOuterStringSerializeDefaultImplementation(IFakeOuterStringSerializeApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterStringSerialize(ref suppressDefaultLog, apiResponseLocalVar, requiredStringUuid, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, IFakeOuterStringSerializeApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Guid requiredStringUuid, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterStringSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requiredStringUuid, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterStringSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Guid requiredStringUuid, Option body); + + /// + /// Test serialization of outer string types + /// + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterStringSerializeAsync(requiredStringUuid, body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFakeOuterStringSerialize(body); + + FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/string"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["required_string_uuid"] = ClientUtils.ParameterToString(requiredStringUuid); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterStringSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterStringSerializeDefaultImplementation(apiResponseLocalVar, requiredStringUuid, body); + + Events.ExecuteOnFakeOuterStringSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterStringSerializeDefaultImplementation(e, "/fake/outer/string", uriBuilderLocalVar.Path, requiredStringUuid, body); + Events.ExecuteOnErrorFakeOuterStringSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterStringSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterStringSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterStringSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public string Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out string result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetArrayOfEnumsDefaultImplementation(IGetArrayOfEnumsApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetArrayOfEnums(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetArrayOfEnums(ref bool suppressDefaultLog, IGetArrayOfEnumsApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetArrayOfEnumsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetArrayOfEnums(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetArrayOfEnums(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Array of Enums + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetArrayOfEnumsAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetArrayOfEnumsAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/array-of-enums"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetArrayOfEnumsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetArrayOfEnumsDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetArrayOfEnums(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetArrayOfEnumsDefaultImplementation(e, "/fake/array-of-enums", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetArrayOfEnums(e); + throw; + } + } + + /// + /// The + /// + public partial class GetArrayOfEnumsApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetArrayOfEnumsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetArrayOfEnumsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetMixedAnyOfDefaultImplementation(IGetMixedAnyOfApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetMixedAnyOf(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetMixedAnyOf(ref bool suppressDefaultLog, IGetMixedAnyOfApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetMixedAnyOfDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetMixedAnyOf(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetMixedAnyOf(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Test mixed type anyOf deserialization + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetMixedAnyOfAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/anyOf"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetMixedAnyOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetMixedAnyOf(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetMixedAnyOfDefaultImplementation(e, "/fake/mixed/anyOf", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetMixedAnyOf(e); + throw; + } + } + + /// + /// The + /// + public partial class GetMixedAnyOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedAnyOfApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetMixedAnyOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.MixedAnyOf Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedAnyOf result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetMixedOneOfDefaultImplementation(IGetMixedOneOfApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetMixedOneOf(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetMixedOneOf(ref bool suppressDefaultLog, IGetMixedOneOfApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetMixedOneOfDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetMixedOneOf(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetMixedOneOf(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Test mixed type oneOf deserialization + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetMixedOneOfAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/oneOf"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetMixedOneOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetMixedOneOf(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetMixedOneOfDefaultImplementation(e, "/fake/mixed/oneOf", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetMixedOneOf(e); + throw; + } + } + + /// + /// The + /// + public partial class GetMixedOneOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedOneOfApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetMixedOneOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.MixedOneOf Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedOneOf result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestAdditionalPropertiesReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestAdditionalPropertiesReferenceDefaultImplementation(ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestAdditionalPropertiesReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestAdditionalPropertiesReference(ref bool suppressDefaultLog, ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestAdditionalPropertiesReference(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestAdditionalPropertiesReference(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAdditionalPropertiesReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestAdditionalPropertiesReference(requestBody); + + FormatTestAdditionalPropertiesReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/additionalProperties-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestAdditionalPropertiesReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(e, "/fake/additionalProperties-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestAdditionalPropertiesReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestAdditionalPropertiesReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestAdditionalPropertiesReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) + { + if (fileSchemaTestClass == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestBodyWithFileSchemaDefaultImplementation(ITestBodyWithFileSchemaApiResponse apiResponseLocalVar, FileSchemaTestClass fileSchemaTestClass) + { + bool suppressDefaultLog = false; + AfterTestBodyWithFileSchema(ref suppressDefaultLog, apiResponseLocalVar, fileSchemaTestClass); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestBodyWithFileSchema(ref bool suppressDefaultLog, ITestBodyWithFileSchemaApiResponse apiResponseLocalVar, FileSchemaTestClass fileSchemaTestClass); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestBodyWithFileSchemaDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, FileSchemaTestClass fileSchemaTestClass) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestBodyWithFileSchema(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, fileSchemaTestClass); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestBodyWithFileSchema(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, FileSchemaTestClass fileSchemaTestClass); + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithFileSchemaOrDefaultAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestBodyWithFileSchemaAsync(fileSchemaTestClass, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestBodyWithFileSchema(fileSchemaTestClass); + + FormatTestBodyWithFileSchema(fileSchemaTestClass); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/body-with-file-schema"; + + httpRequestMessageLocalVar.Content = (fileSchemaTestClass as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(fileSchemaTestClass, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestBodyWithFileSchemaDefaultImplementation(apiResponseLocalVar, fileSchemaTestClass); + + Events.ExecuteOnTestBodyWithFileSchema(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestBodyWithFileSchemaDefaultImplementation(e, "/fake/body-with-file-schema", uriBuilderLocalVar.Path, fileSchemaTestClass); + Events.ExecuteOnErrorTestBodyWithFileSchema(e); + throw; + } + } + + /// + /// The + /// + public partial class TestBodyWithFileSchemaApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestBodyWithFileSchemaApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestBodyWithFileSchemaApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestBodyWithQueryParams(ref string query, User user); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateTestBodyWithQueryParams(string query, User user) + { + if (query == null) + throw new ArgumentNullException(nameof(query)); + + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterTestBodyWithQueryParamsDefaultImplementation(ITestBodyWithQueryParamsApiResponse apiResponseLocalVar, string query, User user) + { + bool suppressDefaultLog = false; + AfterTestBodyWithQueryParams(ref suppressDefaultLog, apiResponseLocalVar, query, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterTestBodyWithQueryParams(ref bool suppressDefaultLog, ITestBodyWithQueryParamsApiResponse apiResponseLocalVar, string query, User user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorTestBodyWithQueryParamsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string query, User user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestBodyWithQueryParams(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, query, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestBodyWithQueryParams(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string query, User user); + + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithQueryParamsOrDefaultAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestBodyWithQueryParamsAsync(query, user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithQueryParamsAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestBodyWithQueryParams(query, user); + + FormatTestBodyWithQueryParams(ref query, user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/body-with-query-params"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["query"] = ClientUtils.ParameterToString(query); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestBodyWithQueryParamsDefaultImplementation(apiResponseLocalVar, query, user); + + Events.ExecuteOnTestBodyWithQueryParams(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestBodyWithQueryParamsDefaultImplementation(e, "/fake/body-with-query-params", uriBuilderLocalVar.Path, query, user); + Events.ExecuteOnErrorTestBodyWithQueryParams(e); + throw; + } + } + + /// + /// The + /// + public partial class TestBodyWithQueryParamsApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestBodyWithQueryParamsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestBodyWithQueryParamsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestClientModel(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestClientModel(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestClientModelDefaultImplementation(ITestClientModelApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterTestClientModel(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestClientModel(ref bool suppressDefaultLog, ITestClientModelApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestClientModelDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestClientModel(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestClientModel(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test \"client\" model To test \"client\" model + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClientModelOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestClientModelAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestClientModel(modelClient); + + FormatTestClientModel(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestClientModelApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestClientModelDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnTestClientModel(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestClientModelDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorTestClientModel(e); + throw; + } + } + + /// + /// The + /// + public partial class TestClientModelApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestClientModelApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestClientModelApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestEndpointParameters(ref decimal number, ref string patternWithoutDelimiter, ref byte[] varByte, ref double varDouble, ref Option binary, ref Option callback, ref Option date, ref Option dateTime, ref Option int32, ref Option int64, ref Option integer, ref Option password, ref Option varFloat, ref Option varString); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEndpointParameters(string patternWithoutDelimiter, byte[] varByte, Option binary, Option callback, Option password, Option varString) + { + if (patternWithoutDelimiter == null) + throw new ArgumentNullException(nameof(patternWithoutDelimiter)); + + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); + + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary)); + + if (callback.IsSet && callback.Value == null) + throw new ArgumentNullException(nameof(callback)); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString) + { + bool suppressDefaultLog = false; + AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestEndpointParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestEndpointParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEndpointParametersOrDefaultAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestEndpointParametersAsync(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEndpointParametersAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestEndpointParameters(patternWithoutDelimiter, varByte, binary, callback, password, varString); + + FormatTestEndpointParameters(ref number, ref patternWithoutDelimiter, ref varByte, ref varDouble, ref binary, ref callback, ref date, ref dateTime, ref int32, ref int64, ref integer, ref password, ref varFloat, ref varString); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("number", ClientUtils.ParameterToString(number))); + + formParameterLocalVars.Add(new KeyValuePair("pattern_without_delimiter", ClientUtils.ParameterToString(patternWithoutDelimiter))); + + formParameterLocalVars.Add(new KeyValuePair("byte", ClientUtils.ParameterToString(varByte))); + + formParameterLocalVars.Add(new KeyValuePair("double", ClientUtils.ParameterToString(varDouble))); + + if (binary.IsSet) + multipartContentLocalVar.Add(new StreamContent(binary.Value)); + + if (callback.IsSet) + formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback.Value))); + + if (date.IsSet) + formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date.Value))); + + if (dateTime.IsSet) + formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime.Value))); + + if (int32.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32.Value))); + + if (int64.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64.Value))); + + if (integer.IsSet) + formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer.Value))); + + if (password.IsSet) + formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password.Value))); + + if (varFloat.IsSet) + formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat.Value))); + + if (varString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BasicToken basicTokenLocalVar1 = (BasicToken) await BasicTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(basicTokenLocalVar1); + + basicTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestEndpointParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestEndpointParametersDefaultImplementation(apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + + Events.ExecuteOnTestEndpointParameters(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestEndpointParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + Events.ExecuteOnErrorTestEndpointParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestEndpointParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestEndpointParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestEndpointParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestEnumParameters(ref Option enumFormString, Option> enumFormStringArray, ref Option enumHeaderString, Option> enumHeaderStringArray, ref Option enumQueryDouble, ref Option enumQueryInteger, ref Option enumQueryString, Option> enumQueryStringArray); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + private void ValidateTestEnumParameters(Option> enumFormStringArray, Option> enumHeaderStringArray, Option> enumQueryStringArray) + { + if (enumFormStringArray.IsSet && enumFormStringArray.Value == null) + throw new ArgumentNullException(nameof(enumFormStringArray)); + + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); + + if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) + throw new ArgumentNullException(nameof(enumQueryStringArray)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestEnumParametersDefaultImplementation(ITestEnumParametersApiResponse apiResponseLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray) + { + bool suppressDefaultLog = false; + AfterTestEnumParameters(ref suppressDefaultLog, apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ITestEnumParametersApiResponse apiResponseLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestEnumParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestEnumParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestEnumParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray); + + /// + /// To test enum parameters To test enum parameters + /// + /// (optional) + /// Form parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEnumParametersOrDefaultAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestEnumParametersAsync(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// (optional) + /// Form parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEnumParametersAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestEnumParameters(enumFormStringArray, enumHeaderStringArray, enumQueryStringArray); + + FormatTestEnumParameters(ref enumFormString, enumFormStringArray, ref enumHeaderString, enumHeaderStringArray, ref enumQueryDouble, ref enumQueryInteger, ref enumQueryString, enumQueryStringArray); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + if (enumQueryDouble.IsSet) + parseQueryStringLocalVar["enum_query_double"] = ClientUtils.ParameterToString(enumQueryDouble.Value); + + if (enumQueryInteger.IsSet) + parseQueryStringLocalVar["enum_query_integer"] = ClientUtils.ParameterToString(enumQueryInteger.Value); + + if (enumQueryString.IsSet) + parseQueryStringLocalVar["enum_query_string"] = ClientUtils.ParameterToString(enumQueryString.Value); + + if (enumQueryStringArray.IsSet) + parseQueryStringLocalVar["enum_query_string_array"] = ClientUtils.ParameterToString(enumQueryStringArray.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + if (enumHeaderString.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString.Value)); + + if (enumHeaderStringArray.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray.Value)); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString.Value))); + + if (enumFormStringArray.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray.Value))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestEnumParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestEnumParametersDefaultImplementation(apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + + Events.ExecuteOnTestEnumParameters(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestEnumParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + Events.ExecuteOnErrorTestEnumParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestEnumParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestEnumParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestEnumParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref long requiredInt64Group, ref int requiredStringGroup, ref Option booleanGroup, ref Option int64Group, ref Option stringGroup); + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestGroupParametersDefaultImplementation(ITestGroupParametersApiResponse apiResponseLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup) + { + bool suppressDefaultLog = false; + AfterTestGroupParameters(ref suppressDefaultLog, apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ITestGroupParametersApiResponse apiResponseLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestGroupParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestGroupParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestGroupParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup); + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestGroupParametersAsync(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestGroupParametersAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredInt64Group, ref requiredStringGroup, ref booleanGroup, ref int64Group, ref stringGroup); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["required_int64_group"] = ClientUtils.ParameterToString(requiredInt64Group); + parseQueryStringLocalVar["required_string_group"] = ClientUtils.ParameterToString(requiredStringGroup); + + if (int64Group.IsSet) + parseQueryStringLocalVar["int64_group"] = ClientUtils.ParameterToString(int64Group.Value); + + if (stringGroup.IsSet) + parseQueryStringLocalVar["string_group"] = ClientUtils.ParameterToString(stringGroup.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.Headers.Add("required_boolean_group", ClientUtils.ParameterToString(requiredBooleanGroup)); + + if (booleanGroup.IsSet) + httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BearerToken bearerTokenLocalVar1 = (BearerToken) await BearerTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(bearerTokenLocalVar1); + + bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestGroupParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestGroupParametersDefaultImplementation(apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + + Events.ExecuteOnTestGroupParameters(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestGroupParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + Events.ExecuteOnErrorTestGroupParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestGroupParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestGroupParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestGroupParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestInlineAdditionalProperties(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestInlineAdditionalProperties(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestInlineAdditionalPropertiesDefaultImplementation(ITestInlineAdditionalPropertiesApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestInlineAdditionalProperties(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestInlineAdditionalProperties(ref bool suppressDefaultLog, ITestInlineAdditionalPropertiesApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestInlineAdditionalPropertiesDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestInlineAdditionalProperties(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestInlineAdditionalProperties(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test inline additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineAdditionalPropertiesOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestInlineAdditionalPropertiesAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestInlineAdditionalProperties(requestBody); + + FormatTestInlineAdditionalProperties(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/inline-additionalProperties"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestInlineAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestInlineAdditionalProperties(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestInlineAdditionalPropertiesDefaultImplementation(e, "/fake/inline-additionalProperties", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestInlineAdditionalProperties(e); + throw; + } + } + + /// + /// The + /// + public partial class TestInlineAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestInlineAdditionalPropertiesApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestInlineAdditionalPropertiesApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + if (testInlineFreeformAdditionalPropertiesRequest == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(ITestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + bool suppressDefaultLog = false; + AfterTestInlineFreeformAdditionalProperties(ref suppressDefaultLog, apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestInlineFreeformAdditionalProperties(ref bool suppressDefaultLog, ITestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestInlineFreeformAdditionalPropertiesDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestInlineFreeformAdditionalProperties(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, testInlineFreeformAdditionalPropertiesRequest); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestInlineFreeformAdditionalProperties(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// test inline free-form additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineFreeformAdditionalPropertiesOrDefaultAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + + FormatTestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/inline-freeform-additionalProperties"; + + httpRequestMessageLocalVar.Content = (testInlineFreeformAdditionalPropertiesRequest as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(testInlineFreeformAdditionalPropertiesRequest, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); + + Events.ExecuteOnTestInlineFreeformAdditionalProperties(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestInlineFreeformAdditionalPropertiesDefaultImplementation(e, "/fake/inline-freeform-additionalProperties", uriBuilderLocalVar.Path, testInlineFreeformAdditionalPropertiesRequest); + Events.ExecuteOnErrorTestInlineFreeformAdditionalProperties(e); + throw; + } + } + + /// + /// The + /// + public partial class TestInlineFreeformAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestInlineFreeformAdditionalPropertiesApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestInlineFreeformAdditionalPropertiesApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestJsonFormData(ref string param, ref string param2); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateTestJsonFormData(string param, string param2) + { + if (param == null) + throw new ArgumentNullException(nameof(param)); + + if (param2 == null) + throw new ArgumentNullException(nameof(param2)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterTestJsonFormDataDefaultImplementation(ITestJsonFormDataApiResponse apiResponseLocalVar, string param, string param2) + { + bool suppressDefaultLog = false; + AfterTestJsonFormData(ref suppressDefaultLog, apiResponseLocalVar, param, param2); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterTestJsonFormData(ref bool suppressDefaultLog, ITestJsonFormDataApiResponse apiResponseLocalVar, string param, string param2); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorTestJsonFormDataDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string param, string param2) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestJsonFormData(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, param, param2); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestJsonFormData(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string param, string param2); + + /// + /// test json serialization of form data + /// + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + public async Task TestJsonFormDataOrDefaultAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestJsonFormDataAsync(param, param2, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + public async Task TestJsonFormDataAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestJsonFormData(param, param2); + + FormatTestJsonFormData(ref param, ref param2); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/jsonFormData"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("param", ClientUtils.ParameterToString(param))); + + formParameterLocalVars.Add(new KeyValuePair("param2", ClientUtils.ParameterToString(param2))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestJsonFormDataApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestJsonFormDataDefaultImplementation(apiResponseLocalVar, param, param2); + + Events.ExecuteOnTestJsonFormData(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestJsonFormDataDefaultImplementation(e, "/fake/jsonFormData", uriBuilderLocalVar.Path, param, param2); + Events.ExecuteOnErrorTestJsonFormData(e); + throw; + } + } + + /// + /// The + /// + public partial class TestJsonFormDataApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestJsonFormDataApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestJsonFormDataApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestQueryParameterCollectionFormat(List context, List http, List ioutil, List pipe, ref string requiredNotNullable, List url, ref Option notRequiredNotNullable, ref Option notRequiredNullable, ref string requiredNullable); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestQueryParameterCollectionFormat(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable) + { + if (context == null) + throw new ArgumentNullException(nameof(context)); + + if (http == null) + throw new ArgumentNullException(nameof(http)); + + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + + if (pipe == null) + throw new ArgumentNullException(nameof(pipe)); + + if (requiredNotNullable == null) + throw new ArgumentNullException(nameof(requiredNotNullable)); + + if (url == null) + throw new ArgumentNullException(nameof(url)); + + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ITestQueryParameterCollectionFormatApiResponse apiResponseLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string requiredNullable) + { + bool suppressDefaultLog = false; + AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ITestQueryParameterCollectionFormatApiResponse apiResponseLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string requiredNullable); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string requiredNullable) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestQueryParameterCollectionFormat(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestQueryParameterCollectionFormat(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string requiredNullable); + + /// + /// To test the collection format in query parameters + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestQueryParameterCollectionFormatOrDefaultAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string requiredNullable = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestQueryParameterCollectionFormatAsync(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestQueryParameterCollectionFormatAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string requiredNullable = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestQueryParameterCollectionFormat(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable); + + FormatTestQueryParameterCollectionFormat(context, http, ioutil, pipe, ref requiredNotNullable, url, ref notRequiredNotNullable, ref notRequiredNullable, ref requiredNullable); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/test-query-parameters"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["context"] = ClientUtils.ParameterToString(context); + parseQueryStringLocalVar["http"] = ClientUtils.ParameterToString(http); + parseQueryStringLocalVar["ioutil"] = ClientUtils.ParameterToString(ioutil); + parseQueryStringLocalVar["pipe"] = ClientUtils.ParameterToString(pipe); + parseQueryStringLocalVar["requiredNotNullable"] = ClientUtils.ParameterToString(requiredNotNullable); + parseQueryStringLocalVar["url"] = ClientUtils.ParameterToString(url); + parseQueryStringLocalVar["requiredNullable"] = ClientUtils.ParameterToString(requiredNullable); + + if (notRequiredNotNullable.IsSet) + parseQueryStringLocalVar["notRequiredNotNullable"] = ClientUtils.ParameterToString(notRequiredNotNullable.Value); + + if (notRequiredNullable.IsSet) + parseQueryStringLocalVar["notRequiredNullable"] = ClientUtils.ParameterToString(notRequiredNullable.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + + Events.ExecuteOnTestQueryParameterCollectionFormat(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + Events.ExecuteOnErrorTestQueryParameterCollectionFormat(e); + throw; + } + } + + /// + /// The + /// + public partial class TestQueryParameterCollectionFormatApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestQueryParameterCollectionFormatApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestQueryParameterCollectionFormatApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestStringMapReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestStringMapReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestStringMapReferenceDefaultImplementation(ITestStringMapReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestStringMapReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestStringMapReference(ref bool suppressDefaultLog, ITestStringMapReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestStringMapReferenceDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestStringMapReference(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestStringMapReference(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test referenced string map + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestStringMapReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestStringMapReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestStringMapReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestStringMapReference(requestBody); + + FormatTestStringMapReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/stringMap-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestStringMapReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestStringMapReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestStringMapReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestStringMapReferenceDefaultImplementation(e, "/fake/stringMap-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestStringMapReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestStringMapReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestStringMapReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestStringMapReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs new file mode 100644 index 000000000000..a12284afb01b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -0,0 +1,416 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IFakeClassnameTags123Api : IApi + { + /// + /// The class containing the events + /// + FakeClassnameTags123ApiEvents Events { get; } + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClassnameOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ITestClassnameApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeClassnameTags123ApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnTestClassname; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestClassname; + + internal void ExecuteOnTestClassname(FakeClassnameTags123Api.TestClassnameApiResponse apiResponse) + { + OnTestClassname?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestClassname(Exception exception) + { + OnErrorTestClassname?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class FakeClassnameTags123Api : IFakeClassnameTags123Api + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public FakeClassnameTags123ApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, FakeClassnameTags123ApiEvents fakeClassnameTags123ApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = fakeClassnameTags123ApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatTestClassname(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestClassname(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestClassnameDefaultImplementation(ITestClassnameApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterTestClassname(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestClassname(ref bool suppressDefaultLog, ITestClassnameApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestClassnameDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestClassname(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestClassname(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test class name in snake case To test class name in snake case + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClassnameOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestClassnameAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestClassname(modelClient); + + FormatTestClassname(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake_classname_test"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key_query", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + + apiKeyTokenLocalVar1.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestClassnameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestClassnameDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnTestClassname(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestClassnameDefaultImplementation(e, "/fake_classname_test", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorTestClassname(e); + throw; + } + } + + /// + /// The + /// + public partial class TestClassnameApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestClassnameApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestClassnameApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/PetApi.cs new file mode 100644 index 000000000000..3361c03e39bf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -0,0 +1,2828 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IPetApi : IApi + { + /// + /// The class containing the events + /// + PetApiEvents Events { get; } + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task AddPetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + Task DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + Task DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Cancellation Token to cancel the request. + /// <> + Task FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter (deprecated) + /// Cancellation Token to cancel the request. + /// <> + Task FindPetsByStatusOrDefaultAsync(List status, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + [Obsolete] + Task FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + [Obsolete] + Task FindPetsByTagsOrDefaultAsync(List tags, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + Task GetPetByIdOrDefaultAsync(long petId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image + /// + /// + /// + /// + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileOrDefaultAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileWithRequiredFileOrDefaultAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IAddPetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IDeletePetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface IFindPetsByStatusApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } + } + + /// + /// The + /// + public interface IFindPetsByTagsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface IGetPetByIdApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IUpdatePetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IUpdatePetWithFormApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IUploadFileApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IUploadFileWithRequiredFileApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class PetApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnAddPet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorAddPet; + + internal void ExecuteOnAddPet(PetApi.AddPetApiResponse apiResponse) + { + OnAddPet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorAddPet(Exception exception) + { + OnErrorAddPet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnDeletePet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorDeletePet; + + internal void ExecuteOnDeletePet(PetApi.DeletePetApiResponse apiResponse) + { + OnDeletePet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeletePet(Exception exception) + { + OnErrorDeletePet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFindPetsByStatus; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFindPetsByStatus; + + internal void ExecuteOnFindPetsByStatus(PetApi.FindPetsByStatusApiResponse apiResponse) + { + OnFindPetsByStatus?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFindPetsByStatus(Exception exception) + { + OnErrorFindPetsByStatus?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFindPetsByTags; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFindPetsByTags; + + internal void ExecuteOnFindPetsByTags(PetApi.FindPetsByTagsApiResponse apiResponse) + { + OnFindPetsByTags?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFindPetsByTags(Exception exception) + { + OnErrorFindPetsByTags?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetPetById; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetPetById; + + internal void ExecuteOnGetPetById(PetApi.GetPetByIdApiResponse apiResponse) + { + OnGetPetById?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetPetById(Exception exception) + { + OnErrorGetPetById?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUpdatePet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUpdatePet; + + internal void ExecuteOnUpdatePet(PetApi.UpdatePetApiResponse apiResponse) + { + OnUpdatePet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdatePet(Exception exception) + { + OnErrorUpdatePet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUpdatePetWithForm; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUpdatePetWithForm; + + internal void ExecuteOnUpdatePetWithForm(PetApi.UpdatePetWithFormApiResponse apiResponse) + { + OnUpdatePetWithForm?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdatePetWithForm(Exception exception) + { + OnErrorUpdatePetWithForm?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUploadFile; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUploadFile; + + internal void ExecuteOnUploadFile(PetApi.UploadFileApiResponse apiResponse) + { + OnUploadFile?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUploadFile(Exception exception) + { + OnErrorUploadFile?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUploadFileWithRequiredFile; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUploadFileWithRequiredFile; + + internal void ExecuteOnUploadFileWithRequiredFile(PetApi.UploadFileWithRequiredFileApiResponse apiResponse) + { + OnUploadFileWithRequiredFile?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUploadFileWithRequiredFile(Exception exception) + { + OnErrorUploadFileWithRequiredFile?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class PetApi : IPetApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public PetApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, PetApiEvents petApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = petApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatAddPet(Pet pet); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateAddPet(Pet pet) + { + if (pet == null) + throw new ArgumentNullException(nameof(pet)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterAddPetDefaultImplementation(IAddPetApiResponse apiResponseLocalVar, Pet pet) + { + bool suppressDefaultLog = false; + AfterAddPet(ref suppressDefaultLog, apiResponseLocalVar, pet); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterAddPet(ref bool suppressDefaultLog, IAddPetApiResponse apiResponseLocalVar, Pet pet); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorAddPetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet) + { + bool suppressDefaultLogLocalVar = false; + OnErrorAddPet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, pet); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorAddPet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet); + + /// + /// Add a new pet to the store + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task AddPetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await AddPetAsync(pet, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateAddPet(pet); + + FormatAddPet(pet); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("http://petstore.swagger.io/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + + httpRequestMessageLocalVar.Content = (pet as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] contentTypes = new string[] { + "application/json", + "application/xml" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + AddPetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + + AfterAddPetDefaultImplementation(apiResponseLocalVar, pet); + + Events.ExecuteOnAddPet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorAddPetDefaultImplementation(e, "/pet", uriBuilderLocalVar.Path, pet); + Events.ExecuteOnErrorAddPet(e); + throw; + } + } + + /// + /// The + /// + public partial class AddPetApiResponse : Org.OpenAPITools.Client.ApiResponse, IAddPetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public AddPetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatDeletePet(ref long petId, ref Option apiKey); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeletePet(Option apiKey) + { + if (apiKey.IsSet && apiKey.Value == null) + throw new ArgumentNullException(nameof(apiKey)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterDeletePetDefaultImplementation(IDeletePetApiResponse apiResponseLocalVar, long petId, Option apiKey) + { + bool suppressDefaultLog = false; + AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterDeletePet(ref bool suppressDefaultLog, IDeletePetApiResponse apiResponseLocalVar, long petId, Option apiKey); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorDeletePetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option apiKey) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeletePet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, apiKey); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorDeletePet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option apiKey); + + /// + /// Deletes a pet + /// + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeletePetAsync(petId, apiKey, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeletePet(apiKey); + + FormatDeletePet(ref petId, ref apiKey); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + if (apiKey.IsSet) + httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeletePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeletePetDefaultImplementation(apiResponseLocalVar, petId, apiKey); + + Events.ExecuteOnDeletePet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeletePetDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId, apiKey); + Events.ExecuteOnErrorDeletePet(e); + throw; + } + } + + /// + /// The + /// + public partial class DeletePetApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeletePetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeletePetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFindPetsByStatus(List status); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFindPetsByStatus(List status) + { + if (status == null) + throw new ArgumentNullException(nameof(status)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFindPetsByStatusDefaultImplementation(IFindPetsByStatusApiResponse apiResponseLocalVar, List status) + { + bool suppressDefaultLog = false; + AfterFindPetsByStatus(ref suppressDefaultLog, apiResponseLocalVar, status); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFindPetsByStatus(ref bool suppressDefaultLog, IFindPetsByStatusApiResponse apiResponseLocalVar, List status); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFindPetsByStatusDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List status) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFindPetsByStatus(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, status); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFindPetsByStatus(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List status); + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByStatusOrDefaultAsync(List status, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FindPetsByStatusAsync(status, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFindPetsByStatus(status); + + FormatFindPetsByStatus(status); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/findByStatus"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["status"] = ClientUtils.ParameterToString(status); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FindPetsByStatusApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFindPetsByStatusDefaultImplementation(apiResponseLocalVar, status); + + Events.ExecuteOnFindPetsByStatus(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFindPetsByStatusDefaultImplementation(e, "/pet/findByStatus", uriBuilderLocalVar.Path, status); + Events.ExecuteOnErrorFindPetsByStatus(e); + throw; + } + } + + /// + /// The + /// + public partial class FindPetsByStatusApiResponse : Org.OpenAPITools.Client.ApiResponse, IFindPetsByStatusApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FindPetsByStatusApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFindPetsByTags(List tags); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFindPetsByTags(List tags) + { + if (tags == null) + throw new ArgumentNullException(nameof(tags)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFindPetsByTagsDefaultImplementation(IFindPetsByTagsApiResponse apiResponseLocalVar, List tags) + { + bool suppressDefaultLog = false; + AfterFindPetsByTags(ref suppressDefaultLog, apiResponseLocalVar, tags); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFindPetsByTags(ref bool suppressDefaultLog, IFindPetsByTagsApiResponse apiResponseLocalVar, List tags); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFindPetsByTagsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List tags) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFindPetsByTags(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, tags); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFindPetsByTags(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List tags); + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByTagsOrDefaultAsync(List tags, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FindPetsByTagsAsync(tags, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFindPetsByTags(tags); + + FormatFindPetsByTags(tags); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/findByTags"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["tags"] = ClientUtils.ParameterToString(tags); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FindPetsByTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFindPetsByTagsDefaultImplementation(apiResponseLocalVar, tags); + + Events.ExecuteOnFindPetsByTags(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFindPetsByTagsDefaultImplementation(e, "/pet/findByTags", uriBuilderLocalVar.Path, tags); + Events.ExecuteOnErrorFindPetsByTags(e); + throw; + } + } + + /// + /// The + /// + public partial class FindPetsByTagsApiResponse : Org.OpenAPITools.Client.ApiResponse, IFindPetsByTagsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FindPetsByTagsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetPetById(ref long petId); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetPetByIdDefaultImplementation(IGetPetByIdApiResponse apiResponseLocalVar, long petId) + { + bool suppressDefaultLog = false; + AfterGetPetById(ref suppressDefaultLog, apiResponseLocalVar, petId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetPetById(ref bool suppressDefaultLog, IGetPetByIdApiResponse apiResponseLocalVar, long petId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetPetByIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetPetById(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetPetById(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId); + + /// + /// Find pet by ID Returns a single pet + /// + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + public async Task GetPetByIdOrDefaultAsync(long petId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetPetByIdAsync(petId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + public async Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetPetById(ref petId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar); + + ApiKeyToken apiKeyTokenLocalVar2 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key_query", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar2); + + apiKeyTokenLocalVar2.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetPetByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetPetByIdDefaultImplementation(apiResponseLocalVar, petId); + + Events.ExecuteOnGetPetById(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetPetByIdDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId); + Events.ExecuteOnErrorGetPetById(e); + throw; + } + } + + /// + /// The + /// + public partial class GetPetByIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetPetByIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetPetByIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Pet Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Pet result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdatePet(Pet pet); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateUpdatePet(Pet pet) + { + if (pet == null) + throw new ArgumentNullException(nameof(pet)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterUpdatePetDefaultImplementation(IUpdatePetApiResponse apiResponseLocalVar, Pet pet) + { + bool suppressDefaultLog = false; + AfterUpdatePet(ref suppressDefaultLog, apiResponseLocalVar, pet); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterUpdatePet(ref bool suppressDefaultLog, IUpdatePetApiResponse apiResponseLocalVar, Pet pet); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorUpdatePetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdatePet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, pet); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdatePet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet); + + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdatePetAsync(pet, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdatePet(pet); + + FormatUpdatePet(pet); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("http://petstore.swagger.io/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + + httpRequestMessageLocalVar.Content = (pet as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] contentTypes = new string[] { + "application/json", + "application/xml" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdatePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdatePetDefaultImplementation(apiResponseLocalVar, pet); + + Events.ExecuteOnUpdatePet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdatePetDefaultImplementation(e, "/pet", uriBuilderLocalVar.Path, pet); + Events.ExecuteOnErrorUpdatePet(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdatePetApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdatePetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdatePetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdatePetWithForm(ref long petId, ref Option name, ref Option status); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUpdatePetWithForm(Option name, Option status) + { + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name)); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUpdatePetWithFormDefaultImplementation(IUpdatePetWithFormApiResponse apiResponseLocalVar, long petId, Option name, Option status) + { + bool suppressDefaultLog = false; + AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, IUpdatePetWithFormApiResponse apiResponseLocalVar, long petId, Option name, Option status); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option name, Option status) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdatePetWithForm(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, name, status); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdatePetWithForm(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option name, Option status); + + /// + /// Updates a pet in the store with form data + /// + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdatePetWithFormAsync(petId, name, status, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdatePetWithForm(name, status); + + FormatUpdatePetWithForm(ref petId, ref name, ref status); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet) + formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name.Value))); + + if (status.IsSet) + formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdatePetWithFormApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdatePetWithFormDefaultImplementation(apiResponseLocalVar, petId, name, status); + + Events.ExecuteOnUpdatePetWithForm(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdatePetWithFormDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId, name, status); + Events.ExecuteOnErrorUpdatePetWithForm(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdatePetWithFormApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdatePetWithFormApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdatePetWithFormApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUploadFile(ref long petId, ref Option additionalMetadata, ref Option file); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUploadFile(Option additionalMetadata, Option file) + { + if (additionalMetadata.IsSet && additionalMetadata.Value == null) + throw new ArgumentNullException(nameof(additionalMetadata)); + + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUploadFileDefaultImplementation(IUploadFileApiResponse apiResponseLocalVar, long petId, Option additionalMetadata, Option file) + { + bool suppressDefaultLog = false; + AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, additionalMetadata, file); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUploadFile(ref bool suppressDefaultLog, IUploadFileApiResponse apiResponseLocalVar, long petId, Option additionalMetadata, Option file); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUploadFileDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option additionalMetadata, Option file) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUploadFile(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, additionalMetadata, file); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUploadFile(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option additionalMetadata, Option file); + + /// + /// uploads an image + /// + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileOrDefaultAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UploadFileAsync(petId, additionalMetadata, file, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUploadFile(additionalMetadata, file); + + FormatUploadFile(ref petId, ref additionalMetadata, ref file); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}/uploadImage"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); + + if (file.IsSet) + multipartContentLocalVar.Add(new StreamContent(file.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "multipart/form-data" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UploadFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUploadFileDefaultImplementation(apiResponseLocalVar, petId, additionalMetadata, file); + + Events.ExecuteOnUploadFile(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUploadFileDefaultImplementation(e, "/pet/{petId}/uploadImage", uriBuilderLocalVar.Path, petId, additionalMetadata, file); + Events.ExecuteOnErrorUploadFile(e); + throw; + } + } + + /// + /// The + /// + public partial class UploadFileApiResponse : Org.OpenAPITools.Client.ApiResponse, IUploadFileApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UploadFileApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ApiResponse Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUploadFileWithRequiredFile(ref long petId, ref System.IO.Stream requiredFile, ref Option additionalMetadata); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option additionalMetadata) + { + if (requiredFile == null) + throw new ArgumentNullException(nameof(requiredFile)); + + if (additionalMetadata.IsSet && additionalMetadata.Value == null) + throw new ArgumentNullException(nameof(additionalMetadata)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUploadFileWithRequiredFileDefaultImplementation(IUploadFileWithRequiredFileApiResponse apiResponseLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata) + { + bool suppressDefaultLog = false; + AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, petId, requiredFile, additionalMetadata); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, IUploadFileWithRequiredFileApiResponse apiResponseLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUploadFileWithRequiredFile(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, requiredFile, additionalMetadata); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUploadFileWithRequiredFile(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata); + + /// + /// uploads an image (required) + /// + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileWithRequiredFileOrDefaultAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UploadFileWithRequiredFileAsync(petId, requiredFile, additionalMetadata, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUploadFileWithRequiredFile(requiredFile, additionalMetadata); + + FormatUploadFileWithRequiredFile(ref petId, ref requiredFile, ref additionalMetadata); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/{petId}/uploadImageWithRequiredFile"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); multipartContentLocalVar.Add(new StreamContent(requiredFile)); + + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "multipart/form-data" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUploadFileWithRequiredFileDefaultImplementation(apiResponseLocalVar, petId, requiredFile, additionalMetadata); + + Events.ExecuteOnUploadFileWithRequiredFile(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUploadFileWithRequiredFileDefaultImplementation(e, "/fake/{petId}/uploadImageWithRequiredFile", uriBuilderLocalVar.Path, petId, requiredFile, additionalMetadata); + Events.ExecuteOnErrorUploadFileWithRequiredFile(e); + throw; + } + } + + /// + /// The + /// + public partial class UploadFileWithRequiredFileApiResponse : Org.OpenAPITools.Client.ApiResponse, IUploadFileWithRequiredFileApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UploadFileWithRequiredFileApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ApiResponse Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs new file mode 100644 index 000000000000..b3cd5adcbcca --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,1201 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IStoreApi : IApi + { + /// + /// The class containing the events + /// + StoreApiEvents Events { get; } + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteOrderOrDefaultAsync(string orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetInventoryOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + Task GetOrderByIdOrDefaultAsync(long orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + Task PlaceOrderOrDefaultAsync(Order order, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IDeleteOrderApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IGetInventoryApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetOrderByIdApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IPlaceOrderApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class StoreApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnDeleteOrder; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorDeleteOrder; + + internal void ExecuteOnDeleteOrder(StoreApi.DeleteOrderApiResponse apiResponse) + { + OnDeleteOrder?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeleteOrder(Exception exception) + { + OnErrorDeleteOrder?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetInventory; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetInventory; + + internal void ExecuteOnGetInventory(StoreApi.GetInventoryApiResponse apiResponse) + { + OnGetInventory?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetInventory(Exception exception) + { + OnErrorGetInventory?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetOrderById; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetOrderById; + + internal void ExecuteOnGetOrderById(StoreApi.GetOrderByIdApiResponse apiResponse) + { + OnGetOrderById?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetOrderById(Exception exception) + { + OnErrorGetOrderById?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnPlaceOrder; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorPlaceOrder; + + internal void ExecuteOnPlaceOrder(StoreApi.PlaceOrderApiResponse apiResponse) + { + OnPlaceOrder?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorPlaceOrder(Exception exception) + { + OnErrorPlaceOrder?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class StoreApi : IStoreApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public StoreApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, StoreApiEvents storeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = storeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatDeleteOrder(ref string orderId); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeleteOrder(string orderId) + { + if (orderId == null) + throw new ArgumentNullException(nameof(orderId)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterDeleteOrderDefaultImplementation(IDeleteOrderApiResponse apiResponseLocalVar, string orderId) + { + bool suppressDefaultLog = false; + AfterDeleteOrder(ref suppressDefaultLog, apiResponseLocalVar, orderId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterDeleteOrder(ref bool suppressDefaultLog, IDeleteOrderApiResponse apiResponseLocalVar, string orderId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorDeleteOrderDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string orderId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeleteOrder(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, orderId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorDeleteOrder(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string orderId); + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteOrderOrDefaultAsync(string orderId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeleteOrderAsync(orderId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeleteOrder(orderId); + + FormatDeleteOrder(ref orderId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order/{order_id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeleteOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeleteOrderDefaultImplementation(apiResponseLocalVar, orderId); + + Events.ExecuteOnDeleteOrder(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeleteOrderDefaultImplementation(e, "/store/order/{order_id}", uriBuilderLocalVar.Path, orderId); + Events.ExecuteOnErrorDeleteOrder(e); + throw; + } + } + + /// + /// The + /// + public partial class DeleteOrderApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeleteOrderApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteOrderApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetInventoryDefaultImplementation(IGetInventoryApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetInventory(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetInventory(ref bool suppressDefaultLog, IGetInventoryApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetInventoryDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetInventory(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetInventory(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetInventoryOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetInventoryAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/inventory"; + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetInventoryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetInventoryDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetInventory(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetInventoryDefaultImplementation(e, "/store/inventory", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetInventory(e); + throw; + } + } + + /// + /// The + /// + public partial class GetInventoryApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetInventoryApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetInventoryApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Dictionary Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Dictionary result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetOrderById(ref long orderId); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetOrderByIdDefaultImplementation(IGetOrderByIdApiResponse apiResponseLocalVar, long orderId) + { + bool suppressDefaultLog = false; + AfterGetOrderById(ref suppressDefaultLog, apiResponseLocalVar, orderId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetOrderById(ref bool suppressDefaultLog, IGetOrderByIdApiResponse apiResponseLocalVar, long orderId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetOrderByIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long orderId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetOrderById(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, orderId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetOrderById(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long orderId); + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + public async Task GetOrderByIdOrDefaultAsync(long orderId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetOrderByIdAsync(orderId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + public async Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetOrderById(ref orderId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order/{order_id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetOrderByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetOrderByIdDefaultImplementation(apiResponseLocalVar, orderId); + + Events.ExecuteOnGetOrderById(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetOrderByIdDefaultImplementation(e, "/store/order/{order_id}", uriBuilderLocalVar.Path, orderId); + Events.ExecuteOnErrorGetOrderById(e); + throw; + } + } + + /// + /// The + /// + public partial class GetOrderByIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetOrderByIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetOrderByIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Order Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatPlaceOrder(Order order); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidatePlaceOrder(Order order) + { + if (order == null) + throw new ArgumentNullException(nameof(order)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterPlaceOrderDefaultImplementation(IPlaceOrderApiResponse apiResponseLocalVar, Order order) + { + bool suppressDefaultLog = false; + AfterPlaceOrder(ref suppressDefaultLog, apiResponseLocalVar, order); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterPlaceOrder(ref bool suppressDefaultLog, IPlaceOrderApiResponse apiResponseLocalVar, Order order); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorPlaceOrderDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Order order) + { + bool suppressDefaultLogLocalVar = false; + OnErrorPlaceOrder(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, order); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorPlaceOrder(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Order order); + + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + public async Task PlaceOrderOrDefaultAsync(Order order, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await PlaceOrderAsync(order, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + public async Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidatePlaceOrder(order); + + FormatPlaceOrder(order); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order"; + + httpRequestMessageLocalVar.Content = (order as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(order, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + PlaceOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); + + AfterPlaceOrderDefaultImplementation(apiResponseLocalVar, order); + + Events.ExecuteOnPlaceOrder(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorPlaceOrderDefaultImplementation(e, "/store/order", uriBuilderLocalVar.Path, order); + Events.ExecuteOnErrorPlaceOrder(e); + throw; + } + } + + /// + /// The + /// + public partial class PlaceOrderApiResponse : Org.OpenAPITools.Client.ApiResponse, IPlaceOrderApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public PlaceOrderApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Order Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/UserApi.cs new file mode 100644 index 000000000000..788e681d73c8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/UserApi.cs @@ -0,0 +1,2262 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IUserApi : IApi + { + /// + /// The class containing the events + /// + UserApiEvents Events { get; } + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUserOrDefaultAsync(User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithArrayInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithListInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteUserOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get user by user name + /// + /// + /// + /// + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + Task GetUserByNameOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + Task LoginUserAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + Task LoginUserOrDefaultAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task LogoutUserOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task UpdateUserAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task UpdateUserOrDefaultAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ICreateUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface ICreateUsersWithArrayInputApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface ICreateUsersWithListInputApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IDeleteUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IGetUserByNameApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk, ICustomHttpStatusCode599 + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 598 CustomHttpStatusCode598 + /// + /// + bool IsCustomHttpStatusCode598 { get; } + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 + /// + /// + bool IsCustomHttpStatusCode599 { get; } + } + + /// + /// The + /// + public interface ILoginUserApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface ILogoutUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IUpdateUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class UserApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnCreateUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorCreateUser; + + internal void ExecuteOnCreateUser(UserApi.CreateUserApiResponse apiResponse) + { + OnCreateUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUser(Exception exception) + { + OnErrorCreateUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnCreateUsersWithArrayInput; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorCreateUsersWithArrayInput; + + internal void ExecuteOnCreateUsersWithArrayInput(UserApi.CreateUsersWithArrayInputApiResponse apiResponse) + { + OnCreateUsersWithArrayInput?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUsersWithArrayInput(Exception exception) + { + OnErrorCreateUsersWithArrayInput?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnCreateUsersWithListInput; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorCreateUsersWithListInput; + + internal void ExecuteOnCreateUsersWithListInput(UserApi.CreateUsersWithListInputApiResponse apiResponse) + { + OnCreateUsersWithListInput?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUsersWithListInput(Exception exception) + { + OnErrorCreateUsersWithListInput?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnDeleteUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorDeleteUser; + + internal void ExecuteOnDeleteUser(UserApi.DeleteUserApiResponse apiResponse) + { + OnDeleteUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeleteUser(Exception exception) + { + OnErrorDeleteUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetUserByName; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetUserByName; + + internal void ExecuteOnGetUserByName(UserApi.GetUserByNameApiResponse apiResponse) + { + OnGetUserByName?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetUserByName(Exception exception) + { + OnErrorGetUserByName?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnLoginUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorLoginUser; + + internal void ExecuteOnLoginUser(UserApi.LoginUserApiResponse apiResponse) + { + OnLoginUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorLoginUser(Exception exception) + { + OnErrorLoginUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnLogoutUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorLogoutUser; + + internal void ExecuteOnLogoutUser(UserApi.LogoutUserApiResponse apiResponse) + { + OnLogoutUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorLogoutUser(Exception exception) + { + OnErrorLogoutUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUpdateUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUpdateUser; + + internal void ExecuteOnUpdateUser(UserApi.UpdateUserApiResponse apiResponse) + { + OnUpdateUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdateUser(Exception exception) + { + OnErrorUpdateUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class UserApi : IUserApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public UserApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// The token cookie container + /// + public Org.OpenAPITools.Client.CookieContainer CookieContainer { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, UserApiEvents userApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider, + Org.OpenAPITools.Client.CookieContainer cookieContainer) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = userApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + CookieContainer = cookieContainer; + } + + partial void FormatCreateUser(User user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUser(User user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUserDefaultImplementation(ICreateUserApiResponse apiResponseLocalVar, User user) + { + bool suppressDefaultLog = false; + AfterCreateUser(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUser(ref bool suppressDefaultLog, ICreateUserApiResponse apiResponseLocalVar, User user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user); + + /// + /// Create user This can only be done by the logged in user. + /// + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUserOrDefaultAsync(User user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUserAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUser(user); + + FormatCreateUser(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUserDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUserDefaultImplementation(e, "/user", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUser(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatCreateUsersWithArrayInput(List user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUsersWithArrayInput(List user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUsersWithArrayInputDefaultImplementation(ICreateUsersWithArrayInputApiResponse apiResponseLocalVar, List user) + { + bool suppressDefaultLog = false; + AfterCreateUsersWithArrayInput(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUsersWithArrayInput(ref bool suppressDefaultLog, ICreateUsersWithArrayInputApiResponse apiResponseLocalVar, List user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUsersWithArrayInputDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUsersWithArrayInput(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUsersWithArrayInput(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user); + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithArrayInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUsersWithArrayInputAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUsersWithArrayInput(user); + + FormatCreateUsersWithArrayInput(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/createWithArray"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUsersWithArrayInputDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUsersWithArrayInput(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUsersWithArrayInputDefaultImplementation(e, "/user/createWithArray", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUsersWithArrayInput(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUsersWithArrayInputApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUsersWithArrayInputApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUsersWithArrayInputApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatCreateUsersWithListInput(List user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUsersWithListInput(List user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUsersWithListInputDefaultImplementation(ICreateUsersWithListInputApiResponse apiResponseLocalVar, List user) + { + bool suppressDefaultLog = false; + AfterCreateUsersWithListInput(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUsersWithListInput(ref bool suppressDefaultLog, ICreateUsersWithListInputApiResponse apiResponseLocalVar, List user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUsersWithListInputDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUsersWithListInput(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUsersWithListInput(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user); + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithListInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUsersWithListInputAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUsersWithListInput(user); + + FormatCreateUsersWithListInput(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/createWithList"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUsersWithListInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUsersWithListInputDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUsersWithListInput(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUsersWithListInputDefaultImplementation(e, "/user/createWithList", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUsersWithListInput(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUsersWithListInputApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUsersWithListInputApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUsersWithListInputApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatDeleteUser(ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeleteUser(string username) + { + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterDeleteUserDefaultImplementation(IDeleteUserApiResponse apiResponseLocalVar, string username) + { + bool suppressDefaultLog = false; + AfterDeleteUser(ref suppressDefaultLog, apiResponseLocalVar, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterDeleteUser(ref bool suppressDefaultLog, IDeleteUserApiResponse apiResponseLocalVar, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorDeleteUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeleteUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorDeleteUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username); + + /// + /// Delete user This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteUserOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeleteUserAsync(username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeleteUser(username); + + FormatDeleteUser(ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeleteUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeleteUserDefaultImplementation(apiResponseLocalVar, username); + + Events.ExecuteOnDeleteUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeleteUserDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, username); + Events.ExecuteOnErrorDeleteUser(e); + throw; + } + } + + /// + /// The + /// + public partial class DeleteUserApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeleteUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetUserByName(ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateGetUserByName(string username) + { + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetUserByNameDefaultImplementation(IGetUserByNameApiResponse apiResponseLocalVar, string username) + { + bool suppressDefaultLog = false; + AfterGetUserByName(ref suppressDefaultLog, apiResponseLocalVar, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetUserByName(ref bool suppressDefaultLog, IGetUserByNameApiResponse apiResponseLocalVar, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetUserByNameDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetUserByName(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetUserByName(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username); + + /// + /// Get user by user name + /// + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetUserByNameOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetUserByNameAsync(username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateGetUserByName(username); + + FormatGetUserByName(ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetUserByNameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetUserByNameDefaultImplementation(apiResponseLocalVar, username); + + Events.ExecuteOnGetUserByName(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetUserByNameDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, username); + Events.ExecuteOnErrorGetUserByName(e); + throw; + } + } + + /// + /// The + /// + public partial class GetUserByNameApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetUserByNameApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetUserByNameApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.User Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Returns true if the response is 598 CustomHttpStatusCode598 + /// + /// + public bool IsCustomHttpStatusCode598 => 598 == (int)StatusCode; + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 + /// + /// + public bool IsCustomHttpStatusCode599 => 599 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 599 CustomHttpStatusCode599 + /// + /// + public Org.OpenAPITools.Model.User CustomHttpStatusCode599() + { + // This logic may be modified with the AsModel.mustache template + return IsCustomHttpStatusCode599 + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 and the deserialized response is not null + /// + /// + /// + public bool TryCustomHttpStatusCode599([NotNullWhen(true)]out Org.OpenAPITools.Model.User result) + { + result = null; + + try + { + result = CustomHttpStatusCode599(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)599); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatLoginUser(ref string password, ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateLoginUser(string password, string username) + { + if (password == null) + throw new ArgumentNullException(nameof(password)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterLoginUserDefaultImplementation(ILoginUserApiResponse apiResponseLocalVar, string password, string username) + { + bool suppressDefaultLog = false; + AfterLoginUser(ref suppressDefaultLog, apiResponseLocalVar, password, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterLoginUser(ref bool suppressDefaultLog, ILoginUserApiResponse apiResponseLocalVar, string password, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorLoginUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string password, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorLoginUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, password, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorLoginUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string password, string username); + + /// + /// Logs user into the system + /// + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + public async Task LoginUserOrDefaultAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await LoginUserAsync(password, username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + public async Task LoginUserAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateLoginUser(password, username); + + FormatLoginUser(ref password, ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/login"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["password"] = ClientUtils.ParameterToString(password); + parseQueryStringLocalVar["username"] = ClientUtils.ParameterToString(username); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + LoginUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); + + AfterLoginUserDefaultImplementation(apiResponseLocalVar, password, username); + + Events.ExecuteOnLoginUser(apiResponseLocalVar); + + if (httpResponseMessageLocalVar.StatusCode == (HttpStatusCode) 200 && httpResponseMessageLocalVar.Headers.TryGetValues("Set-Cookie", out var cookieHeadersLocalVar)) + { + foreach(string cookieHeader in cookieHeadersLocalVar) + { + IList setCookieHeaderValuesLocalVar = Microsoft.Net.Http.Headers.SetCookieHeaderValue.ParseList(cookieHeadersLocalVar.ToArray()); + + foreach(Microsoft.Net.Http.Headers.SetCookieHeaderValue setCookieHeaderValueLocalVar in setCookieHeaderValuesLocalVar) + { + Cookie cookieLocalVar = new Cookie(setCookieHeaderValueLocalVar.Name.ToString(), setCookieHeaderValueLocalVar.Value.ToString()) + { + HttpOnly = setCookieHeaderValueLocalVar.HttpOnly + }; + + if (setCookieHeaderValueLocalVar.Expires.HasValue) + cookieLocalVar.Expires = setCookieHeaderValueLocalVar.Expires.Value.UtcDateTime; + + if (setCookieHeaderValueLocalVar.Path.HasValue) + cookieLocalVar.Path = setCookieHeaderValueLocalVar.Path.Value; + + if (setCookieHeaderValueLocalVar.Domain.HasValue) + cookieLocalVar.Domain = setCookieHeaderValueLocalVar.Domain.Value; + + CookieContainer.Value.Add(new Uri($"{uriBuilderLocalVar.Scheme}://{uriBuilderLocalVar.Host}"), cookieLocalVar); + } + } + } + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorLoginUserDefaultImplementation(e, "/user/login", uriBuilderLocalVar.Path, password, username); + Events.ExecuteOnErrorLoginUser(e); + throw; + } + } + + /// + /// The + /// + public partial class LoginUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ILoginUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public LoginUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public string Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out string result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterLogoutUserDefaultImplementation(ILogoutUserApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterLogoutUser(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterLogoutUser(ref bool suppressDefaultLog, ILogoutUserApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorLogoutUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorLogoutUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorLogoutUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Logs out current logged in user session + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task LogoutUserOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await LogoutUserAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + LogoutUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); + + AfterLogoutUserDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnLogoutUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorLogoutUserDefaultImplementation(e, "/user/logout", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorLogoutUser(e); + throw; + } + } + + /// + /// The + /// + public partial class LogoutUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ILogoutUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public LogoutUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdateUser(User user, ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUpdateUser(User user, string username) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterUpdateUserDefaultImplementation(IUpdateUserApiResponse apiResponseLocalVar, User user, string username) + { + bool suppressDefaultLog = false; + AfterUpdateUser(ref suppressDefaultLog, apiResponseLocalVar, user, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterUpdateUser(ref bool suppressDefaultLog, IUpdateUserApiResponse apiResponseLocalVar, User user, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorUpdateUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdateUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdateUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user, string username); + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateUserOrDefaultAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdateUserAsync(user, username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateUserAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdateUser(user, username); + + FormatUpdateUser(user, ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdateUserDefaultImplementation(apiResponseLocalVar, user, username); + + Events.ExecuteOnUpdateUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdateUserDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, user, username); + Events.ExecuteOnErrorUpdateUser(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdateUserApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdateUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdateUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..fdd11dd19c9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiException.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs new file mode 100644 index 000000000000..4ae15cda355e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -0,0 +1,52 @@ +// + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an apiKey. + /// + public class ApiKeyToken : TokenBase + { + private string _raw; + + /// + /// The header that this token will be used with. + /// + public ClientUtils.ApiKeyHeader Header { get; } + + /// + /// Constructs an ApiKeyToken object. + /// + /// + /// + /// + /// + public ApiKeyToken(string value, ClientUtils.ApiKeyHeader header, string prefix = "Bearer ", TimeSpan? timeout = null) : base(timeout) + { + Header = header; + _raw = $"{ prefix }{ value }"; + } + + /// + /// Places the token in the header. + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request) + { + request.Headers.Add(ClientUtils.ApiKeyHeaderToString(Header), _raw); + } + + /// + /// Places the token in the query. + /// + /// + /// + /// + public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage request, UriBuilder uriBuilder, System.Collections.Specialized.NameValueCollection parseQueryString) + { + parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..794b3601c853 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,210 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface ICustomHttpStatusCode599 : IApiResponse + { + /// + /// Deserializes the response if the response is CustomHttpStatusCode599 + /// + /// + TType CustomHttpStatusCode599(); + + /// + /// Returns true if the response is CustomHttpStatusCode599 and the deserialized response is not null + /// + /// + /// + bool TryCustomHttpStatusCode599([NotNullWhen(true)]out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk([NotNullWhen(true)]out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IDefault : IApiResponse + { + /// + /// Deserializes the response if the response is Default + /// + /// + TType Default(); + + /// + /// Returns true if the response is Default and the deserialized response is not null + /// + /// + /// + bool TryDefault([NotNullWhen(true)]out TType result); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs new file mode 100644 index 000000000000..bde0562e1940 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BasicToken.cs @@ -0,0 +1,42 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from a username and password. + /// + public class BasicToken : TokenBase + { + private string _username; + + private string _password; + + /// + /// Constructs a BasicToken object. + /// + /// + /// + /// + public BasicToken(string username, string password, TimeSpan? timeout = null) : base(timeout) + { + _username = username; + + _password = password; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs new file mode 100644 index 000000000000..4337ac9a7736 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/BearerToken.cs @@ -0,0 +1,37 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from a token from a bearer token. + /// + public class BearerToken : TokenBase + { + private string _raw; + + /// + /// Constructs a BearerToken object. + /// + /// + /// + public BearerToken(string value, TimeSpan? timeout = null) : base(timeout) + { + _raw = value; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..32d03988e2d1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,422 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using KellermanSoftware.CompareNetObjects; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// An instance of CompareLogic. + /// + public static CompareLogic compareLogic; + + /// + /// Static constructor to initialise compareLogic. + /// + static ClientUtils() + { + ComparisonConfig comparisonConfig = new(); + comparisonConfig.UseHashCodeIdentifier = true; + compareLogic = new(comparisonConfig); + } + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// An enum of headers + /// + public enum ApiKeyHeader + { + /// + /// The api-key header + /// + Api_key, + /// + /// The api_key_query header + /// + Api_key_query + } + + /// + /// Converte an ApiKeyHeader to a string + /// + /// + /// + /// + public static string ApiKeyHeaderToString(ApiKeyHeader value) + { + return value switch + { + ApiKeyHeader.Api_key => "api-key", + ApiKeyHeader.Api_key_query => "api_key_query", + _ => throw new System.ComponentModel.InvalidEnumArgumentException(nameof(value), (int)value, typeof(ApiKeyHeader)), + }; + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string ParameterToString(object obj, string format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ChildCatAllOfPetType childCatAllOfPetType) + return ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCatAllOfPetType); + if (obj is EnumArraysArrayEnumInner enumArraysArrayEnumInner) + return EnumArraysArrayEnumInnerValueConverter.ToJsonValue(enumArraysArrayEnumInner); + if (obj is EnumArraysJustSymbol enumArraysJustSymbol) + return EnumArraysJustSymbolValueConverter.ToJsonValue(enumArraysJustSymbol); + if (obj is EnumClass enumClass) + return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTestEnumInteger enumTestEnumInteger) + return EnumTestEnumIntegerValueConverter.ToJsonValue(enumTestEnumInteger).ToString(); + if (obj is EnumTestEnumIntegerOnly enumTestEnumIntegerOnly) + return EnumTestEnumIntegerOnlyValueConverter.ToJsonValue(enumTestEnumIntegerOnly).ToString(); + if (obj is EnumTestEnumString enumTestEnumString) + return EnumTestEnumStringValueConverter.ToJsonValue(enumTestEnumString); + if (obj is FindPetsByStatusStatusParameterInner findPetsByStatusStatusParameterInner) + return FindPetsByStatusStatusParameterInnerValueConverter.ToJsonValue(findPetsByStatusStatusParameterInner); + if (obj is MapTestMapOfEnumStringValue mapTestMapOfEnumStringValue) + return MapTestMapOfEnumStringValueValueConverter.ToJsonValue(mapTestMapOfEnumStringValue); + if (obj is OrderStatus orderStatus) + return OrderStatusValueConverter.ToJsonValue(orderStatus); + if (obj is OuterEnum outerEnum) + return OuterEnumValueConverter.ToJsonValue(outerEnum); + if (obj is OuterEnumDefaultValue outerEnumDefaultValue) + return OuterEnumDefaultValueValueConverter.ToJsonValue(outerEnumDefaultValue); + if (obj is OuterEnumInteger outerEnumInteger) + return OuterEnumIntegerValueConverter.ToJsonValue(outerEnumInteger).ToString(); + if (obj is OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) + return OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(outerEnumIntegerDefaultValue).ToString(); + if (obj is OuterEnumTest outerEnumTest) + return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); + if (obj is PetStatus petStatus) + return PetStatusValueConverter.ToJsonValue(petStatus); + if (obj is RequiredClassRequiredNotnullableEnumInteger requiredClassRequiredNotnullableEnumInteger) + return RequiredClassRequiredNotnullableEnumIntegerValueConverter.ToJsonValue(requiredClassRequiredNotnullableEnumInteger).ToString(); + if (obj is RequiredClassRequiredNotnullableEnumIntegerOnly requiredClassRequiredNotnullableEnumIntegerOnly) + return RequiredClassRequiredNotnullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnly).ToString(); + if (obj is RequiredClassRequiredNotnullableEnumString requiredClassRequiredNotnullableEnumString) + return RequiredClassRequiredNotnullableEnumStringValueConverter.ToJsonValue(requiredClassRequiredNotnullableEnumString); + if (obj is RequiredClassRequiredNullableEnumInteger requiredClassRequiredNullableEnumInteger) + return RequiredClassRequiredNullableEnumIntegerValueConverter.ToJsonValue(requiredClassRequiredNullableEnumInteger).ToString(); + if (obj is RequiredClassRequiredNullableEnumIntegerOnly requiredClassRequiredNullableEnumIntegerOnly) + return RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClassRequiredNullableEnumIntegerOnly).ToString(); + if (obj is RequiredClassRequiredNullableEnumString requiredClassRequiredNullableEnumString) + return RequiredClassRequiredNullableEnumStringValueConverter.ToJsonValue(requiredClassRequiredNullableEnumString); + if (obj is TestEnumParametersEnumHeaderStringParameter testEnumParametersEnumHeaderStringParameter) + return TestEnumParametersEnumHeaderStringParameterValueConverter.ToJsonValue(testEnumParametersEnumHeaderStringParameter); + if (obj is TestEnumParametersEnumQueryDoubleParameter testEnumParametersEnumQueryDoubleParameter) + return TestEnumParametersEnumQueryDoubleParameterValueConverter.ToJsonValue(testEnumParametersEnumQueryDoubleParameter).ToString(); + if (obj is TestEnumParametersEnumQueryIntegerParameter testEnumParametersEnumQueryIntegerParameter) + return TestEnumParametersEnumQueryIntegerParameterValueConverter.ToJsonValue(testEnumParametersEnumQueryIntegerParameter).ToString(); + if (obj is TestEnumParametersRequestEnumFormString testEnumParametersRequestEnumFormString) + return TestEnumParametersRequestEnumFormStringValueConverter.ToJsonValue(testEnumParametersRequestEnumFormString); + if (obj is TestEnumParametersRequestEnumFormStringArrayInner testEnumParametersRequestEnumFormStringArrayInner) + return TestEnumParametersRequestEnumFormStringArrayInnerValueConverter.ToJsonValue(testEnumParametersRequestEnumFormStringArrayInner); + if (obj is ZebraType zebraType) + return ZebraTypeValueConverter.ToJsonValue(zebraType); + if (obj is ZeroBasedEnum zeroBasedEnum) + return ZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnum); + if (obj is ZeroBasedEnumClassZeroBasedEnum zeroBasedEnumClassZeroBasedEnum) + return ZeroBasedEnumClassZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnumClassZeroBasedEnum); + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// 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) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://petstore.swagger.io:80/v2"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = "/v2"; + + /// + /// The host of the API + /// + public const string HOST = "petstore.swagger.io"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..da94287dab88 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,18 @@ +// + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..11b100056516 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..92ef8f6c92bf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..623f3c18353c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,75 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..43730a86b868 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..f711f9f3c7ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..f35ca51d2d2a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,297 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new ActivityJsonConverter()); + _jsonOptions.Converters.Add(new ActivityOutputElementRepresentationJsonConverter()); + _jsonOptions.Converters.Add(new AdditionalPropertiesClassJsonConverter()); + _jsonOptions.Converters.Add(new AnimalJsonConverter()); + _jsonOptions.Converters.Add(new ApiResponseJsonConverter()); + _jsonOptions.Converters.Add(new AppleJsonConverter()); + _jsonOptions.Converters.Add(new AppleReqJsonConverter()); + _jsonOptions.Converters.Add(new ArrayOfArrayOfNumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ArrayOfNumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ArrayTestJsonConverter()); + _jsonOptions.Converters.Add(new BananaJsonConverter()); + _jsonOptions.Converters.Add(new BananaReqJsonConverter()); + _jsonOptions.Converters.Add(new BasquePigJsonConverter()); + _jsonOptions.Converters.Add(new CapitalizationJsonConverter()); + _jsonOptions.Converters.Add(new CatJsonConverter()); + _jsonOptions.Converters.Add(new CategoryJsonConverter()); + _jsonOptions.Converters.Add(new ChildCatJsonConverter()); + _jsonOptions.Converters.Add(new ChildCatAllOfPetTypeJsonConverter()); + _jsonOptions.Converters.Add(new ChildCatAllOfPetTypeNullableJsonConverter()); + _jsonOptions.Converters.Add(new ClassModelJsonConverter()); + _jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new DanishPigJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyClassJsonConverter()); + _jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter()); + _jsonOptions.Converters.Add(new DogJsonConverter()); + _jsonOptions.Converters.Add(new DrawingJsonConverter()); + _jsonOptions.Converters.Add(new EnumArraysJsonConverter()); + _jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerJsonConverter()); + _jsonOptions.Converters.Add(new EnumArraysArrayEnumInnerNullableJsonConverter()); + _jsonOptions.Converters.Add(new EnumArraysJustSymbolJsonConverter()); + _jsonOptions.Converters.Add(new EnumArraysJustSymbolNullableJsonConverter()); + _jsonOptions.Converters.Add(new EnumClassJsonConverter()); + _jsonOptions.Converters.Add(new EnumClassNullableJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestEnumIntegerJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestEnumIntegerNullableJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestEnumIntegerOnlyJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestEnumIntegerOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestEnumStringJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestEnumStringNullableJsonConverter()); + _jsonOptions.Converters.Add(new EquilateralTriangleJsonConverter()); + _jsonOptions.Converters.Add(new FileJsonConverter()); + _jsonOptions.Converters.Add(new FileSchemaTestClassJsonConverter()); + _jsonOptions.Converters.Add(new FindPetsByStatusStatusParameterInnerJsonConverter()); + _jsonOptions.Converters.Add(new FindPetsByStatusStatusParameterInnerNullableJsonConverter()); + _jsonOptions.Converters.Add(new FooJsonConverter()); + _jsonOptions.Converters.Add(new FooGetDefaultResponseJsonConverter()); + _jsonOptions.Converters.Add(new FormatTestJsonConverter()); + _jsonOptions.Converters.Add(new FruitJsonConverter()); + _jsonOptions.Converters.Add(new FruitReqJsonConverter()); + _jsonOptions.Converters.Add(new GmFruitJsonConverter()); + _jsonOptions.Converters.Add(new GrandparentAnimalJsonConverter()); + _jsonOptions.Converters.Add(new HasOnlyReadOnlyJsonConverter()); + _jsonOptions.Converters.Add(new HealthCheckResultJsonConverter()); + _jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter()); + _jsonOptions.Converters.Add(new ListJsonConverter()); + _jsonOptions.Converters.Add(new LiteralStringClassJsonConverter()); + _jsonOptions.Converters.Add(new MammalJsonConverter()); + _jsonOptions.Converters.Add(new MapTestJsonConverter()); + _jsonOptions.Converters.Add(new MapTestMapOfEnumStringValueJsonConverter()); + _jsonOptions.Converters.Add(new MapTestMapOfEnumStringValueNullableJsonConverter()); + _jsonOptions.Converters.Add(new MixLogJsonConverter()); + _jsonOptions.Converters.Add(new MixedAnyOfJsonConverter()); + _jsonOptions.Converters.Add(new MixedAnyOfContentJsonConverter()); + _jsonOptions.Converters.Add(new MixedOneOfJsonConverter()); + _jsonOptions.Converters.Add(new MixedOneOfContentJsonConverter()); + _jsonOptions.Converters.Add(new MixedPropertiesAndAdditionalPropertiesClassJsonConverter()); + _jsonOptions.Converters.Add(new MixedSubIdJsonConverter()); + _jsonOptions.Converters.Add(new Model200ResponseJsonConverter()); + _jsonOptions.Converters.Add(new ModelClientJsonConverter()); + _jsonOptions.Converters.Add(new NameJsonConverter()); + _jsonOptions.Converters.Add(new NotificationtestGetElementsV1ResponseMPayloadJsonConverter()); + _jsonOptions.Converters.Add(new NullableClassJsonConverter()); + _jsonOptions.Converters.Add(new NullableGuidClassJsonConverter()); + _jsonOptions.Converters.Add(new NullableShapeJsonConverter()); + _jsonOptions.Converters.Add(new NumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ObjectWithDeprecatedFieldsJsonConverter()); + _jsonOptions.Converters.Add(new OneOfStringJsonConverter()); + _jsonOptions.Converters.Add(new OrderJsonConverter()); + _jsonOptions.Converters.Add(new OrderStatusJsonConverter()); + _jsonOptions.Converters.Add(new OrderStatusNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterCompositeJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumDefaultValueJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumDefaultValueNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerDefaultValueJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerDefaultValueNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumTestJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumTestNullableJsonConverter()); + _jsonOptions.Converters.Add(new ParentPetJsonConverter()); + _jsonOptions.Converters.Add(new PetJsonConverter()); + _jsonOptions.Converters.Add(new PetStatusJsonConverter()); + _jsonOptions.Converters.Add(new PetStatusNullableJsonConverter()); + _jsonOptions.Converters.Add(new PigJsonConverter()); + _jsonOptions.Converters.Add(new PolymorphicPropertyJsonConverter()); + _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNotnullableEnumIntegerJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNotnullableEnumIntegerNullableJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNotnullableEnumIntegerOnlyJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNotnullableEnumIntegerOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNotnullableEnumStringJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNotnullableEnumStringNullableJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumIntegerJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumIntegerNullableJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumIntegerOnlyJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumIntegerOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumStringJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassRequiredNullableEnumStringNullableJsonConverter()); + _jsonOptions.Converters.Add(new ReturnJsonConverter()); + _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); + _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); + _jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter()); + _jsonOptions.Converters.Add(new ShapeJsonConverter()); + _jsonOptions.Converters.Add(new ShapeInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new ShapeOrNullJsonConverter()); + _jsonOptions.Converters.Add(new SimpleQuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new SpecialModelNameJsonConverter()); + _jsonOptions.Converters.Add(new TagJsonConverter()); + _jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter()); + _jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersEnumHeaderStringParameterNullableJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersEnumQueryDoubleParameterJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersEnumQueryDoubleParameterNullableJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersEnumQueryIntegerParameterJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersEnumQueryIntegerParameterNullableJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringNullableJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringArrayInnerJsonConverter()); + _jsonOptions.Converters.Add(new TestEnumParametersRequestEnumFormStringArrayInnerNullableJsonConverter()); + _jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter()); + _jsonOptions.Converters.Add(new TriangleJsonConverter()); + _jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new UserJsonConverter()); + _jsonOptions.Converters.Add(new WhaleJsonConverter()); + _jsonOptions.Converters.Add(new ZebraJsonConverter()); + _jsonOptions.Converters.Add(new ZebraTypeJsonConverter()); + _jsonOptions.Converters.Add(new ZebraTypeNullableJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumClassZeroBasedEnumJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumClassZeroBasedEnumNullableJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action client = null, Action builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs new file mode 100644 index 000000000000..7616d3209c20 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -0,0 +1,677 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Cryptography; +using System.Text; +using System.Web; + +namespace Org.OpenAPITools.Client +{ + /// + /// Class for HttpSigning auth related parameter and methods + /// + public class HttpSigningConfiguration + { + /// + /// Create an instance + /// + public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString keyPassPhrase, List httpSigningHeader, HashAlgorithmName hashAlgorithm, string signingAlgorithm, int signatureValidityPeriod) + { + KeyId = keyId; + KeyFilePath = keyFilePath; + KeyPassPhrase = keyPassPhrase; + HttpSigningHeader = httpSigningHeader; + HashAlgorithm = hashAlgorithm; + SigningAlgorithm = signingAlgorithm; + SignatureValidityPeriod = signatureValidityPeriod; + } + + /// + ///Gets the Api keyId + /// + public string KeyId { get; set; } + + /// + /// Gets the Key file path + /// + public string KeyFilePath { get; set; } + + /// + /// Gets the key pass phrase for password protected key + /// + public SecureString KeyPassPhrase { get; set; } + + /// + /// Gets the HTTP signing header + /// + public List HttpSigningHeader { get; set; } + + /// + /// Gets the hash algorithm sha256 or sha512 + /// + public HashAlgorithmName HashAlgorithm { get; set; } = HashAlgorithmName.SHA256; + + /// + /// Gets the signing algorithm + /// + public string SigningAlgorithm { get; set; } + + /// + /// Gets the Signature validity period in seconds + /// + public int SignatureValidityPeriod { get; set; } + + private enum PrivateKeyType + { + None = 0, + RSA = 1, + ECDSA = 2, + } + + /// + /// Gets the Headers for HttpSigning + /// + /// + /// + /// + internal Dictionary GetHttpSignedHeader(global::System.Net.Http.HttpRequestMessage request, string requestBody, System.Threading.CancellationToken cancellationToken = default) + { + if (request.RequestUri == null) + throw new NullReferenceException("The request URI was null"); + + const string HEADER_REQUEST_TARGET = "(request-target)"; + + // The time when the HTTP signature expires. The API server should reject HTTP requests that have expired. + const string HEADER_EXPIRES = "(expires)"; + + //The 'Date' header. + const string HEADER_DATE = "Date"; + + //The 'Host' header. + const string HEADER_HOST = "Host"; + + //The time when the HTTP signature was generated. + const string HEADER_CREATED = "(created)"; + + //When the 'Digest' header is included in the HTTP signature, the client automatically + //computes the digest of the HTTP request body, per RFC 3230. + const string HEADER_DIGEST = "Digest"; + + //The 'Authorization' header is automatically generated by the client. It includes + //the list of signed headers and a base64-encoded signature. + const string HEADER_AUTHORIZATION = "Authorization"; + + //Hash table to store singed headers + var HttpSignedRequestHeader = new Dictionary(); + + var httpSignatureHeader = new Dictionary(); + + if (HttpSigningHeader.Count == 0) + HttpSigningHeader.Add("(created)"); + + var dateTime = DateTime.Now; + string digest = String.Empty; + + if (HashAlgorithm == HashAlgorithmName.SHA256) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + digest = string.Format("SHA-256={0}", Convert.ToBase64String(bodyDigest)); + } + else if (HashAlgorithm == HashAlgorithmName.SHA512) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + digest = string.Format("SHA-512={0}", Convert.ToBase64String(bodyDigest)); + } + else + throw new Exception(string.Format("{0} not supported", HashAlgorithm)); + + foreach (var header in HttpSigningHeader) + if (header.Equals(HEADER_REQUEST_TARGET)) + httpSignatureHeader.Add(header.ToLower(), request.RequestUri.ToString()); + else if (header.Equals(HEADER_EXPIRES)) + { + var expireDateTime = dateTime.AddSeconds(SignatureValidityPeriod); + httpSignatureHeader.Add(header.ToLower(), GetUnixTime(expireDateTime).ToString()); + } + else if (header.Equals(HEADER_DATE)) + { + var utcDateTime = dateTime.ToString("r").ToString(); + httpSignatureHeader.Add(header.ToLower(), utcDateTime); + HttpSignedRequestHeader.Add(HEADER_DATE, utcDateTime); + } + else if (header.Equals(HEADER_HOST)) + { + httpSignatureHeader.Add(header.ToLower(), request.RequestUri.ToString()); + HttpSignedRequestHeader.Add(HEADER_HOST, request.RequestUri.ToString()); + } + else if (header.Equals(HEADER_CREATED)) + httpSignatureHeader.Add(header.ToLower(), GetUnixTime(dateTime).ToString()); + else if (header.Equals(HEADER_DIGEST)) + { + HttpSignedRequestHeader.Add(HEADER_DIGEST, digest); + httpSignatureHeader.Add(header.ToLower(), digest); + } + else + { + bool isHeaderFound = false; + foreach (var item in request.Headers) + { + if (string.Equals(item.Key, header, StringComparison.OrdinalIgnoreCase)) + { + httpSignatureHeader.Add(header.ToLower(), item.Value.ToString()); + isHeaderFound = true; + break; + } + } + + if (!isHeaderFound) + throw new Exception(string.Format("Cannot sign HTTP request.Request does not contain the {0} header.",header)); + } + + var headersKeysString = String.Join(" ", httpSignatureHeader.Keys); + var headerValuesList = new List(); + + foreach (var keyVal in httpSignatureHeader) + headerValuesList.Add(string.Format("{0}: {1}", keyVal.Key, keyVal.Value)); + + //Concatenate headers value separated by new line + var headerValuesString = string.Join("\n", headerValuesList); + var signatureStringHash = GetStringHash(HashAlgorithm, headerValuesString); + string headerSignatureStr = null; + var keyType = GetKeyType(KeyFilePath); + + if (keyType == PrivateKeyType.RSA) + headerSignatureStr = GetRSASignature(signatureStringHash); + + else if (keyType == PrivateKeyType.ECDSA) + headerSignatureStr = GetECDSASignature(signatureStringHash); + + var cryptographicScheme = "hs2019"; + var authorizationHeaderValue = string.Format("Signature keyId=\"{0}\",algorithm=\"{1}\"", + KeyId, cryptographicScheme); + + if (httpSignatureHeader.ContainsKey(HEADER_CREATED)) + authorizationHeaderValue += string.Format(",created={0}", httpSignatureHeader[HEADER_CREATED]); + + if (httpSignatureHeader.ContainsKey(HEADER_EXPIRES)) + authorizationHeaderValue += string.Format(",expires={0}", httpSignatureHeader[HEADER_EXPIRES]); + + authorizationHeaderValue += string.Format(",headers=\"{0}\",signature=\"{1}\"", headersKeysString, headerSignatureStr); + + HttpSignedRequestHeader.Add(HEADER_AUTHORIZATION, authorizationHeaderValue); + + return HttpSignedRequestHeader; + } + + private byte[] GetStringHash(HashAlgorithmName hashAlgorithmName, string stringToBeHashed) + { + HashAlgorithm hashAlgorithm = null; + + if (hashAlgorithmName == HashAlgorithmName.SHA1) + hashAlgorithm = SHA1.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA256) + hashAlgorithm = SHA256.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA512) + hashAlgorithm = SHA512.Create(); + + if (hashAlgorithmName == HashAlgorithmName.MD5) + hashAlgorithm = MD5.Create(); + + if (hashAlgorithm == null) + throw new NullReferenceException($"{ nameof(hashAlgorithm) } was null."); + + byte[] bytes = Encoding.UTF8.GetBytes(stringToBeHashed); + byte[] stringHash = hashAlgorithm.ComputeHash(bytes); + return stringHash; + } + + private int GetUnixTime(DateTime date2) + { + DateTime date1 = new DateTime(1970, 01, 01); + TimeSpan timeSpan = date2 - date1; + return (int)timeSpan.TotalSeconds; + } + + private string GetRSASignature(byte[] stringToSign) + { + if (KeyPassPhrase == null) + throw new NullReferenceException($"{ nameof(KeyPassPhrase) } was null."); + + RSA rsa = GetRSAProviderFromPemFile(KeyFilePath, KeyPassPhrase); + + if (rsa == null) + return string.Empty; + else if (SigningAlgorithm == "RSASSA-PSS") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pss); + return Convert.ToBase64String(signedbytes); + } + else if (SigningAlgorithm == "PKCS1-v15") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pkcs1); + return Convert.ToBase64String(signedbytes); + } + + return string.Empty; + } + + /// + /// Gets the ECDSA signature + /// + /// + /// + private string GetECDSASignature(byte[] dataToSign) + { + if (!File.Exists(KeyFilePath)) + throw new Exception("key file path does not exist."); + + var ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + var ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var keyStr = File.ReadAllText(KeyFilePath); + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + + string ptrToStringUni = Marshal.PtrToStringUni(unmanagedString) ?? throw new NullReferenceException(); + + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(ptrToStringUni), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var signedBytes = ecdsa.SignHash(dataToSign); + var derBytes = ConvertToECDSAANS1Format(signedBytes); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; + } + + private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) + { + var derBytes = new List(); + byte derLength = 68; //default length for ECDSA code signing bit 0x44 + byte rbytesLength = 32; //R length 0x20 + byte sbytesLength = 32; //S length 0x20 + var rBytes = new List(); + var sBytes = new List(); + for (int i = 0; i < 32; i++) + rBytes.Add(signedBytes[i]); + + for (int i = 32; i < 64; i++) + sBytes.Add(signedBytes[i]); + + if (rBytes[0] > 0x7F) + { + derLength++; + rbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(rBytes); + rBytes.Clear(); + rBytes.Add(0x00); + rBytes.AddRange(tempBytes); + } + + if (sBytes[0] > 0x7F) + { + derLength++; + sbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(sBytes); + sBytes.Clear(); + sBytes.Add(0x00); + sBytes.AddRange(tempBytes); + + } + + derBytes.Add(48); //start of the sequence 0x30 + derBytes.Add(derLength); //total length r length, type and r bytes + + derBytes.Add(2); //tag for integer + derBytes.Add(rbytesLength); //length of r + derBytes.AddRange(rBytes); + + derBytes.Add(2); //tag for integer + derBytes.Add(sbytesLength); //length of s + derBytes.AddRange(sBytes); + return derBytes.ToArray(); + } + + private RSACryptoServiceProvider GetRSAProviderFromPemFile(String pemfile, SecureString keyPassPhrase = null) + { + const String pempubheader = "-----BEGIN PUBLIC KEY-----"; + const String pempubfooter = "-----END PUBLIC KEY-----"; + bool isPrivateKeyFile = true; + byte[] pemkey = null; + + if (!File.Exists(pemfile)) + throw new Exception("private key file does not exist."); + + string pemstr = File.ReadAllText(pemfile).Trim(); + + if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) + isPrivateKeyFile = false; + + if (isPrivateKeyFile) + { + pemkey = ConvertPrivateKeyToBytes(pemstr, keyPassPhrase); + + if (pemkey == null) + return null; + + return DecodeRSAPrivateKey(pemkey); + } + return null; + } + + private byte[] ConvertPrivateKeyToBytes(String instr, SecureString keyPassPhrase = null) + { + const String pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; + const String pemprivfooter = "-----END RSA PRIVATE KEY-----"; + String pemstr = instr.Trim(); + byte[] binkey; + + if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) + return null; + + StringBuilder sb = new StringBuilder(pemstr); + sb.Replace(pemprivheader, ""); + sb.Replace(pemprivfooter, ""); + String pvkstr = sb.ToString().Trim(); + + try + { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key + binkey = Convert.FromBase64String(pvkstr); + return binkey; + } + catch (global::System.FormatException) + { + StringReader str = new StringReader(pvkstr); + + //-------- read PEM encryption info. lines and extract salt ----- + if (!str.ReadLine().StartsWith("Proc-Type: 4,ENCRYPTED")) // TODO: what do we do here if ReadLine is null? + return null; + + String saltline = str.ReadLine(); // TODO: what do we do here if ReadLine is null? + if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) + return null; + + String saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); + byte[] salt = new byte[saltstr.Length / 2]; + for (int i = 0; i < salt.Length; i++) + salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); + + if (!(str.ReadLine() == "")) + return null; + + //------ remaining b64 data is encrypted RSA key ---- + String encryptedstr = str.ReadToEnd(); + + try + { //should have b64 encrypted RSA key now + binkey = Convert.FromBase64String(encryptedstr); + } + catch (global::System.FormatException) + { //data is not in base64 format + return null; + } + + // TODO: what do we do here if keyPassPhrase is null? + byte[] deskey = GetEncryptedKey(salt, keyPassPhrase, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes + if (deskey == null) + return null; + + //------ Decrypt the encrypted 3des-encrypted RSA private key ------ + byte[] rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV + + return rsakey; + } + } + + private RSACryptoServiceProvider DecodeRSAPrivateKey(byte[] privkey) + { + byte[] MODULUS, E, D, P, Q, DP, DQ, IQ; + + // --------- Set up stream to decode the asn.1 encoded RSA private key ------ + MemoryStream mem = new MemoryStream(privkey); + BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading + byte bt = 0; + ushort twobytes = 0; + int elems = 0; + try + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + binr.ReadByte(); //advance 1 byte + else if (twobytes == 0x8230) + binr.ReadInt16(); //advance 2 bytes + else + return null; + + twobytes = binr.ReadUInt16(); + if (twobytes != 0x0102) //version number + return null; + + bt = binr.ReadByte(); + if (bt != 0x00) + return null; + + //------ all private key components are Integer sequences ---- + elems = GetIntegerSize(binr); + MODULUS = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + E = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + D = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + P = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + Q = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + IQ = binr.ReadBytes(elems); + + // ------- create RSACryptoServiceProvider instance and initialize with public key ----- + RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); + RSAParameters RSAparams = new RSAParameters(); + RSAparams.Modulus = MODULUS; + RSAparams.Exponent = E; + RSAparams.D = D; + RSAparams.P = P; + RSAparams.Q = Q; + RSAparams.DP = DP; + RSAparams.DQ = DQ; + RSAparams.InverseQ = IQ; + RSA.ImportParameters(RSAparams); + return RSA; + } + catch (Exception) + { + return null; + } + finally + { + binr.Close(); + } + } + + private int GetIntegerSize(BinaryReader binr) + { + byte bt = 0; + byte lowbyte = 0x00; + byte highbyte = 0x00; + int count = 0; + bt = binr.ReadByte(); + if (bt != 0x02) //expect integer + return 0; + + bt = binr.ReadByte(); + + if (bt == 0x81) + count = binr.ReadByte(); // data size in next byte + else if (bt == 0x82) + { + highbyte = binr.ReadByte(); // data size in next 2 bytes + lowbyte = binr.ReadByte(); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; + count = BitConverter.ToInt32(modint, 0); + } + else + count = bt; // we already have the data size + + while (binr.ReadByte() == 0x00) + //remove high order zeros in data + count -= 1; + + binr.BaseStream.Seek(-1, SeekOrigin.Current); + + //last ReadByte wasn't a removed zero, so back up a byte + return count; + } + + private byte[] GetEncryptedKey(byte[] salt, SecureString secpswd, int count, int miter) + { + IntPtr unmanagedPswd = IntPtr.Zero; + int HASHLENGTH = 16; //MD5 bytes + byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store concatenated Mi hashed results + + byte[] psbytes = new byte[secpswd.Length]; + unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); + Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); + Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); + + // --- concatenate salt and pswd bytes into fixed data array --- + byte[] data00 = new byte[psbytes.Length + salt.Length]; + Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes + Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes + + // ---- do multi-hashing and concatenate results D1, D2 ... into keymaterial bytes ---- + MD5 md5 = MD5.Create(); + byte[] result = null; + byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget + + for (int j = 0; j < miter; j++) + { + // ---- Now hash consecutively for count times ------ + if (j == 0) + result = data00; //initialize + else + { + Array.Copy(result, hashtarget, result.Length); // TODO: what do we do if result is null here? + Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); + result = hashtarget; + } + + for (int i = 0; i < count; i++) + result = md5.ComputeHash(result); + + Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //concatenate to keymaterial + } + byte[] deskey = new byte[24]; + Array.Copy(keymaterial, deskey, deskey.Length); + + Array.Clear(psbytes, 0, psbytes.Length); + Array.Clear(data00, 0, data00.Length); + Array.Clear(result, 0, result.Length); // TODO: what do we do if result is null here? + Array.Clear(hashtarget, 0, hashtarget.Length); + Array.Clear(keymaterial, 0, keymaterial.Length); + return deskey; + } + + private byte[] DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) + { + MemoryStream memst = new MemoryStream(); + TripleDES alg = TripleDES.Create(); + alg.Key = desKey; + alg.IV = IV; + try + { + CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); + cs.Write(cipherData, 0, cipherData.Length); + cs.Close(); + } + catch (Exception) + { + return null; + } + byte[] decryptedData = memst.ToArray(); + return decryptedData; + } + + /// + /// Detect the key type from the pem file. + /// + /// key file path in pem format + /// + private PrivateKeyType GetKeyType(string keyFilePath) + { + if (!File.Exists(keyFilePath)) + throw new Exception("Key file path does not exist."); + + var ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY"; + var ecPrivateKeyFooter = "END EC PRIVATE KEY"; + var rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY"; + var rsaPrivateFooter = "END RSA PRIVATE KEY"; + //var pkcs8Header = "BEGIN PRIVATE KEY"; + //var pkcs8Footer = "END PRIVATE KEY"; + var keyType = PrivateKeyType.None; + var key = File.ReadAllLines(keyFilePath); + + if (key[0].ToString().Contains(rsaPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(rsaPrivateFooter)) + keyType = PrivateKeyType.RSA; + else if (key[0].ToString().Contains(ecPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + keyType = PrivateKeyType.ECDSA; + + else if (key[0].ToString().Contains(ecPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + { + /* this type of key can hold many type different types of private key, but here due lack of pem header + Considering this as EC key + */ + //TODO :- update the key based on oid + keyType = PrivateKeyType.ECDSA; + } + else + throw new Exception("Either the key is invalid or key is not supported"); + + return keyType; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs new file mode 100644 index 000000000000..387f7a8829e8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -0,0 +1,41 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an HttpSigningConfiguration + /// + public class HttpSignatureToken : TokenBase + { + private HttpSigningConfiguration _configuration; + + /// + /// Constructs an HttpSignatureToken object. + /// + /// + /// + public HttpSignatureToken(HttpSigningConfiguration configuration, TimeSpan? timeout = null) : base(timeout) + { + _configuration = configuration; + } + + /// + /// Places the token in the header. + /// + /// + /// + /// + public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string requestBody, CancellationToken cancellationToken = default) + { + var signedHeaders = _configuration.GetHttpSignedHeader(request, requestBody, cancellationToken); + + foreach (var signedHeader in signedHeaders) + request.Headers.Add(signedHeader.Key, signedHeader.Value); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..8fd6b68578f0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,25 @@ +// + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs new file mode 100644 index 000000000000..209e913db3e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -0,0 +1,37 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed with OAuth. + /// + public class OAuthToken : TokenBase + { + private string _raw; + + /// + /// Consturcts an OAuthToken object. + /// + /// + /// + public OAuthToken(string value, TimeSpan? timeout = null) : base(timeout) + { + _raw = value; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..8cf79a713b74 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/Option.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..eb894eec8416 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + if (container is TokenContainer apiKeyTokenContainer) + { + string[] headers = apiKeyTokenContainer.Tokens.Select(t => ClientUtils.ApiKeyHeaderToString(t.Header)).Distinct().ToArray(); + + foreach (string header in headers) + { + BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(header, Channel.CreateBounded(options)); + } + } + else + { + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + } + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..ec843104cafe --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,69 @@ +// + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..1e81bcd48886 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,35 @@ +// + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..36d7dad03e23 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,42 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..dce7b971eaac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,41 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..40eeffc96765 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..fdda03b9a5fd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs new file mode 100644 index 000000000000..f9d2680b0ad5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Activity.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// test map of maps + /// + public partial class Activity : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// activityOutputs + [JsonConstructor] + public Activity(Option>> activityOutputs = default) + { + ActivityOutputsOption = activityOutputs; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ActivityOutputs + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> ActivityOutputsOption { get; private set; } + + /// + /// Gets or Sets ActivityOutputs + /// + [JsonPropertyName("activity_outputs")] + public Dictionary> ActivityOutputs { get { return this.ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Activity {\n"); + sb.Append(" ActivityOutputs: ").Append(ActivityOutputs).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActivityJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>> activityOutputs = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "activity_outputs": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (activityOutputs.IsSet && activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); + + return new Activity(activityOutputs); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, activity, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) + { + if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + + if (activity.ActivityOutputsOption.IsSet) + { + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs new file mode 100644 index 000000000000..f5bcaf712030 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -0,0 +1,207 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ActivityOutputElementRepresentation + /// + public partial class ActivityOutputElementRepresentation : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// prop1 + /// prop2 + [JsonConstructor] + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) + { + Prop1Option = prop1; + Prop2Option = prop2; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Prop1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Prop1Option { get; private set; } + + /// + /// Gets or Sets Prop1 + /// + [JsonPropertyName("prop1")] + public string Prop1 { get { return this.Prop1Option; } set { this.Prop1Option = new(value); } } + + /// + /// Used to track the state of Prop2 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Prop2Option { get; private set; } + + /// + /// Gets or Sets Prop2 + /// + [JsonPropertyName("prop2")] + public Object Prop2 { get { return this.Prop2Option; } set { this.Prop2Option = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ActivityOutputElementRepresentation {\n"); + sb.Append(" Prop1: ").Append(Prop1).Append("\n"); + sb.Append(" Prop2: ").Append(Prop2).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActivityOutputElementRepresentationJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option prop1 = default; + Option prop2 = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "prop1": + prop1 = new Option(utf8JsonReader.GetString()); + break; + case "prop2": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (prop1.IsSet && prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); + + if (prop2.IsSet && prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); + + return new ActivityOutputElementRepresentation(prop1, prop2); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, activityOutputElementRepresentation, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) + { + if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop1Option.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); + + if (activityOutputElementRepresentation.Prop2Option.IsSet) + { + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs new file mode 100644 index 000000000000..8d4153d53022 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -0,0 +1,400 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// AdditionalPropertiesClass + /// + public partial class AdditionalPropertiesClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// anytype1 + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + /// mapOfMapProperty + /// mapProperty + /// mapWithUndeclaredPropertiesAnytype1 + /// mapWithUndeclaredPropertiesAnytype2 + /// mapWithUndeclaredPropertiesAnytype3 + /// mapWithUndeclaredPropertiesString + [JsonConstructor] + public AdditionalPropertiesClass(Option anytype1 = default, Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default) + { + Anytype1Option = anytype1; + EmptyMapOption = emptyMap; + MapOfMapPropertyOption = mapOfMapProperty; + MapPropertyOption = mapProperty; + MapWithUndeclaredPropertiesAnytype1Option = mapWithUndeclaredPropertiesAnytype1; + MapWithUndeclaredPropertiesAnytype2Option = mapWithUndeclaredPropertiesAnytype2; + MapWithUndeclaredPropertiesAnytype3Option = mapWithUndeclaredPropertiesAnytype3; + MapWithUndeclaredPropertiesStringOption = mapWithUndeclaredPropertiesString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Anytype1Option { get; private set; } + + /// + /// Gets or Sets Anytype1 + /// + [JsonPropertyName("anytype_1")] + public Object Anytype1 { get { return this.Anytype1Option; } set { this.Anytype1Option = new(value); } } + + /// + /// Used to track the state of EmptyMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EmptyMapOption { get; private set; } + + /// + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + /// + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + [JsonPropertyName("empty_map")] + public Object EmptyMap { get { return this.EmptyMapOption; } set { this.EmptyMapOption = new(value); } } + + /// + /// Used to track the state of MapOfMapProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> MapOfMapPropertyOption { get; private set; } + + /// + /// Gets or Sets MapOfMapProperty + /// + [JsonPropertyName("map_of_map_property")] + public Dictionary> MapOfMapProperty { get { return this.MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } + + /// + /// Used to track the state of MapProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapPropertyOption { get; private set; } + + /// + /// Gets or Sets MapProperty + /// + [JsonPropertyName("map_property")] + public Dictionary MapProperty { get { return this.MapPropertyOption; } set { this.MapPropertyOption = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_1")] + public Object MapWithUndeclaredPropertiesAnytype1 { get { return this.MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_2")] + public Object MapWithUndeclaredPropertiesAnytype2 { get { return this.MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_3")] + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get { return this.MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesString + /// + [JsonPropertyName("map_with_undeclared_properties_string")] + public Dictionary MapWithUndeclaredPropertiesString { get { return this.MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AdditionalPropertiesClass {\n"); + sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); + sb.Append(" EmptyMap: ").Append(EmptyMap).Append("\n"); + sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); + sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype1: ").Append(MapWithUndeclaredPropertiesAnytype1).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AdditionalPropertiesClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option anytype1 = default; + Option emptyMap = default; + Option>> mapOfMapProperty = default; + Option> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option> mapWithUndeclaredPropertiesAnytype3 = default; + Option> mapWithUndeclaredPropertiesString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "anytype_1": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "empty_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_of_map_property": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_property": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_with_undeclared_properties_anytype_1": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_with_undeclared_properties_anytype_2": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_with_undeclared_properties_anytype_3": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_with_undeclared_properties_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (emptyMap.IsSet && emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapOfMapProperty.IsSet && mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapProperty.IsSet && mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype1.IsSet && mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype2.IsSet && mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype3.IsSet && mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); + + return new AdditionalPropertiesClass(anytype1, emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, additionalPropertiesClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.Anytype1Option.IsSet) + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); + if (additionalPropertiesClass.EmptyMapOption.IsSet) + { + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) + { + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapPropertyOption.IsSet) + { + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Animal.cs new file mode 100644 index 000000000000..d0b07da62cc8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Animal.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Animal + /// + public partial class Animal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// color (default to "red") + [JsonConstructor] + public Animal(Option color = default) + { + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public string ClassName { get; } = "Animal"; + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Animal {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AnimalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option color = default; + + string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "className"); + + if (discriminator != null && discriminator.Equals("Cat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + if (discriminator != null && discriminator.Equals("Dog")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Animal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); + + return new Animal(color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) + { + if (animal is Cat cat){ + JsonSerializer.Serialize(writer, cat, jsonSerializerOptions); + return; + } + + if (animal is Dog dog){ + JsonSerializer.Serialize(writer, dog, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, animal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) + { + if (animal.ColorOption.IsSet && animal.Color == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + + writer.WriteString("className", animal.ClassName); + + if (animal.ColorOption.IsSet) + writer.WriteString("color", animal.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs new file mode 100644 index 000000000000..3b185247e442 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -0,0 +1,230 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ApiResponse + /// + public partial class ApiResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// code + /// message + /// type + [JsonConstructor] + public ApiResponse(Option code = default, Option message = default, Option type = default) + { + CodeOption = code; + MessageOption = message; + TypeOption = type; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Code + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CodeOption { get; private set; } + + /// + /// Gets or Sets Code + /// + [JsonPropertyName("code")] + public int? Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } } + + /// + /// Used to track the state of Message + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MessageOption { get; private set; } + + /// + /// Gets or Sets Message + /// + [JsonPropertyName("message")] + public string Message { get { return this.MessageOption; } set { this.MessageOption = new(value); } } + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TypeOption { get; private set; } + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public string Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ApiResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option code = default; + Option message = default; + Option type = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "code": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + code = new Option(utf8JsonReader.GetInt32()); + break; + case "message": + message = new Option(utf8JsonReader.GetString()); + break; + case "type": + type = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (code.IsSet && code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); + + if (message.IsSet && message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); + + return new ApiResponse(code, message, type); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apiResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + + if (apiResponse.CodeOption.IsSet) + writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); + + if (apiResponse.MessageOption.IsSet) + writer.WriteString("message", apiResponse.Message); + + if (apiResponse.TypeOption.IsSet) + writer.WriteString("type", apiResponse.Type); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Apple.cs new file mode 100644 index 000000000000..26fbe0516849 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Apple.cs @@ -0,0 +1,262 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Apple + /// + public partial class Apple : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// colorCode + /// cultivar + /// origin + [JsonConstructor] + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) + { + ColorCodeOption = colorCode; + CultivarOption = cultivar; + OriginOption = origin; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ColorCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorCodeOption { get; private set; } + + /// + /// Gets or Sets ColorCode + /// + [JsonPropertyName("color_code")] + public string ColorCode { get { return this.ColorCodeOption; } set { this.ColorCodeOption = new(value); } } + + /// + /// Used to track the state of Cultivar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CultivarOption { get; private set; } + + /// + /// Gets or Sets Cultivar + /// + [JsonPropertyName("cultivar")] + public string Cultivar { get { return this.CultivarOption; } set { this.CultivarOption = new(value); } } + + /// + /// Used to track the state of Origin + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OriginOption { get; private set; } + + /// + /// Gets or Sets Origin + /// + [JsonPropertyName("origin")] + public string Origin { get { return this.OriginOption; } set { this.OriginOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Apple {\n"); + sb.Append(" ColorCode: ").Append(ColorCode).Append("\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); + sb.Append(" Origin: ").Append(Origin).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.ColorCodeOption.Value != null) { + // ColorCode (string) pattern + Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); + + if (this.ColorCodeOption.Value != null &&!regexColorCode.Match(this.ColorCodeOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); + } + } + + if (this.CultivarOption.Value != null) { + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + + if (this.CultivarOption.Value != null &&!regexCultivar.Match(this.CultivarOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } + } + + if (this.OriginOption.Value != null) { + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.OriginOption.Value != null &&!regexOrigin.Match(this.OriginOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } + } + + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option colorCode = default; + Option cultivar = default; + Option origin = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color_code": + colorCode = new Option(utf8JsonReader.GetString()); + break; + case "cultivar": + cultivar = new Option(utf8JsonReader.GetString()); + break; + case "origin": + origin = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (colorCode.IsSet && colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); + + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); + + if (origin.IsSet && origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); + + return new Apple(colorCode, cultivar, origin); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apple, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.CultivarOption.IsSet && apple.Cultivar == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.OriginOption.IsSet && apple.Origin == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + + if (apple.ColorCodeOption.IsSet) + writer.WriteString("color_code", apple.ColorCode); + + if (apple.CultivarOption.IsSet) + writer.WriteString("cultivar", apple.Cultivar); + + if (apple.OriginOption.IsSet) + writer.WriteString("origin", apple.Origin); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs new file mode 100644 index 000000000000..942640761b26 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/AppleReq.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// AppleReq + /// + public partial class AppleReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// cultivar + /// mealy + [JsonConstructor] + public AppleReq(string cultivar, Option mealy = default) + { + Cultivar = cultivar; + MealyOption = mealy; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Cultivar + /// + [JsonPropertyName("cultivar")] + public string Cultivar { get; set; } + + /// + /// Used to track the state of Mealy + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MealyOption { get; private set; } + + /// + /// Gets or Sets Mealy + /// + [JsonPropertyName("mealy")] + public bool? Mealy { get { return this.MealyOption; } set { this.MealyOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AppleReq {\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); + sb.Append(" Mealy: ").Append(Mealy).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option cultivar = default; + Option mealy = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "cultivar": + cultivar = new Option(utf8JsonReader.GetString()); + break; + case "mealy": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mealy = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!cultivar.IsSet) + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); + + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); + + if (mealy.IsSet && mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + return new AppleReq(cultivar.Value, mealy); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, appleReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) + { + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + + writer.WriteString("cultivar", appleReq.Cultivar); + + if (appleReq.MealyOption.IsSet) + writer.WriteBoolean("mealy", appleReq.MealyOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs new file mode 100644 index 000000000000..debcff217b93 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfArrayOfNumberOnly + /// + public partial class ArrayOfArrayOfNumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayArrayNumber + [JsonConstructor] + public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) + { + ArrayArrayNumberOption = arrayArrayNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayArrayNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> ArrayArrayNumberOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayNumber + /// + [JsonPropertyName("ArrayArrayNumber")] + public List> ArrayArrayNumber { get { return this.ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayOfArrayOfNumberOnly {\n"); + sb.Append(" ArrayArrayNumber: ").Append(ArrayArrayNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayOfArrayOfNumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>> arrayArrayNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ArrayArrayNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); + + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayOfArrayOfNumberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) + { + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs new file mode 100644 index 000000000000..ded293438a45 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfNumberOnly + /// + public partial class ArrayOfNumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayNumber + [JsonConstructor] + public ArrayOfNumberOnly(Option> arrayNumber = default) + { + ArrayNumberOption = arrayNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayNumberOption { get; private set; } + + /// + /// Gets or Sets ArrayNumber + /// + [JsonPropertyName("ArrayNumber")] + public List ArrayNumber { get { return this.ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayOfNumberOnly {\n"); + sb.Append(" ArrayNumber: ").Append(ArrayNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayOfNumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> arrayNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ArrayNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (arrayNumber.IsSet && arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); + + return new ArrayOfNumberOnly(arrayNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayOfNumberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) + { + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs new file mode 100644 index 000000000000..ee7b94f08bd3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -0,0 +1,242 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayTest + /// + public partial class ArrayTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayArrayOfInteger + /// arrayArrayOfModel + /// arrayOfString + [JsonConstructor] + public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) + { + ArrayArrayOfIntegerOption = arrayArrayOfInteger; + ArrayArrayOfModelOption = arrayArrayOfModel; + ArrayOfStringOption = arrayOfString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayArrayOfInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> ArrayArrayOfIntegerOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayOfInteger + /// + [JsonPropertyName("array_array_of_integer")] + public List> ArrayArrayOfInteger { get { return this.ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } + + /// + /// Used to track the state of ArrayArrayOfModel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> ArrayArrayOfModelOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayOfModel + /// + [JsonPropertyName("array_array_of_model")] + public List> ArrayArrayOfModel { get { return this.ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } + + /// + /// Used to track the state of ArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets ArrayOfString + /// + [JsonPropertyName("array_of_string")] + public List ArrayOfString { get { return this.ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayTest {\n"); + sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n"); + sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append("\n"); + sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>> arrayArrayOfInteger = default; + Option>> arrayArrayOfModel = default; + Option> arrayOfString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_array_of_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_array_of_model": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (arrayArrayOfInteger.IsSet && arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); + + if (arrayArrayOfModel.IsSet && arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); + + if (arrayOfString.IsSet && arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); + + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) + { + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + } + if (arrayTest.ArrayArrayOfModelOption.IsSet) + { + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + } + if (arrayTest.ArrayOfStringOption.IsSet) + { + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs new file mode 100644 index 000000000000..476a1c25352b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Banana.cs @@ -0,0 +1,172 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Banana + /// + public partial class Banana : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lengthCm + [JsonConstructor] + public Banana(Option lengthCm = default) + { + LengthCmOption = lengthCm; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of LengthCm + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option LengthCmOption { get; private set; } + + /// + /// Gets or Sets LengthCm + /// + [JsonPropertyName("lengthCm")] + public decimal? LengthCm { get { return this.LengthCmOption; } set { this.LengthCmOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Banana {\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option lengthCm = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lengthCm": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + lengthCm = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); + + return new Banana(lengthCm); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, banana, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + if (banana.LengthCmOption.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs new file mode 100644 index 000000000000..a3a0a15428b4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BananaReq.cs @@ -0,0 +1,187 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// BananaReq + /// + public partial class BananaReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lengthCm + /// sweet + [JsonConstructor] + public BananaReq(decimal lengthCm, Option sweet = default) + { + LengthCm = lengthCm; + SweetOption = sweet; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets LengthCm + /// + [JsonPropertyName("lengthCm")] + public decimal LengthCm { get; set; } + + /// + /// Used to track the state of Sweet + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SweetOption { get; private set; } + + /// + /// Gets or Sets Sweet + /// + [JsonPropertyName("sweet")] + public bool? Sweet { get { return this.SweetOption; } set { this.SweetOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BananaReq {\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); + sb.Append(" Sweet: ").Append(Sweet).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option lengthCm = default; + Option sweet = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lengthCm": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + lengthCm = new Option(utf8JsonReader.GetDecimal()); + break; + case "sweet": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + sweet = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!lengthCm.IsSet) + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); + + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); + + if (sweet.IsSet && sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + return new BananaReq(lengthCm.Value.Value, sweet); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, bananaReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + + if (bananaReq.SweetOption.IsSet) + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs new file mode 100644 index 000000000000..9938d89e008d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/BasquePig.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// BasquePig + /// + public partial class BasquePig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + [JsonConstructor] + public BasquePig(string className) + { + ClassName = className; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BasquePig {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BasquePigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + return new BasquePig(className.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, basquePig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) + { + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + + writer.WriteString("className", basquePig.ClassName); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs new file mode 100644 index 000000000000..8308df3a0912 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Capitalization.cs @@ -0,0 +1,320 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Capitalization + /// + public partial class Capitalization : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Name of the pet + /// capitalCamel + /// capitalSnake + /// sCAETHFlowPoints + /// smallCamel + /// smallSnake + [JsonConstructor] + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) + { + ATT_NAMEOption = aTTNAME; + CapitalCamelOption = capitalCamel; + CapitalSnakeOption = capitalSnake; + SCAETHFlowPointsOption = sCAETHFlowPoints; + SmallCamelOption = smallCamel; + SmallSnakeOption = smallSnake; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ATT_NAME + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ATT_NAMEOption { get; private set; } + + /// + /// Name of the pet + /// + /// Name of the pet + [JsonPropertyName("ATT_NAME")] + public string ATT_NAME { get { return this.ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } + + /// + /// Used to track the state of CapitalCamel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CapitalCamelOption { get; private set; } + + /// + /// Gets or Sets CapitalCamel + /// + [JsonPropertyName("CapitalCamel")] + public string CapitalCamel { get { return this.CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } + + /// + /// Used to track the state of CapitalSnake + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CapitalSnakeOption { get; private set; } + + /// + /// Gets or Sets CapitalSnake + /// + [JsonPropertyName("Capital_Snake")] + public string CapitalSnake { get { return this.CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } + + /// + /// Used to track the state of SCAETHFlowPoints + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SCAETHFlowPointsOption { get; private set; } + + /// + /// Gets or Sets SCAETHFlowPoints + /// + [JsonPropertyName("SCA_ETH_Flow_Points")] + public string SCAETHFlowPoints { get { return this.SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } + + /// + /// Used to track the state of SmallCamel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SmallCamelOption { get; private set; } + + /// + /// Gets or Sets SmallCamel + /// + [JsonPropertyName("smallCamel")] + public string SmallCamel { get { return this.SmallCamelOption; } set { this.SmallCamelOption = new(value); } } + + /// + /// Used to track the state of SmallSnake + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SmallSnakeOption { get; private set; } + + /// + /// Gets or Sets SmallSnake + /// + [JsonPropertyName("small_Snake")] + public string SmallSnake { get { return this.SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Capitalization {\n"); + sb.Append(" ATT_NAME: ").Append(ATT_NAME).Append("\n"); + sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n"); + sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n"); + sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n"); + sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n"); + sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class CapitalizationJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ATT_NAME": + aTTNAME = new Option(utf8JsonReader.GetString()); + break; + case "CapitalCamel": + capitalCamel = new Option(utf8JsonReader.GetString()); + break; + case "Capital_Snake": + capitalSnake = new Option(utf8JsonReader.GetString()); + break; + case "SCA_ETH_Flow_Points": + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()); + break; + case "smallCamel": + smallCamel = new Option(utf8JsonReader.GetString()); + break; + case "small_Snake": + smallSnake = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (aTTNAME.IsSet && aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); + + if (capitalCamel.IsSet && capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); + + if (capitalSnake.IsSet && capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); + + if (sCAETHFlowPoints.IsSet && sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); + + if (smallCamel.IsSet && smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); + + if (smallSnake.IsSet && smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); + + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, capitalization, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) + { + if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + + if (capitalization.ATT_NAMEOption.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); + + if (capitalization.CapitalCamelOption.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); + + if (capitalization.CapitalSnakeOption.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); + + if (capitalization.SCAETHFlowPointsOption.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); + + if (capitalization.SmallCamelOption.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel); + + if (capitalization.SmallSnakeOption.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs new file mode 100644 index 000000000000..6a1dfe1d90b6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Cat.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Cat + /// + public partial class Cat : Animal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// color (default to "red") + /// declawed + [JsonConstructor] + public Cat(Option color = default, Option declawed = default) : base(color) + { + DeclawedOption = declawed; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string ClassName { get; } = "Cat"; + + /// + /// Used to track the state of Declawed + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeclawedOption { get; private set; } + + /// + /// Gets or Sets Declawed + /// + [JsonPropertyName("declawed")] + public bool? Declawed { get { return this.DeclawedOption; } set { this.DeclawedOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Cat {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class CatJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option color = default; + Option declawed = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + case "declawed": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + declawed = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Cat.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); + + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + + return new Cat(color, declawed); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, cat, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) + { + if (cat.ColorOption.IsSet && cat.Color == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + + writer.WriteString("className", cat.ClassName); + + if (cat.ColorOption.IsSet) + writer.WriteString("color", cat.Color); + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs new file mode 100644 index 000000000000..9bd387646078 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Category.cs @@ -0,0 +1,196 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Category + /// + public partial class Category : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + /// name (default to "default-name") + [JsonConstructor] + public Category(Option id = default, string name = @"default-name") + { + IdOption = id; + Name = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Category {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class CategoryJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!name.IsSet) + throw new ArgumentException("Property is required for class Category.", nameof(name)); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + return new Category(id, name.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, category, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) + { + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + + if (category.IdOption.IsSet) + writer.WriteNumber("id", category.IdOption.Value.Value); + + writer.WriteString("name", category.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs new file mode 100644 index 000000000000..d920c4ded985 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCat.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ChildCat + /// + public partial class ChildCat : ParentPet, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public ChildCat(Option name = default) : base() + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new ChildCatAllOfPetType PetType { get; } = (ChildCatAllOfPetType)Enum.Parse(typeof(ChildCatAllOfPetType), "ChildCat"); + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ChildCat {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class ChildCatJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option petType = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pet_type": + string petTypeRawValue = utf8JsonReader.GetString(); + if (petTypeRawValue != null) + petType = new Option(ChildCatAllOfPetTypeValueConverter.FromStringOrDefault(petTypeRawValue)); + break; + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ChildCat.", nameof(petType)); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); + + return new ChildCat(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, childCat, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) + { + if (childCat.NameOption.IsSet && childCat.Name == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + + writer.WriteString("pet_type", ChildCatAllOfPetTypeValueConverter.ToJsonValue(childCat.PetType)); + + if (childCat.NameOption.IsSet) + writer.WriteString("name", childCat.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs new file mode 100644 index 000000000000..9e8bc253fdb2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ChildCatAllOfPetType.cs @@ -0,0 +1,160 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines ChildCat_allOf_pet_type + /// + public enum ChildCatAllOfPetType + { + /// + /// Enum ChildCat for value: ChildCat + /// + ChildCat = 1 + } + + /// + /// Converts to and from the JSON value + /// + public static class ChildCatAllOfPetTypeValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static ChildCatAllOfPetType FromString(string value) + { + if (value.Equals("ChildCat")) + return ChildCatAllOfPetType.ChildCat; + + throw new NotImplementedException($"Could not convert value to type ChildCatAllOfPetType: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static ChildCatAllOfPetType? FromStringOrDefault(string value) + { + if (value.Equals("ChildCat")) + return ChildCatAllOfPetType.ChildCat; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(ChildCatAllOfPetType value) + { + if (value == ChildCatAllOfPetType.ChildCat) + return "ChildCat"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class ChildCatAllOfPetTypeJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override ChildCatAllOfPetType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ChildCatAllOfPetType? result = rawValue == null + ? null + : ChildCatAllOfPetTypeValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the ChildCatAllOfPetType to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ChildCatAllOfPetType childCatAllOfPetType, JsonSerializerOptions options) + { + writer.WriteStringValue(childCatAllOfPetType.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class ChildCatAllOfPetTypeNullableJsonConverter : JsonConverter + { + /// + /// Returns a ChildCatAllOfPetType from the Json object + /// + /// + /// + /// + /// + public override ChildCatAllOfPetType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ChildCatAllOfPetType? result = rawValue == null + ? null + : ChildCatAllOfPetTypeValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ChildCatAllOfPetType? childCatAllOfPetType, JsonSerializerOptions options) + { + writer.WriteStringValue(childCatAllOfPetType?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs new file mode 100644 index 000000000000..9730e5b1185e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ClassModel.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model with \"_class\" property + /// + public partial class ClassModel : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// class + [JsonConstructor] + public ClassModel(Option @class = default) + { + ClassOption = @class; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Class + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ClassOption { get; private set; } + + /// + /// Gets or Sets Class + /// + [JsonPropertyName("_class")] + public string Class { get { return this.ClassOption; } set { this.ClassOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ClassModel {\n"); + sb.Append(" Class: ").Append(Class).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ClassModelJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClass = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "_class": + varClass = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); + + return new ClassModel(varClass); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, classModel, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) + { + if (classModel.ClassOption.IsSet && classModel.Class == null) + throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + + if (classModel.ClassOption.IsSet) + writer.WriteString("_class", classModel.Class); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs new file mode 100644 index 000000000000..3023a45610e4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ComplexQuadrilateral + /// + public partial class ComplexQuadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + /// shapeType + [JsonConstructor] + public ComplexQuadrilateral(string quadrilateralType, string shapeType) + { + QuadrilateralType = quadrilateralType; + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ComplexQuadrilateral {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ComplexQuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()); + break; + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + return new ComplexQuadrilateral(quadrilateralType.Value, shapeType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, complexQuadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs new file mode 100644 index 000000000000..14b2ed3b153f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DanishPig.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DanishPig + /// + public partial class DanishPig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + [JsonConstructor] + public DanishPig(string className) + { + ClassName = className; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DanishPig {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DanishPigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + return new DanishPig(className.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, danishPig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) + { + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + + writer.WriteString("className", danishPig.ClassName); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs new file mode 100644 index 000000000000..1f3a3bb8a98e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DateOnlyClass + /// + public partial class DateOnlyClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// dateOnlyProperty + [JsonConstructor] + public DateOnlyClass(Option dateOnlyProperty = default) + { + DateOnlyPropertyOption = dateOnlyProperty; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of DateOnlyProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateOnlyPropertyOption { get; private set; } + + /// + /// Gets or Sets DateOnlyProperty + /// + /* Fri Jul 21 00:00:00 UTC 2017 */ + [JsonPropertyName("dateOnlyProperty")] + public DateOnly? DateOnlyProperty { get { return this.DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DateOnlyClass {\n"); + sb.Append(" DateOnlyProperty: ").Append(DateOnlyProperty).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DateOnlyClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateOnlyProperty + /// + public static string DateOnlyPropertyFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option dateOnlyProperty = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "dateOnlyProperty": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); + + return new DateOnlyClass(dateOnlyProperty); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, dateOnlyClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) + { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs new file mode 100644 index 000000000000..65695f863abb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DeprecatedObject + /// + public partial class DeprecatedObject : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public DeprecatedObject(Option name = default) + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeprecatedObject {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DeprecatedObjectJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); + + return new DeprecatedObject(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, deprecatedObject, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) + { + if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + + if (deprecatedObject.NameOption.IsSet) + writer.WriteString("name", deprecatedObject.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Dog.cs new file mode 100644 index 000000000000..2ab1ca19d2d0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Dog.cs @@ -0,0 +1,191 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Dog + /// + public partial class Dog : Animal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// breed + /// color (default to "red") + [JsonConstructor] + public Dog(Option breed = default, Option color = default) : base(color) + { + BreedOption = breed; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string ClassName { get; } = "Dog"; + + /// + /// Used to track the state of Breed + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BreedOption { get; private set; } + + /// + /// Gets or Sets Breed + /// + [JsonPropertyName("breed")] + public string Breed { get { return this.BreedOption; } set { this.BreedOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Dog {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class DogJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option breed = default; + Option color = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()); + break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Dog.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + + if (breed.IsSet && breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); + + return new Dog(breed, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, dog, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) + { + if (dog.BreedOption.IsSet && dog.Breed == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.ColorOption.IsSet && dog.Color == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + + writer.WriteString("className", dog.ClassName); + + if (dog.BreedOption.IsSet) + writer.WriteString("breed", dog.Breed); + + if (dog.ColorOption.IsSet) + writer.WriteString("color", dog.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs new file mode 100644 index 000000000000..72e59c9baf44 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Drawing.cs @@ -0,0 +1,268 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Drawing + /// + public partial class Drawing : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// mainShape + /// nullableShape + /// shapeOrNull + /// shapes + [JsonConstructor] + public Drawing(Option mainShape = default, Option nullableShape = default, Option shapeOrNull = default, Option> shapes = default) + { + MainShapeOption = mainShape; + NullableShapeOption = nullableShape; + ShapeOrNullOption = shapeOrNull; + ShapesOption = shapes; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of MainShape + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MainShapeOption { get; private set; } + + /// + /// Gets or Sets MainShape + /// + [JsonPropertyName("mainShape")] + public Shape MainShape { get { return this.MainShapeOption; } set { this.MainShapeOption = new(value); } } + + /// + /// Used to track the state of NullableShape + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NullableShapeOption { get; private set; } + + /// + /// Gets or Sets NullableShape + /// + [JsonPropertyName("nullableShape")] + public NullableShape NullableShape { get { return this.NullableShapeOption; } set { this.NullableShapeOption = new(value); } } + + /// + /// Used to track the state of ShapeOrNull + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShapeOrNullOption { get; private set; } + + /// + /// Gets or Sets ShapeOrNull + /// + [JsonPropertyName("shapeOrNull")] + public ShapeOrNull ShapeOrNull { get { return this.ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } + + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ShapesOption { get; private set; } + + /// + /// Gets or Sets Shapes + /// + [JsonPropertyName("shapes")] + public List Shapes { get { return this.ShapesOption; } set { this.ShapesOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Drawing {\n"); + sb.Append(" MainShape: ").Append(MainShape).Append("\n"); + sb.Append(" NullableShape: ").Append(NullableShape).Append("\n"); + sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n"); + sb.Append(" Shapes: ").Append(Shapes).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DrawingJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option mainShape = default; + Option nullableShape = default; + Option shapeOrNull = default; + Option> shapes = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "mainShape": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "nullableShape": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "shapeOrNull": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "shapes": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (mainShape.IsSet && mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); + + if (shapes.IsSet && shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); + + return new Drawing(mainShape, nullableShape, shapeOrNull, shapes); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, drawing, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) + { + if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.ShapesOption.IsSet && drawing.Shapes == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + + if (drawing.MainShapeOption.IsSet) + { + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + } + if (drawing.NullableShapeOption.IsSet) + if (drawing.NullableShapeOption.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNullOption.IsSet) + if (drawing.ShapeOrNullOption.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); + if (drawing.ShapesOption.IsSet) + { + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs new file mode 100644 index 000000000000..516c952c2071 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -0,0 +1,208 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumArrays + /// + public partial class EnumArrays : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayEnum + /// justSymbol + [JsonConstructor] + public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) + { + ArrayEnumOption = arrayEnum; + JustSymbolOption = justSymbol; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of JustSymbol + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option JustSymbolOption { get; private set; } + + /// + /// Gets or Sets JustSymbol + /// + [JsonPropertyName("just_symbol")] + public EnumArraysJustSymbol? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } + + /// + /// Used to track the state of ArrayEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayEnumOption { get; private set; } + + /// + /// Gets or Sets ArrayEnum + /// + [JsonPropertyName("array_enum")] + public List ArrayEnum { get { return this.ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EnumArrays {\n"); + sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EnumArraysJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> arrayEnum = default; + Option justSymbol = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_enum": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "just_symbol": + string justSymbolRawValue = utf8JsonReader.GetString(); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArraysJustSymbolValueConverter.FromStringOrDefault(justSymbolRawValue)); + break; + default: + break; + } + } + } + + if (arrayEnum.IsSet && arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); + + if (justSymbol.IsSet && justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); + + return new EnumArrays(arrayEnum, justSymbol); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, enumArrays, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) + { + if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + + if (enumArrays.ArrayEnumOption.IsSet) + { + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + } + if (enumArrays.JustSymbolOption.IsSet) + { + var justSymbolRawValue = EnumArraysJustSymbolValueConverter.ToJsonValue(enumArrays.JustSymbol.Value); + writer.WriteString("just_symbol", justSymbolRawValue); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs new file mode 100644 index 000000000000..c620b7197c40 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArraysArrayEnumInner.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines EnumArrays_array_enum_inner + /// + public enum EnumArraysArrayEnumInner + { + /// + /// Enum Fish for value: fish + /// + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + Crab = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class EnumArraysArrayEnumInnerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EnumArraysArrayEnumInner FromString(string value) + { + if (value.Equals("fish")) + return EnumArraysArrayEnumInner.Fish; + + if (value.Equals("crab")) + return EnumArraysArrayEnumInner.Crab; + + throw new NotImplementedException($"Could not convert value to type EnumArraysArrayEnumInner: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EnumArraysArrayEnumInner? FromStringOrDefault(string value) + { + if (value.Equals("fish")) + return EnumArraysArrayEnumInner.Fish; + + if (value.Equals("crab")) + return EnumArraysArrayEnumInner.Crab; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EnumArraysArrayEnumInner value) + { + if (value == EnumArraysArrayEnumInner.Fish) + return "fish"; + + if (value == EnumArraysArrayEnumInner.Crab) + return "crab"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EnumArraysArrayEnumInnerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EnumArraysArrayEnumInner Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumArraysArrayEnumInner? result = rawValue == null + ? null + : EnumArraysArrayEnumInnerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EnumArraysArrayEnumInner to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumArraysArrayEnumInner enumArraysArrayEnumInner, JsonSerializerOptions options) + { + writer.WriteStringValue(enumArraysArrayEnumInner.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EnumArraysArrayEnumInnerNullableJsonConverter : JsonConverter + { + /// + /// Returns a EnumArraysArrayEnumInner from the Json object + /// + /// + /// + /// + /// + public override EnumArraysArrayEnumInner? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumArraysArrayEnumInner? result = rawValue == null + ? null + : EnumArraysArrayEnumInnerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumArraysArrayEnumInner? enumArraysArrayEnumInner, JsonSerializerOptions options) + { + writer.WriteStringValue(enumArraysArrayEnumInner?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs new file mode 100644 index 000000000000..4a414d11d0db --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumArraysJustSymbol.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines EnumArrays_just_symbol + /// + public enum EnumArraysJustSymbol + { + /// + /// Enum GreaterThanOrEqualTo for value: >= + /// + GreaterThanOrEqualTo = 1, + + /// + /// Enum Dollar for value: $ + /// + Dollar = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class EnumArraysJustSymbolValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EnumArraysJustSymbol FromString(string value) + { + if (value.Equals(">=")) + return EnumArraysJustSymbol.GreaterThanOrEqualTo; + + if (value.Equals("$")) + return EnumArraysJustSymbol.Dollar; + + throw new NotImplementedException($"Could not convert value to type EnumArraysJustSymbol: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EnumArraysJustSymbol? FromStringOrDefault(string value) + { + if (value.Equals(">=")) + return EnumArraysJustSymbol.GreaterThanOrEqualTo; + + if (value.Equals("$")) + return EnumArraysJustSymbol.Dollar; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EnumArraysJustSymbol value) + { + if (value == EnumArraysJustSymbol.GreaterThanOrEqualTo) + return ">="; + + if (value == EnumArraysJustSymbol.Dollar) + return "$"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EnumArraysJustSymbolJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EnumArraysJustSymbol Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumArraysJustSymbol? result = rawValue == null + ? null + : EnumArraysJustSymbolValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EnumArraysJustSymbol to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumArraysJustSymbol enumArraysJustSymbol, JsonSerializerOptions options) + { + writer.WriteStringValue(enumArraysJustSymbol.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EnumArraysJustSymbolNullableJsonConverter : JsonConverter + { + /// + /// Returns a EnumArraysJustSymbol from the Json object + /// + /// + /// + /// + /// + public override EnumArraysJustSymbol? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumArraysJustSymbol? result = rawValue == null + ? null + : EnumArraysJustSymbolValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumArraysJustSymbol? enumArraysJustSymbol, JsonSerializerOptions options) + { + writer.WriteStringValue(enumArraysJustSymbol?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumClass.cs new file mode 100644 index 000000000000..b1aff0adf0d8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumClass.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines EnumClass + /// + public enum EnumClass + { + /// + /// Enum Abc for value: _abc + /// + Abc = 1, + + /// + /// Enum Efg for value: -efg + /// + Efg = 2, + + /// + /// Enum Xyz for value: (xyz) + /// + Xyz = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class EnumClassValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EnumClass FromString(string value) + { + if (value.Equals("_abc")) + return EnumClass.Abc; + + if (value.Equals("-efg")) + return EnumClass.Efg; + + if (value.Equals("(xyz)")) + return EnumClass.Xyz; + + throw new NotImplementedException($"Could not convert value to type EnumClass: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EnumClass? FromStringOrDefault(string value) + { + if (value.Equals("_abc")) + return EnumClass.Abc; + + if (value.Equals("-efg")) + return EnumClass.Efg; + + if (value.Equals("(xyz)")) + return EnumClass.Xyz; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EnumClass value) + { + if (value == EnumClass.Abc) + return "_abc"; + + if (value == EnumClass.Efg) + return "-efg"; + + if (value == EnumClass.Xyz) + return "(xyz)"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EnumClassJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EnumClass Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumClass? result = rawValue == null + ? null + : EnumClassValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EnumClass to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumClass enumClass, JsonSerializerOptions options) + { + writer.WriteStringValue(enumClass.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EnumClassNullableJsonConverter : JsonConverter + { + /// + /// Returns a EnumClass from the Json object + /// + /// + /// + /// + /// + public override EnumClass? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumClass? result = rawValue == null + ? null + : EnumClassValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumClass? enumClass, JsonSerializerOptions options) + { + writer.WriteStringValue(enumClass?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs new file mode 100644 index 000000000000..49ce4b0a6d6e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTest.cs @@ -0,0 +1,410 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumTest + /// + public partial class EnumTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// enumStringRequired + /// enumInteger + /// enumIntegerOnly + /// enumNumber + /// enumString + /// outerEnum + /// outerEnumDefaultValue + /// outerEnumInteger + /// outerEnumIntegerDefaultValue + [JsonConstructor] + public EnumTest(EnumTestEnumString enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnum = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default) + { + EnumStringRequired = enumStringRequired; + EnumIntegerOption = enumInteger; + EnumIntegerOnlyOption = enumIntegerOnly; + EnumNumberOption = enumNumber; + EnumStringOption = enumString; + OuterEnumOption = outerEnum; + OuterEnumDefaultValueOption = outerEnumDefaultValue; + OuterEnumIntegerOption = outerEnumInteger; + OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumTestEnumString EnumStringRequired { get; set; } + + /// + /// Used to track the state of EnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumIntegerOption { get; private set; } + + /// + /// Gets or Sets EnumInteger + /// + [JsonPropertyName("enum_integer")] + public EnumTestEnumInteger? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } + + /// + /// Used to track the state of EnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets EnumIntegerOnly + /// + [JsonPropertyName("enum_integer_only")] + public EnumTestEnumIntegerOnly? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } + + /// + /// Used to track the state of EnumNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumNumberOption { get; private set; } + + /// + /// Gets or Sets EnumNumber + /// + [JsonPropertyName("enum_number")] + public TestEnumParametersEnumQueryDoubleParameter? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } + + /// + /// Used to track the state of EnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumStringOption { get; private set; } + + /// + /// Gets or Sets EnumString + /// + [JsonPropertyName("enum_string")] + public EnumTestEnumString? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } + + /// + /// Used to track the state of OuterEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumOption { get; private set; } + + /// + /// Gets or Sets OuterEnum + /// + [JsonPropertyName("outerEnum")] + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } + + /// + /// Used to track the state of OuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets OuterEnumDefaultValue + /// + [JsonPropertyName("outerEnumDefaultValue")] + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } + + /// + /// Used to track the state of OuterEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets OuterEnumInteger + /// + [JsonPropertyName("outerEnumInteger")] + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } + + /// + /// Used to track the state of OuterEnumIntegerDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumIntegerDefaultValueOption { get; private set; } + + /// + /// Gets or Sets OuterEnumIntegerDefaultValue + /// + [JsonPropertyName("outerEnumIntegerDefaultValue")] + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); + sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); + sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); + sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); + sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); + sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); + sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); + sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EnumTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnum = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "enum_string_required": + string enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTestEnumStringValueConverter.FromStringOrDefault(enumStringRequiredRawValue)); + break; + case "enum_integer": + string enumIntegerRawValue = utf8JsonReader.GetString(); + if (enumIntegerRawValue != null) + enumInteger = new Option(EnumTestEnumIntegerValueConverter.FromStringOrDefault(enumIntegerRawValue)); + break; + case "enum_integer_only": + string enumIntegerOnlyRawValue = utf8JsonReader.GetString(); + if (enumIntegerOnlyRawValue != null) + enumIntegerOnly = new Option(EnumTestEnumIntegerOnlyValueConverter.FromStringOrDefault(enumIntegerOnlyRawValue)); + break; + case "enum_number": + string enumNumberRawValue = utf8JsonReader.GetString(); + if (enumNumberRawValue != null) + enumNumber = new Option(TestEnumParametersEnumQueryDoubleParameterValueConverter.FromStringOrDefault(enumNumberRawValue)); + break; + case "enum_string": + string enumStringRawValue = utf8JsonReader.GetString(); + if (enumStringRawValue != null) + enumString = new Option(EnumTestEnumStringValueConverter.FromStringOrDefault(enumStringRawValue)); + break; + case "outerEnum": + string outerEnumRawValue = utf8JsonReader.GetString(); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + break; + case "outerEnumDefaultValue": + string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); + break; + case "outerEnumInteger": + string outerEnumIntegerRawValue = utf8JsonReader.GetString(); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); + break; + case "outerEnumIntegerDefaultValue": + string outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); + break; + default: + break; + } + } + } + + if (!enumStringRequired.IsSet) + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); + + if (enumStringRequired.IsSet && enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); + + if (enumInteger.IsSet && enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); + + if (enumIntegerOnly.IsSet && enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); + + if (enumNumber.IsSet && enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + + if (enumString.IsSet && enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); + + if (outerEnumDefaultValue.IsSet && outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); + + if (outerEnumInteger.IsSet && outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); + + if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + + return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnum, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, enumTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) + { + var enumStringRequiredRawValue = EnumTestEnumStringValueConverter.ToJsonValue(enumTest.EnumStringRequired); + writer.WriteString("enum_string_required", enumStringRequiredRawValue); + + if (enumTest.EnumIntegerOption.IsSet) + { + var enumIntegerRawValue = EnumTestEnumIntegerValueConverter.ToJsonValue(enumTest.EnumInteger.Value); + writer.WriteNumber("enum_integer", enumIntegerRawValue); + } + if (enumTest.EnumIntegerOnlyOption.IsSet) + { + var enumIntegerOnlyRawValue = EnumTestEnumIntegerOnlyValueConverter.ToJsonValue(enumTest.EnumIntegerOnly.Value); + writer.WriteNumber("enum_integer_only", enumIntegerOnlyRawValue); + } + if (enumTest.EnumNumberOption.IsSet) + { + var enumNumberRawValue = TestEnumParametersEnumQueryDoubleParameterValueConverter.ToJsonValue(enumTest.EnumNumber.Value); + writer.WriteNumber("enum_number", enumNumberRawValue); + } + if (enumTest.EnumStringOption.IsSet) + { + var enumStringRawValue = EnumTestEnumStringValueConverter.ToJsonValue(enumTest.EnumString.Value); + writer.WriteString("enum_string", enumStringRawValue); + } + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); + writer.WriteString("outerEnum", outerEnumRawValue); + } + else + writer.WriteNull("outerEnum"); + if (enumTest.OuterEnumDefaultValueOption.IsSet) + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumIntegerOption.IsSet) + { + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) + { + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTestEnumInteger.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTestEnumInteger.cs new file mode 100644 index 000000000000..3a1302bf271e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTestEnumInteger.cs @@ -0,0 +1,168 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines Enum_Test_enum_integer + /// + public enum EnumTestEnumInteger + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Converts to and from the JSON value + /// + public static class EnumTestEnumIntegerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EnumTestEnumInteger FromString(string value) + { + if (value.Equals((1).ToString())) + return EnumTestEnumInteger.NUMBER_1; + + if (value.Equals((-1).ToString())) + return EnumTestEnumInteger.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type EnumTestEnumInteger: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EnumTestEnumInteger? FromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return EnumTestEnumInteger.NUMBER_1; + + if (value.Equals((-1).ToString())) + return EnumTestEnumInteger.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(EnumTestEnumInteger value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class EnumTestEnumIntegerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EnumTestEnumInteger Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumTestEnumInteger? result = rawValue == null + ? null + : EnumTestEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EnumTestEnumInteger to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTestEnumInteger enumTestEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(enumTestEnumInteger.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EnumTestEnumIntegerNullableJsonConverter : JsonConverter + { + /// + /// Returns a EnumTestEnumInteger from the Json object + /// + /// + /// + /// + /// + public override EnumTestEnumInteger? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumTestEnumInteger? result = rawValue == null + ? null + : EnumTestEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTestEnumInteger? enumTestEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(enumTestEnumInteger?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTestEnumIntegerOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTestEnumIntegerOnly.cs new file mode 100644 index 000000000000..cd0add6cf3ce --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTestEnumIntegerOnly.cs @@ -0,0 +1,168 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines Enum_Test_enum_integer_only + /// + public enum EnumTestEnumIntegerOnly + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Converts to and from the JSON value + /// + public static class EnumTestEnumIntegerOnlyValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EnumTestEnumIntegerOnly FromString(string value) + { + if (value.Equals((2).ToString())) + return EnumTestEnumIntegerOnly.NUMBER_2; + + if (value.Equals((-2).ToString())) + return EnumTestEnumIntegerOnly.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type EnumTestEnumIntegerOnly: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EnumTestEnumIntegerOnly? FromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return EnumTestEnumIntegerOnly.NUMBER_2; + + if (value.Equals((-2).ToString())) + return EnumTestEnumIntegerOnly.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(EnumTestEnumIntegerOnly value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class EnumTestEnumIntegerOnlyJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EnumTestEnumIntegerOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumTestEnumIntegerOnly? result = rawValue == null + ? null + : EnumTestEnumIntegerOnlyValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EnumTestEnumIntegerOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTestEnumIntegerOnly enumTestEnumIntegerOnly, JsonSerializerOptions options) + { + writer.WriteStringValue(enumTestEnumIntegerOnly.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EnumTestEnumIntegerOnlyNullableJsonConverter : JsonConverter + { + /// + /// Returns a EnumTestEnumIntegerOnly from the Json object + /// + /// + /// + /// + /// + public override EnumTestEnumIntegerOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumTestEnumIntegerOnly? result = rawValue == null + ? null + : EnumTestEnumIntegerOnlyValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTestEnumIntegerOnly? enumTestEnumIntegerOnly, JsonSerializerOptions options) + { + writer.WriteStringValue(enumTestEnumIntegerOnly?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTestEnumString.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTestEnumString.cs new file mode 100644 index 000000000000..adad28355b70 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EnumTestEnumString.cs @@ -0,0 +1,258 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines Enum_Test_enum_string + /// + public enum EnumTestEnumString + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Converts to and from the JSON value + /// + public static class EnumTestEnumStringValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EnumTestEnumString FromString(string value) + { + if (value.Equals("UPPER")) + return EnumTestEnumString.UPPER; + + if (value.Equals("lower")) + return EnumTestEnumString.Lower; + + if (value.Equals("")) + return EnumTestEnumString.Empty; + + if (value.Equals("Value\twith tab")) + return EnumTestEnumString.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumTestEnumString.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumTestEnumString.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumTestEnumString.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumTestEnumString.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumTestEnumString: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EnumTestEnumString? FromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumTestEnumString.UPPER; + + if (value.Equals("lower")) + return EnumTestEnumString.Lower; + + if (value.Equals("")) + return EnumTestEnumString.Empty; + + if (value.Equals("Value\twith tab")) + return EnumTestEnumString.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumTestEnumString.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumTestEnumString.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumTestEnumString.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumTestEnumString.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EnumTestEnumString value) + { + if (value == EnumTestEnumString.UPPER) + return "UPPER"; + + if (value == EnumTestEnumString.Lower) + return "lower"; + + if (value == EnumTestEnumString.Empty) + return ""; + + if (value == EnumTestEnumString.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumTestEnumString.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumTestEnumString.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumTestEnumString.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumTestEnumString.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EnumTestEnumStringJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EnumTestEnumString Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumTestEnumString? result = rawValue == null + ? null + : EnumTestEnumStringValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EnumTestEnumString to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTestEnumString enumTestEnumString, JsonSerializerOptions options) + { + writer.WriteStringValue(enumTestEnumString.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EnumTestEnumStringNullableJsonConverter : JsonConverter + { + /// + /// Returns a EnumTestEnumString from the Json object + /// + /// + /// + /// + /// + public override EnumTestEnumString? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumTestEnumString? result = rawValue == null + ? null + : EnumTestEnumStringValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTestEnumString? enumTestEnumString, JsonSerializerOptions options) + { + writer.WriteStringValue(enumTestEnumString?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs new file mode 100644 index 000000000000..d65c7740e5e8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EquilateralTriangle + /// + public partial class EquilateralTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public EquilateralTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EquilateralTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EquilateralTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + return new EquilateralTriangle(shapeType.Value, triangleType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, equilateralTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + + writer.WriteString("triangleType", equilateralTriangle.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 000000000000..3962bf2beee0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/File.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + public partial class File : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization + [JsonConstructor] + public File(Option sourceURI = default) + { + SourceURIOption = sourceURI; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of SourceURI + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SourceURIOption { get; private set; } + + /// + /// Test capitalization + /// + /// Test capitalization + [JsonPropertyName("sourceURI")] + public string SourceURI { get { return this.SourceURIOption; } set { this.SourceURIOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FileJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option sourceURI = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "sourceURI": + sourceURI = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (sourceURI.IsSet && sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); + + return new File(sourceURI); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, file, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) + { + if (file.SourceURIOption.IsSet && file.SourceURI == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + + if (file.SourceURIOption.IsSet) + writer.WriteString("sourceURI", file.SourceURI); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 000000000000..b4307b69a3b6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,210 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + public partial class FileSchemaTestClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// file + /// files + [JsonConstructor] + public FileSchemaTestClass(Option file = default, Option> files = default) + { + FileOption = file; + FilesOption = files; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of File + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FileOption { get; private set; } + + /// + /// Gets or Sets File + /// + [JsonPropertyName("file")] + public File File { get { return this.FileOption; } set { this.FileOption = new(value); } } + + /// + /// Used to track the state of Files + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> FilesOption { get; private set; } + + /// + /// Gets or Sets Files + /// + [JsonPropertyName("files")] + public List Files { get { return this.FilesOption; } set { this.FilesOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FileSchemaTestClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option file = default; + Option> files = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "file": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "files": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); + + if (files.IsSet && files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); + + return new FileSchemaTestClass(file, files); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fileSchemaTestClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) + { + if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FileOption.IsSet) + { + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + } + if (fileSchemaTestClass.FilesOption.IsSet) + { + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FindPetsByStatusStatusParameterInner.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FindPetsByStatusStatusParameterInner.cs new file mode 100644 index 000000000000..da357d93dd28 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FindPetsByStatusStatusParameterInner.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines findPetsByStatus_status_parameter_inner + /// + public enum FindPetsByStatusStatusParameterInner + { + /// + /// Enum Available for value: available + /// + Available = 1, + + /// + /// Enum Pending for value: pending + /// + Pending = 2, + + /// + /// Enum Sold for value: sold + /// + Sold = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class FindPetsByStatusStatusParameterInnerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static FindPetsByStatusStatusParameterInner FromString(string value) + { + if (value.Equals("available")) + return FindPetsByStatusStatusParameterInner.Available; + + if (value.Equals("pending")) + return FindPetsByStatusStatusParameterInner.Pending; + + if (value.Equals("sold")) + return FindPetsByStatusStatusParameterInner.Sold; + + throw new NotImplementedException($"Could not convert value to type FindPetsByStatusStatusParameterInner: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static FindPetsByStatusStatusParameterInner? FromStringOrDefault(string value) + { + if (value.Equals("available")) + return FindPetsByStatusStatusParameterInner.Available; + + if (value.Equals("pending")) + return FindPetsByStatusStatusParameterInner.Pending; + + if (value.Equals("sold")) + return FindPetsByStatusStatusParameterInner.Sold; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(FindPetsByStatusStatusParameterInner value) + { + if (value == FindPetsByStatusStatusParameterInner.Available) + return "available"; + + if (value == FindPetsByStatusStatusParameterInner.Pending) + return "pending"; + + if (value == FindPetsByStatusStatusParameterInner.Sold) + return "sold"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class FindPetsByStatusStatusParameterInnerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override FindPetsByStatusStatusParameterInner Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + FindPetsByStatusStatusParameterInner? result = rawValue == null + ? null + : FindPetsByStatusStatusParameterInnerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the FindPetsByStatusStatusParameterInner to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FindPetsByStatusStatusParameterInner findPetsByStatusStatusParameterInner, JsonSerializerOptions options) + { + writer.WriteStringValue(findPetsByStatusStatusParameterInner.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class FindPetsByStatusStatusParameterInnerNullableJsonConverter : JsonConverter + { + /// + /// Returns a FindPetsByStatusStatusParameterInner from the Json object + /// + /// + /// + /// + /// + public override FindPetsByStatusStatusParameterInner? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + FindPetsByStatusStatusParameterInner? result = rawValue == null + ? null + : FindPetsByStatusStatusParameterInnerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FindPetsByStatusStatusParameterInner? findPetsByStatusStatusParameterInner, JsonSerializerOptions options) + { + writer.WriteStringValue(findPetsByStatusStatusParameterInner?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Foo.cs new file mode 100644 index 000000000000..8c2e7c2aeb35 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Foo.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Foo + /// + public partial class Foo : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar (default to "bar") + [JsonConstructor] + public Foo(Option bar = default) + { + BarOption = bar; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; private set; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string Bar { get { return this.BarOption; } set { this.BarOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Foo {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FooJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); + + return new Foo(bar); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, foo, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) + { + if (foo.BarOption.IsSet && foo.Bar == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + + if (foo.BarOption.IsSet) + writer.WriteString("bar", foo.Bar); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 000000000000..1540483527a3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + public partial class FooGetDefaultResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// string + [JsonConstructor] + public FooGetDefaultResponse(Option @string = default) + { + StringOption = @string; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public Foo String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FooGetDefaultResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); + + return new FooGetDefaultResponse(varString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fooGetDefaultResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + + if (fooGetDefaultResponse.StringOption.IsSet) + { + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.String, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs new file mode 100644 index 000000000000..96902abd13a6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FormatTest.cs @@ -0,0 +1,969 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FormatTest + /// + public partial class FormatTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// byte + /// date + /// number + /// password + /// binary + /// dateTime + /// decimal + /// double + /// float + /// int32 + /// int32Range + /// int64 + /// int64Negative + /// int64NegativeExclusive + /// int64Positive + /// int64PositiveExclusive + /// integer + /// None + /// A string that is a 10 digit number. Can have leading zeros. + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// string + /// unsignedInteger + /// unsignedLong + /// uuid + [JsonConstructor] + public FormatTest(byte[] @byte, DateOnly date, decimal number, string password, Option binary = default, Option dateTime = default, Option @decimal = default, Option @double = default, Option @float = default, Option int32 = default, Option int32Range = default, Option int64 = default, Option int64Negative = default, Option int64NegativeExclusive = default, Option int64Positive = default, Option int64PositiveExclusive = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option @string = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) + { + Byte = @byte; + Date = date; + Number = number; + Password = password; + BinaryOption = binary; + DateTimeOption = dateTime; + DecimalOption = @decimal; + DoubleOption = @double; + FloatOption = @float; + Int32Option = int32; + Int32RangeOption = int32Range; + Int64Option = int64; + Int64NegativeOption = int64Negative; + Int64NegativeExclusiveOption = int64NegativeExclusive; + Int64PositiveOption = int64Positive; + Int64PositiveExclusiveOption = int64PositiveExclusive; + IntegerOption = integer; + PatternWithBackslashOption = patternWithBackslash; + PatternWithDigitsOption = patternWithDigits; + PatternWithDigitsAndDelimiterOption = patternWithDigitsAndDelimiter; + StringOption = @string; + UnsignedIntegerOption = unsignedInteger; + UnsignedLongOption = unsignedLong; + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Byte + /// + [JsonPropertyName("byte")] + public byte[] Byte { get; set; } + + /// + /// Gets or Sets Date + /// + /* Sun Feb 02 00:00:00 UTC 2020 */ + [JsonPropertyName("date")] + public DateOnly Date { get; set; } + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } + + /// + /// Used to track the state of Binary + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BinaryOption { get; private set; } + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream Binary { get { return this.BinaryOption; } set { this.BinaryOption = new(value); } } + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateTimeOption { get; private set; } + + /// + /// Gets or Sets DateTime + /// + /* 2007-12-03T10:15:30+01:00 */ + [JsonPropertyName("dateTime")] + public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new(value); } } + + /// + /// Used to track the state of Decimal + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DecimalOption { get; private set; } + + /// + /// Gets or Sets Decimal + /// + [JsonPropertyName("decimal")] + public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new(value); } } + + /// + /// Used to track the state of Double + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DoubleOption { get; private set; } + + /// + /// Gets or Sets Double + /// + [JsonPropertyName("double")] + public double? Double { get { return this.DoubleOption; } set { this.DoubleOption = new(value); } } + + /// + /// Used to track the state of Float + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FloatOption { get; private set; } + + /// + /// Gets or Sets Float + /// + [JsonPropertyName("float")] + public float? Float { get { return this.FloatOption; } set { this.FloatOption = new(value); } } + + /// + /// Used to track the state of Int32 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int32Option { get; private set; } + + /// + /// Gets or Sets Int32 + /// + [JsonPropertyName("int32")] + public int? Int32 { get { return this.Int32Option; } set { this.Int32Option = new(value); } } + + /// + /// Used to track the state of Int32Range + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int32RangeOption { get; private set; } + + /// + /// Gets or Sets Int32Range + /// + [JsonPropertyName("int32Range")] + public int? Int32Range { get { return this.Int32RangeOption; } set { this.Int32RangeOption = new(value); } } + + /// + /// Used to track the state of Int64 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64Option { get; private set; } + + /// + /// Gets or Sets Int64 + /// + [JsonPropertyName("int64")] + public long? Int64 { get { return this.Int64Option; } set { this.Int64Option = new(value); } } + + /// + /// Used to track the state of Int64Negative + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64NegativeOption { get; private set; } + + /// + /// Gets or Sets Int64Negative + /// + [JsonPropertyName("int64Negative")] + public long? Int64Negative { get { return this.Int64NegativeOption; } set { this.Int64NegativeOption = new(value); } } + + /// + /// Used to track the state of Int64NegativeExclusive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64NegativeExclusiveOption { get; private set; } + + /// + /// Gets or Sets Int64NegativeExclusive + /// + [JsonPropertyName("int64NegativeExclusive")] + public long? Int64NegativeExclusive { get { return this.Int64NegativeExclusiveOption; } set { this.Int64NegativeExclusiveOption = new(value); } } + + /// + /// Used to track the state of Int64Positive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64PositiveOption { get; private set; } + + /// + /// Gets or Sets Int64Positive + /// + [JsonPropertyName("int64Positive")] + public long? Int64Positive { get { return this.Int64PositiveOption; } set { this.Int64PositiveOption = new(value); } } + + /// + /// Used to track the state of Int64PositiveExclusive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64PositiveExclusiveOption { get; private set; } + + /// + /// Gets or Sets Int64PositiveExclusive + /// + [JsonPropertyName("int64PositiveExclusive")] + public long? Int64PositiveExclusive { get { return this.Int64PositiveExclusiveOption; } set { this.Int64PositiveExclusiveOption = new(value); } } + + /// + /// Used to track the state of Integer + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntegerOption { get; private set; } + + /// + /// Gets or Sets Integer + /// + [JsonPropertyName("integer")] + public int? Integer { get { return this.IntegerOption; } set { this.IntegerOption = new(value); } } + + /// + /// Used to track the state of PatternWithBackslash + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithBackslashOption { get; private set; } + + /// + /// None + /// + /// None + [JsonPropertyName("pattern_with_backslash")] + public string PatternWithBackslash { get { return this.PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } + + /// + /// Used to track the state of PatternWithDigits + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithDigitsOption { get; private set; } + + /// + /// A string that is a 10 digit number. Can have leading zeros. + /// + /// A string that is a 10 digit number. Can have leading zeros. + [JsonPropertyName("pattern_with_digits")] + public string PatternWithDigits { get { return this.PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } + + /// + /// Used to track the state of PatternWithDigitsAndDelimiter + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithDigitsAndDelimiterOption { get; private set; } + + /// + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + [JsonPropertyName("pattern_with_digits_and_delimiter")] + public string PatternWithDigitsAndDelimiter { get { return this.PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public string String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Used to track the state of UnsignedInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsignedIntegerOption { get; private set; } + + /// + /// Gets or Sets UnsignedInteger + /// + [JsonPropertyName("unsigned_integer")] + public uint? UnsignedInteger { get { return this.UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } + + /// + /// Used to track the state of UnsignedLong + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsignedLongOption { get; private set; } + + /// + /// Gets or Sets UnsignedLong + /// + [JsonPropertyName("unsigned_long")] + public ulong? UnsignedLong { get { return this.UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FormatTest {\n"); + sb.Append(" Byte: ").Append(Byte).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Decimal: ").Append(Decimal).Append("\n"); + sb.Append(" Double: ").Append(Double).Append("\n"); + sb.Append(" Float: ").Append(Float).Append("\n"); + sb.Append(" Int32: ").Append(Int32).Append("\n"); + sb.Append(" Int32Range: ").Append(Int32Range).Append("\n"); + sb.Append(" Int64: ").Append(Int64).Append("\n"); + sb.Append(" Int64Negative: ").Append(Int64Negative).Append("\n"); + sb.Append(" Int64NegativeExclusive: ").Append(Int64NegativeExclusive).Append("\n"); + sb.Append(" Int64Positive: ").Append(Int64Positive).Append("\n"); + sb.Append(" Int64PositiveExclusive: ").Append(Int64PositiveExclusive).Append("\n"); + sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); + sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); + sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" UnsignedInteger: ").Append(UnsignedInteger).Append("\n"); + sb.Append(" UnsignedLong: ").Append(UnsignedLong).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + // Double (double) maximum + if (this.DoubleOption.IsSet && this.DoubleOption.Value > (double)123.4) + { + yield return new ValidationResult("Invalid value for Double, must be a value less than or equal to 123.4.", new [] { "Double" }); + } + + // Double (double) minimum + if (this.DoubleOption.IsSet && this.DoubleOption.Value < (double)67.8) + { + yield return new ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); + } + + // Float (float) maximum + if (this.FloatOption.IsSet && this.FloatOption.Value > (float)987.6) + { + yield return new ValidationResult("Invalid value for Float, must be a value less than or equal to 987.6.", new [] { "Float" }); + } + + // Float (float) minimum + if (this.FloatOption.IsSet && this.FloatOption.Value < (float)54.3) + { + yield return new ValidationResult("Invalid value for Float, must be a value greater than or equal to 54.3.", new [] { "Float" }); + } + + // Int32 (int) maximum + if (this.Int32Option.IsSet && this.Int32Option.Value > (int)200) + { + yield return new ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); + } + + // Int32 (int) minimum + if (this.Int32Option.IsSet && this.Int32Option.Value < (int)20) + { + yield return new ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); + } + + // Int32Range (int) maximum + if (this.Int32RangeOption.IsSet && this.Int32RangeOption.Value > (int)2147483647) + { + yield return new ValidationResult("Invalid value for Int32Range, must be a value less than or equal to 2147483647.", new [] { "Int32Range" }); + } + + // Int32Range (int) minimum + if (this.Int32RangeOption.IsSet && this.Int32RangeOption.Value < (int)-2147483648) + { + yield return new ValidationResult("Invalid value for Int32Range, must be a value greater than or equal to -2147483648.", new [] { "Int32Range" }); + } + + // Int64Negative (long) maximum + if (this.Int64NegativeOption.IsSet && this.Int64NegativeOption.Value > (long)-2147483649) + { + yield return new ValidationResult("Invalid value for Int64Negative, must be a value less than or equal to -2147483649.", new [] { "Int64Negative" }); + } + + // Int64NegativeExclusive (long) maximum + if (this.Int64NegativeExclusiveOption.IsSet && this.Int64NegativeExclusiveOption.Value <= (long)-2147483648) + { + yield return new ValidationResult("Invalid value for Int64NegativeExclusive, must be a value less than -2147483648.", new [] { "Int64NegativeExclusive" }); + } + + // Int64Positive (long) minimum + if (this.Int64PositiveOption.IsSet && this.Int64PositiveOption.Value < (long)2147483648) + { + yield return new ValidationResult("Invalid value for Int64Positive, must be a value greater than or equal to 2147483648.", new [] { "Int64Positive" }); + } + + // Int64PositiveExclusive (long) minimum + if (this.Int64PositiveExclusiveOption.IsSet && this.Int64PositiveExclusiveOption.Value < (long)2147483647) + { + yield return new ValidationResult("Invalid value for Int64PositiveExclusive, must be a value greater than 2147483647.", new [] { "Int64PositiveExclusive" }); + } + + // Integer (int) maximum + if (this.IntegerOption.IsSet && this.IntegerOption.Value > (int)100) + { + yield return new ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); + } + + // Integer (int) minimum + if (this.IntegerOption.IsSet && this.IntegerOption.Value < (int)10) + { + yield return new ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); + } + + if (this.PatternWithBackslashOption.Value != null) { + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + + if (this.PatternWithBackslashOption.Value != null &&!regexPatternWithBackslash.Match(this.PatternWithBackslashOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } + } + + if (this.PatternWithDigitsOption.Value != null) { + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + + if (this.PatternWithDigitsOption.Value != null &&!regexPatternWithDigits.Match(this.PatternWithDigitsOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } + } + + if (this.PatternWithDigitsAndDelimiterOption.Value != null) { + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.PatternWithDigitsAndDelimiterOption.Value != null &&!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiterOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } + } + + if (this.StringOption.Value != null) { + // String (string) pattern + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.StringOption.Value != null &&!regexString.Match(this.StringOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); + } + } + + // UnsignedInteger (uint) maximum + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value > (uint)200) + { + yield return new ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); + } + + // UnsignedInteger (uint) minimum + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value < (uint)20) + { + yield return new ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); + } + + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FormatTestJsonConverter : JsonConverter + { + /// + /// The format to use to serialize Date + /// + public static string DateFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize DateTime + /// + public static string DateTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int32Range = default; + Option int64 = default; + Option int64Negative = default; + Option int64NegativeExclusive = default; + Option int64Positive = default; + Option int64PositiveExclusive = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "byte": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "date": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + number = new Option(utf8JsonReader.GetDecimal()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "dateTime": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "decimal": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "double": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varDouble = new Option(utf8JsonReader.GetDouble()); + break; + case "float": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varFloat = new Option((float)utf8JsonReader.GetDouble()); + break; + case "int32": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int32 = new Option(utf8JsonReader.GetInt32()); + break; + case "int32Range": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int32Range = new Option(utf8JsonReader.GetInt32()); + break; + case "int64": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64 = new Option(utf8JsonReader.GetInt64()); + break; + case "int64Negative": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64Negative = new Option(utf8JsonReader.GetInt32()); + break; + case "int64NegativeExclusive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + break; + case "int64Positive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64Positive = new Option(utf8JsonReader.GetInt32()); + break; + case "int64PositiveExclusive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + break; + case "integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + integer = new Option(utf8JsonReader.GetInt32()); + break; + case "pattern_with_backslash": + patternWithBackslash = new Option(utf8JsonReader.GetString()); + break; + case "pattern_with_digits": + patternWithDigits = new Option(utf8JsonReader.GetString()); + break; + case "pattern_with_digits_and_delimiter": + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()); + break; + case "string": + varString = new Option(utf8JsonReader.GetString()); + break; + case "unsigned_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + break; + case "unsigned_long": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + unsignedLong = new Option(utf8JsonReader.GetUInt64()); + break; + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!varByte.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); + + if (!date.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); + + if (!number.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); + + if (!password.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); + + if (varByte.IsSet && varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); + + if (date.IsSet && date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); + + if (number.IsSet && number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); + + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); + + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); + + if (varDecimal.IsSet && varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + + if (varDouble.IsSet && varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + + if (varFloat.IsSet && varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + + if (int32.IsSet && int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + + if (int32Range.IsSet && int32Range.Value == null) + throw new ArgumentNullException(nameof(int32Range), "Property is not nullable for class FormatTest."); + + if (int64.IsSet && int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + + if (int64Negative.IsSet && int64Negative.Value == null) + throw new ArgumentNullException(nameof(int64Negative), "Property is not nullable for class FormatTest."); + + if (int64NegativeExclusive.IsSet && int64NegativeExclusive.Value == null) + throw new ArgumentNullException(nameof(int64NegativeExclusive), "Property is not nullable for class FormatTest."); + + if (int64Positive.IsSet && int64Positive.Value == null) + throw new ArgumentNullException(nameof(int64Positive), "Property is not nullable for class FormatTest."); + + if (int64PositiveExclusive.IsSet && int64PositiveExclusive.Value == null) + throw new ArgumentNullException(nameof(int64PositiveExclusive), "Property is not nullable for class FormatTest."); + + if (integer.IsSet && integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + + if (patternWithBackslash.IsSet && patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); + + if (patternWithDigits.IsSet && patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); + + if (patternWithDigitsAndDelimiter.IsSet && patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + + if (unsignedInteger.IsSet && unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + + if (unsignedLong.IsSet && unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + + return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, binary, dateTime, varDecimal, varDouble, varFloat, int32, int32Range, int64, int64Negative, int64NegativeExclusive, int64Positive, int64PositiveExclusive, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, formatTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) + { + if (formatTest.Byte == null) + throw new ArgumentNullException(nameof(formatTest.Byte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.StringOption.IsSet && formatTest.String == null) + throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + + writer.WritePropertyName("byte"); + JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + + writer.WriteNumber("number", formatTest.Number); + + writer.WriteString("password", formatTest.Password); + + if (formatTest.BinaryOption.IsSet) + { + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + } + if (formatTest.DateTimeOption.IsSet) + writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); + + if (formatTest.DecimalOption.IsSet) + { + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.Decimal, jsonSerializerOptions); + } + if (formatTest.DoubleOption.IsSet) + writer.WriteNumber("double", formatTest.DoubleOption.Value.Value); + + if (formatTest.FloatOption.IsSet) + writer.WriteNumber("float", formatTest.FloatOption.Value.Value); + + if (formatTest.Int32Option.IsSet) + writer.WriteNumber("int32", formatTest.Int32Option.Value.Value); + + if (formatTest.Int32RangeOption.IsSet) + writer.WriteNumber("int32Range", formatTest.Int32RangeOption.Value.Value); + + if (formatTest.Int64Option.IsSet) + writer.WriteNumber("int64", formatTest.Int64Option.Value.Value); + + if (formatTest.Int64NegativeOption.IsSet) + writer.WriteNumber("int64Negative", formatTest.Int64NegativeOption.Value.Value); + + if (formatTest.Int64NegativeExclusiveOption.IsSet) + writer.WriteNumber("int64NegativeExclusive", formatTest.Int64NegativeExclusiveOption.Value.Value); + + if (formatTest.Int64PositiveOption.IsSet) + writer.WriteNumber("int64Positive", formatTest.Int64PositiveOption.Value.Value); + + if (formatTest.Int64PositiveExclusiveOption.IsSet) + writer.WriteNumber("int64PositiveExclusive", formatTest.Int64PositiveExclusiveOption.Value.Value); + + if (formatTest.IntegerOption.IsSet) + writer.WriteNumber("integer", formatTest.IntegerOption.Value.Value); + + if (formatTest.PatternWithBackslashOption.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); + + if (formatTest.PatternWithDigitsOption.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); + + if (formatTest.StringOption.IsSet) + writer.WriteString("string", formatTest.String); + + if (formatTest.UnsignedIntegerOption.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value.Value); + + if (formatTest.UnsignedLongOption.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value.Value); + + if (formatTest.UuidOption.IsSet) + writer.WriteString("uuid", formatTest.UuidOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Fruit.cs new file mode 100644 index 000000000000..1b74f3034c82 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Fruit.cs @@ -0,0 +1,218 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Fruit + /// + public partial class Fruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Apple apple, Option color = default) + { + Apple = apple; + ColorOption = color; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Banana banana, Option color = default) + { + Banana = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Apple + /// + public Apple Apple { get; set; } + + /// + /// Gets or Sets Banana + /// + public Banana Banana { get; set; } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Fruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple apple = default; + Banana banana = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + if (apple != null) + return new Fruit(apple, color); + + if (banana != null) + return new Fruit(banana, color); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FruitReq.cs new file mode 100644 index 000000000000..1e72875d4d32 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/FruitReq.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FruitReq + /// + public partial class FruitReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public FruitReq(AppleReq appleReq) + { + AppleReq = appleReq; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FruitReq(BananaReq bananaReq) + { + BananaReq = bananaReq; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets AppleReq + /// + public AppleReq AppleReq { get; set; } + + /// + /// Gets or Sets BananaReq + /// + public BananaReq BananaReq { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FruitReq {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + AppleReq appleReq = default; + BananaReq bananaReq = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderAppleReq = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderAppleReq, jsonSerializerOptions, out appleReq); + + Utf8JsonReader utf8JsonReaderBananaReq = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBananaReq, jsonSerializerOptions, out bananaReq); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (appleReq != null) + return new FruitReq(appleReq); + + if (bananaReq != null) + return new FruitReq(bananaReq); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fruitReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs new file mode 100644 index 000000000000..d5f9d222bc04 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GmFruit.cs @@ -0,0 +1,235 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// GmFruit + /// + public partial class GmFruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// color + public GmFruit(Option apple, Option banana, Option color = default) + { + AppleOption = apple; + BananaOption = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AppleOption { get; private set; } + + /// + /// Gets or Sets Apple + /// + public Apple Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BananaOption { get; private set; } + + /// + /// Gets or Sets Banana + /// + public Banana Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GmFruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class GmFruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple apple = default; + Banana banana = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); + + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null) + { + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(writer, gmFruit.AppleOption.Value, jsonSerializerOptions); + } + + if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null) + { + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(writer, gmFruit.BananaOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, gmFruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) + { + if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + + if (gmFruit.ColorOption.IsSet) + writer.WriteString("color", gmFruit.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GrandparentAnimal.cs new file mode 100644 index 000000000000..b23e4826fd6b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -0,0 +1,192 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// GrandparentAnimal + /// + public partial class GrandparentAnimal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructor] + public GrandparentAnimal() + { + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public string PetType { get; } = "GrandparentAnimal"; + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GrandparentAnimal {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class GrandparentAnimalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option petType = default; + + string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type"); + + if (discriminator != null && discriminator.Equals("ChildCat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + if (discriminator != null && discriminator.Equals("ParentPet")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pet_type": + petType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + return new GrandparentAnimal(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) + { + if (grandparentAnimal is ChildCat childCat){ + JsonSerializer.Serialize(writer, childCat, jsonSerializerOptions); + return; + } + + if (grandparentAnimal is ParentPet parentPet){ + JsonSerializer.Serialize(writer, parentPet, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, grandparentAnimal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("pet_type", grandparentAnimal.PetType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs new file mode 100644 index 000000000000..a4e67f73a8e5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -0,0 +1,244 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// HasOnlyReadOnly + /// + public partial class HasOnlyReadOnly : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar + /// foo + [JsonConstructor] + internal HasOnlyReadOnly(Option bar = default, Option foo = default) + { + BarOption = bar; + FooOption = foo; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string Bar { get { return this.BarOption; } } + + /// + /// Used to track the state of Foo + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FooOption { get; } + + /// + /// Gets or Sets Foo + /// + [JsonPropertyName("foo")] + public string Foo { get { return this.FooOption; } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HasOnlyReadOnly {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Foo: ").Append(Foo).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as HasOnlyReadOnly).AreEqual; + } + + /// + /// Returns true if HasOnlyReadOnly instances are equal + /// + /// Instance of HasOnlyReadOnly to be compared + /// Boolean + public bool Equals(HasOnlyReadOnly input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + if (Foo != null) + hashCode = (hashCode * 59) + Foo.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class HasOnlyReadOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + Option foo = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()); + break; + case "foo": + foo = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); + + if (foo.IsSet && foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); + + return new HasOnlyReadOnly(bar, foo); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, hasOnlyReadOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.BarOption.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar); + + if (hasOnlyReadOnly.FooOption.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HealthCheckResult.cs new file mode 100644 index 000000000000..4b7b17d3f58a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -0,0 +1,171 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + /// + public partial class HealthCheckResult : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// nullableMessage + [JsonConstructor] + public HealthCheckResult(Option nullableMessage = default) + { + NullableMessageOption = nullableMessage; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of NullableMessage + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NullableMessageOption { get; private set; } + + /// + /// Gets or Sets NullableMessage + /// + [JsonPropertyName("NullableMessage")] + public string NullableMessage { get { return this.NullableMessageOption; } set { this.NullableMessageOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HealthCheckResult {\n"); + sb.Append(" NullableMessage: ").Append(NullableMessage).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class HealthCheckResultJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option nullableMessage = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "NullableMessage": + nullableMessage = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + return new HealthCheckResult(nullableMessage); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, healthCheckResult, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) + { + if (healthCheckResult.NullableMessageOption.IsSet) + if (healthCheckResult.NullableMessageOption.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + else + writer.WriteNull("NullableMessage"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs new file mode 100644 index 000000000000..cce859524111 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -0,0 +1,186 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// IsoscelesTriangle + /// + public partial class IsoscelesTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public IsoscelesTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IsoscelesTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class IsoscelesTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + return new IsoscelesTriangle(shapeType.Value, triangleType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, isoscelesTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/List.cs new file mode 100644 index 000000000000..8880c4c197e5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/List.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// List + /// + public partial class List : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// var123List + [JsonConstructor] + public List(Option var123List = default) + { + Var123ListOption = var123List; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Var123List + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Var123ListOption { get; private set; } + + /// + /// Gets or Sets Var123List + /// + [JsonPropertyName("123-list")] + public string Var123List { get { return this.Var123ListOption; } set { this.Var123ListOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class List {\n"); + sb.Append(" Var123List: ").Append(Var123List).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ListJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option var123List = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "123-list": + var123List = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (var123List.IsSet && var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); + + return new List(var123List); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, list, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) + { + if (list.Var123ListOption.IsSet && list.Var123List == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + + if (list.Var123ListOption.IsSet) + writer.WriteString("123-list", list.Var123List); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 000000000000..4c97ce2b0066 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + public partial class LiteralStringClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username") + /// unescapedLiteralString (default to "C:\Users\username") + [JsonConstructor] + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) + { + EscapedLiteralStringOption = escapedLiteralString; + UnescapedLiteralStringOption = unescapedLiteralString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of EscapedLiteralString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EscapedLiteralStringOption { get; private set; } + + /// + /// Gets or Sets EscapedLiteralString + /// + [JsonPropertyName("escapedLiteralString")] + public string EscapedLiteralString { get { return this.EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } + + /// + /// Used to track the state of UnescapedLiteralString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnescapedLiteralStringOption { get; private set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [JsonPropertyName("unescapedLiteralString")] + public string UnescapedLiteralString { get { return this.UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class LiteralStringClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option escapedLiteralString = default; + Option unescapedLiteralString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "escapedLiteralString": + escapedLiteralString = new Option(utf8JsonReader.GetString()); + break; + case "unescapedLiteralString": + unescapedLiteralString = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (escapedLiteralString.IsSet && escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, literalStringClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.EscapedLiteralStringOption.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Mammal.cs new file mode 100644 index 000000000000..267ac8769d31 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Mammal.cs @@ -0,0 +1,269 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mammal + /// + public partial class Mammal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Whale whale) + { + Whale = whale; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Zebra zebra) + { + Zebra = zebra; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Pig pig) + { + Pig = pig; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Whale + /// + public Whale Whale { get; set; } + + /// + /// Gets or Sets Zebra + /// + public Zebra Zebra { get; set; } + + /// + /// Gets or Sets Pig + /// + public Pig Pig { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Mammal {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MammalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + Pig pig = null; + Whale whale = null; + Zebra zebra = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("className")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("Pig")) + { + Utf8JsonReader utf8JsonReaderPig = utf8JsonReader; + pig = JsonSerializer.Deserialize(ref utf8JsonReaderPig, jsonSerializerOptions); + } + if (discriminator.Equals("whale")) + { + Utf8JsonReader utf8JsonReaderWhale = utf8JsonReader; + whale = JsonSerializer.Deserialize(ref utf8JsonReaderWhale, jsonSerializerOptions); + } + if (discriminator.Equals("zebra")) + { + Utf8JsonReader utf8JsonReaderZebra = utf8JsonReader; + zebra = JsonSerializer.Deserialize(ref utf8JsonReaderZebra, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); + + if (pig != null) + return new Mammal(pig); + + if (whale != null) + return new Mammal(whale); + + if (zebra != null) + return new Mammal(zebra); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (mammal.Whale != null) + { + WhaleJsonConverter whaleJsonConverter = (WhaleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Whale.GetType())); + whaleJsonConverter.WriteProperties(writer, mammal.Whale, jsonSerializerOptions); + } + + if (mammal.Zebra != null) + { + ZebraJsonConverter zebraJsonConverter = (ZebraJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Zebra.GetType())); + zebraJsonConverter.WriteProperties(writer, mammal.Zebra, jsonSerializerOptions); + } + + if (mammal.Pig != null) + { + PigJsonConverter pigJsonConverter = (PigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Pig.GetType())); + pigJsonConverter.WriteProperties(writer, mammal.Pig, jsonSerializerOptions); + } + + WriteProperties(writer, mammal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs new file mode 100644 index 000000000000..101cfb09d2ae --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTest.cs @@ -0,0 +1,274 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MapTest + /// + public partial class MapTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// directMap + /// indirectMap + /// mapMapOfString + /// mapOfEnumString + [JsonConstructor] + public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) + { + DirectMapOption = directMap; + IndirectMapOption = indirectMap; + MapMapOfStringOption = mapMapOfString; + MapOfEnumStringOption = mapOfEnumString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of DirectMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> DirectMapOption { get; private set; } + + /// + /// Gets or Sets DirectMap + /// + [JsonPropertyName("direct_map")] + public Dictionary DirectMap { get { return this.DirectMapOption; } set { this.DirectMapOption = new(value); } } + + /// + /// Used to track the state of IndirectMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> IndirectMapOption { get; private set; } + + /// + /// Gets or Sets IndirectMap + /// + [JsonPropertyName("indirect_map")] + public Dictionary IndirectMap { get { return this.IndirectMapOption; } set { this.IndirectMapOption = new(value); } } + + /// + /// Used to track the state of MapMapOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> MapMapOfStringOption { get; private set; } + + /// + /// Gets or Sets MapMapOfString + /// + [JsonPropertyName("map_map_of_string")] + public Dictionary> MapMapOfString { get { return this.MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } + + /// + /// Used to track the state of MapOfEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapOfEnumStringOption { get; private set; } + + /// + /// Gets or Sets MapOfEnumString + /// + [JsonPropertyName("map_of_enum_string")] + public Dictionary MapOfEnumString { get { return this.MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MapTest {\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); + sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); + sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MapTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> directMap = default; + Option> indirectMap = default; + Option>> mapMapOfString = default; + Option> mapOfEnumString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "direct_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "indirect_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_map_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_of_enum_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (directMap.IsSet && directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); + + if (indirectMap.IsSet && indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); + + if (mapMapOfString.IsSet && mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); + + if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); + + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mapTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) + { + if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + + if (mapTest.DirectMapOption.IsSet) + { + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + } + if (mapTest.IndirectMapOption.IsSet) + { + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + } + if (mapTest.MapMapOfStringOption.IsSet) + { + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + } + if (mapTest.MapOfEnumStringOption.IsSet) + { + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTestMapOfEnumStringValue.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTestMapOfEnumStringValue.cs new file mode 100644 index 000000000000..441ea5dcb7da --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MapTestMapOfEnumStringValue.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines MapTest_map_of_enum_string_value + /// + public enum MapTestMapOfEnumStringValue + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class MapTestMapOfEnumStringValueValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static MapTestMapOfEnumStringValue FromString(string value) + { + if (value.Equals("UPPER")) + return MapTestMapOfEnumStringValue.UPPER; + + if (value.Equals("lower")) + return MapTestMapOfEnumStringValue.Lower; + + throw new NotImplementedException($"Could not convert value to type MapTestMapOfEnumStringValue: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static MapTestMapOfEnumStringValue? FromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return MapTestMapOfEnumStringValue.UPPER; + + if (value.Equals("lower")) + return MapTestMapOfEnumStringValue.Lower; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(MapTestMapOfEnumStringValue value) + { + if (value == MapTestMapOfEnumStringValue.UPPER) + return "UPPER"; + + if (value == MapTestMapOfEnumStringValue.Lower) + return "lower"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class MapTestMapOfEnumStringValueJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override MapTestMapOfEnumStringValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + MapTestMapOfEnumStringValue? result = rawValue == null + ? null + : MapTestMapOfEnumStringValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the MapTestMapOfEnumStringValue to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MapTestMapOfEnumStringValue mapTestMapOfEnumStringValue, JsonSerializerOptions options) + { + writer.WriteStringValue(mapTestMapOfEnumStringValue.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class MapTestMapOfEnumStringValueNullableJsonConverter : JsonConverter + { + /// + /// Returns a MapTestMapOfEnumStringValue from the Json object + /// + /// + /// + /// + /// + public override MapTestMapOfEnumStringValue? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + MapTestMapOfEnumStringValue? result = rawValue == null + ? null + : MapTestMapOfEnumStringValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MapTestMapOfEnumStringValue? mapTestMapOfEnumStringValue, JsonSerializerOptions options) + { + writer.WriteStringValue(mapTestMapOfEnumStringValue?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixLog.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixLog.cs new file mode 100644 index 000000000000..defed9c5c7c8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixLog.cs @@ -0,0 +1,1027 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixLog + /// + public partial class MixLog : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// description + /// formulaVersionDate + /// id + /// mixDate + /// totalOverPoors + /// totalRecalculations + /// totalSkips + /// totalUnderPours + /// batchNumber + /// BrandCode is only required for non-color mixes + /// BrandId is only required for color mixes + /// BrandName is only required for color mixes + /// CategoryCode is not used anymore + /// Color is only required for color mixes + /// colorDescription + /// comment + /// commercialProductCode + /// country + /// createdBy + /// createdByFirstName + /// createdByLastName + /// deltaECalculationRepaired + /// deltaECalculationSprayout + /// ownColorVariantNumber + /// primerProductId + /// ProductId is only required for color mixes + /// ProductLineCode is only required for color mixes + /// ProductName is only required for color mixes + /// selectedVersionIndex + /// shopId + /// SomeCode is only required for color mixes + /// totalPrice + [JsonConstructor] + public MixLog(string description, DateTime formulaVersionDate, Guid id, DateTime mixDate, int totalOverPoors, int totalRecalculations, int totalSkips, int totalUnderPours, Option batchNumber = default, Option brandCode = default, Option brandId = default, Option brandName = default, Option categoryCode = default, Option color = default, Option colorDescription = default, Option comment = default, Option commercialProductCode = default, Option country = default, Option createdBy = default, Option createdByFirstName = default, Option createdByLastName = default, Option deltaECalculationRepaired = default, Option deltaECalculationSprayout = default, Option ownColorVariantNumber = default, Option primerProductId = default, Option productId = default, Option productLineCode = default, Option productName = default, Option selectedVersionIndex = default, Option shopId = default, Option someCode = default, Option totalPrice = default) + { + Description = description; + FormulaVersionDate = formulaVersionDate; + Id = id; + MixDate = mixDate; + TotalOverPoors = totalOverPoors; + TotalRecalculations = totalRecalculations; + TotalSkips = totalSkips; + TotalUnderPours = totalUnderPours; + BatchNumberOption = batchNumber; + BrandCodeOption = brandCode; + BrandIdOption = brandId; + BrandNameOption = brandName; + CategoryCodeOption = categoryCode; + ColorOption = color; + ColorDescriptionOption = colorDescription; + CommentOption = comment; + CommercialProductCodeOption = commercialProductCode; + CountryOption = country; + CreatedByOption = createdBy; + CreatedByFirstNameOption = createdByFirstName; + CreatedByLastNameOption = createdByLastName; + DeltaECalculationRepairedOption = deltaECalculationRepaired; + DeltaECalculationSprayoutOption = deltaECalculationSprayout; + OwnColorVariantNumberOption = ownColorVariantNumber; + PrimerProductIdOption = primerProductId; + ProductIdOption = productId; + ProductLineCodeOption = productLineCode; + ProductNameOption = productName; + SelectedVersionIndexOption = selectedVersionIndex; + ShopIdOption = shopId; + SomeCodeOption = someCode; + TotalPriceOption = totalPrice; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Description + /// + [JsonPropertyName("description")] + public string Description { get; set; } + + /// + /// Gets or Sets FormulaVersionDate + /// + [JsonPropertyName("formulaVersionDate")] + public DateTime FormulaVersionDate { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Guid Id { get; set; } + + /// + /// Gets or Sets MixDate + /// + [JsonPropertyName("mixDate")] + public DateTime MixDate { get; set; } + + /// + /// Gets or Sets TotalOverPoors + /// + [JsonPropertyName("totalOverPoors")] + public int TotalOverPoors { get; set; } + + /// + /// Gets or Sets TotalRecalculations + /// + [JsonPropertyName("totalRecalculations")] + public int TotalRecalculations { get; set; } + + /// + /// Gets or Sets TotalSkips + /// + [JsonPropertyName("totalSkips")] + public int TotalSkips { get; set; } + + /// + /// Gets or Sets TotalUnderPours + /// + [JsonPropertyName("totalUnderPours")] + public int TotalUnderPours { get; set; } + + /// + /// Used to track the state of BatchNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BatchNumberOption { get; private set; } + + /// + /// Gets or Sets BatchNumber + /// + [JsonPropertyName("batchNumber")] + public string BatchNumber { get { return this.BatchNumberOption; } set { this.BatchNumberOption = new(value); } } + + /// + /// Used to track the state of BrandCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandCodeOption { get; private set; } + + /// + /// BrandCode is only required for non-color mixes + /// + /// BrandCode is only required for non-color mixes + [JsonPropertyName("brandCode")] + public string BrandCode { get { return this.BrandCodeOption; } set { this.BrandCodeOption = new(value); } } + + /// + /// Used to track the state of BrandId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandIdOption { get; private set; } + + /// + /// BrandId is only required for color mixes + /// + /// BrandId is only required for color mixes + [JsonPropertyName("brandId")] + public string BrandId { get { return this.BrandIdOption; } set { this.BrandIdOption = new(value); } } + + /// + /// Used to track the state of BrandName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandNameOption { get; private set; } + + /// + /// BrandName is only required for color mixes + /// + /// BrandName is only required for color mixes + [JsonPropertyName("brandName")] + public string BrandName { get { return this.BrandNameOption; } set { this.BrandNameOption = new(value); } } + + /// + /// Used to track the state of CategoryCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CategoryCodeOption { get; private set; } + + /// + /// CategoryCode is not used anymore + /// + /// CategoryCode is not used anymore + [JsonPropertyName("categoryCode")] + public string CategoryCode { get { return this.CategoryCodeOption; } set { this.CategoryCodeOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Color is only required for color mixes + /// + /// Color is only required for color mixes + [JsonPropertyName("color")] + public string Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Used to track the state of ColorDescription + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorDescriptionOption { get; private set; } + + /// + /// Gets or Sets ColorDescription + /// + [JsonPropertyName("colorDescription")] + public string ColorDescription { get { return this.ColorDescriptionOption; } set { this.ColorDescriptionOption = new(value); } } + + /// + /// Used to track the state of Comment + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CommentOption { get; private set; } + + /// + /// Gets or Sets Comment + /// + [JsonPropertyName("comment")] + public string Comment { get { return this.CommentOption; } set { this.CommentOption = new(value); } } + + /// + /// Used to track the state of CommercialProductCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CommercialProductCodeOption { get; private set; } + + /// + /// Gets or Sets CommercialProductCode + /// + [JsonPropertyName("commercialProductCode")] + public string CommercialProductCode { get { return this.CommercialProductCodeOption; } set { this.CommercialProductCodeOption = new(value); } } + + /// + /// Used to track the state of Country + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CountryOption { get; private set; } + + /// + /// Gets or Sets Country + /// + [JsonPropertyName("country")] + public string Country { get { return this.CountryOption; } set { this.CountryOption = new(value); } } + + /// + /// Used to track the state of CreatedBy + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByOption { get; private set; } + + /// + /// Gets or Sets CreatedBy + /// + [JsonPropertyName("createdBy")] + public string CreatedBy { get { return this.CreatedByOption; } set { this.CreatedByOption = new(value); } } + + /// + /// Used to track the state of CreatedByFirstName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByFirstNameOption { get; private set; } + + /// + /// Gets or Sets CreatedByFirstName + /// + [JsonPropertyName("createdByFirstName")] + public string CreatedByFirstName { get { return this.CreatedByFirstNameOption; } set { this.CreatedByFirstNameOption = new(value); } } + + /// + /// Used to track the state of CreatedByLastName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByLastNameOption { get; private set; } + + /// + /// Gets or Sets CreatedByLastName + /// + [JsonPropertyName("createdByLastName")] + public string CreatedByLastName { get { return this.CreatedByLastNameOption; } set { this.CreatedByLastNameOption = new(value); } } + + /// + /// Used to track the state of DeltaECalculationRepaired + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeltaECalculationRepairedOption { get; private set; } + + /// + /// Gets or Sets DeltaECalculationRepaired + /// + [JsonPropertyName("deltaECalculationRepaired")] + public string DeltaECalculationRepaired { get { return this.DeltaECalculationRepairedOption; } set { this.DeltaECalculationRepairedOption = new(value); } } + + /// + /// Used to track the state of DeltaECalculationSprayout + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeltaECalculationSprayoutOption { get; private set; } + + /// + /// Gets or Sets DeltaECalculationSprayout + /// + [JsonPropertyName("deltaECalculationSprayout")] + public string DeltaECalculationSprayout { get { return this.DeltaECalculationSprayoutOption; } set { this.DeltaECalculationSprayoutOption = new(value); } } + + /// + /// Used to track the state of OwnColorVariantNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OwnColorVariantNumberOption { get; private set; } + + /// + /// Gets or Sets OwnColorVariantNumber + /// + [JsonPropertyName("ownColorVariantNumber")] + public int? OwnColorVariantNumber { get { return this.OwnColorVariantNumberOption; } set { this.OwnColorVariantNumberOption = new(value); } } + + /// + /// Used to track the state of PrimerProductId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PrimerProductIdOption { get; private set; } + + /// + /// Gets or Sets PrimerProductId + /// + [JsonPropertyName("primerProductId")] + public string PrimerProductId { get { return this.PrimerProductIdOption; } set { this.PrimerProductIdOption = new(value); } } + + /// + /// Used to track the state of ProductId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductIdOption { get; private set; } + + /// + /// ProductId is only required for color mixes + /// + /// ProductId is only required for color mixes + [JsonPropertyName("productId")] + public string ProductId { get { return this.ProductIdOption; } set { this.ProductIdOption = new(value); } } + + /// + /// Used to track the state of ProductLineCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductLineCodeOption { get; private set; } + + /// + /// ProductLineCode is only required for color mixes + /// + /// ProductLineCode is only required for color mixes + [JsonPropertyName("productLineCode")] + public string ProductLineCode { get { return this.ProductLineCodeOption; } set { this.ProductLineCodeOption = new(value); } } + + /// + /// Used to track the state of ProductName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductNameOption { get; private set; } + + /// + /// ProductName is only required for color mixes + /// + /// ProductName is only required for color mixes + [JsonPropertyName("productName")] + public string ProductName { get { return this.ProductNameOption; } set { this.ProductNameOption = new(value); } } + + /// + /// Used to track the state of SelectedVersionIndex + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SelectedVersionIndexOption { get; private set; } + + /// + /// Gets or Sets SelectedVersionIndex + /// + [JsonPropertyName("selectedVersionIndex")] + public int? SelectedVersionIndex { get { return this.SelectedVersionIndexOption; } set { this.SelectedVersionIndexOption = new(value); } } + + /// + /// Used to track the state of ShopId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShopIdOption { get; private set; } + + /// + /// Gets or Sets ShopId + /// + [JsonPropertyName("shopId")] + public Guid? ShopId { get { return this.ShopIdOption; } set { this.ShopIdOption = new(value); } } + + /// + /// Used to track the state of SomeCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SomeCodeOption { get; private set; } + + /// + /// SomeCode is only required for color mixes + /// + /// SomeCode is only required for color mixes + [JsonPropertyName("someCode")] + public string SomeCode { get { return this.SomeCodeOption; } set { this.SomeCodeOption = new(value); } } + + /// + /// Used to track the state of TotalPrice + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TotalPriceOption { get; private set; } + + /// + /// Gets or Sets TotalPrice + /// + [JsonPropertyName("totalPrice")] + public float? TotalPrice { get { return this.TotalPriceOption; } set { this.TotalPriceOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixLog {\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" FormulaVersionDate: ").Append(FormulaVersionDate).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" MixDate: ").Append(MixDate).Append("\n"); + sb.Append(" TotalOverPoors: ").Append(TotalOverPoors).Append("\n"); + sb.Append(" TotalRecalculations: ").Append(TotalRecalculations).Append("\n"); + sb.Append(" TotalSkips: ").Append(TotalSkips).Append("\n"); + sb.Append(" TotalUnderPours: ").Append(TotalUnderPours).Append("\n"); + sb.Append(" BatchNumber: ").Append(BatchNumber).Append("\n"); + sb.Append(" BrandCode: ").Append(BrandCode).Append("\n"); + sb.Append(" BrandId: ").Append(BrandId).Append("\n"); + sb.Append(" BrandName: ").Append(BrandName).Append("\n"); + sb.Append(" CategoryCode: ").Append(CategoryCode).Append("\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" ColorDescription: ").Append(ColorDescription).Append("\n"); + sb.Append(" Comment: ").Append(Comment).Append("\n"); + sb.Append(" CommercialProductCode: ").Append(CommercialProductCode).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append(" CreatedBy: ").Append(CreatedBy).Append("\n"); + sb.Append(" CreatedByFirstName: ").Append(CreatedByFirstName).Append("\n"); + sb.Append(" CreatedByLastName: ").Append(CreatedByLastName).Append("\n"); + sb.Append(" DeltaECalculationRepaired: ").Append(DeltaECalculationRepaired).Append("\n"); + sb.Append(" DeltaECalculationSprayout: ").Append(DeltaECalculationSprayout).Append("\n"); + sb.Append(" OwnColorVariantNumber: ").Append(OwnColorVariantNumber).Append("\n"); + sb.Append(" PrimerProductId: ").Append(PrimerProductId).Append("\n"); + sb.Append(" ProductId: ").Append(ProductId).Append("\n"); + sb.Append(" ProductLineCode: ").Append(ProductLineCode).Append("\n"); + sb.Append(" ProductName: ").Append(ProductName).Append("\n"); + sb.Append(" SelectedVersionIndex: ").Append(SelectedVersionIndex).Append("\n"); + sb.Append(" ShopId: ").Append(ShopId).Append("\n"); + sb.Append(" SomeCode: ").Append(SomeCode).Append("\n"); + sb.Append(" TotalPrice: ").Append(TotalPrice).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixLogJsonConverter : JsonConverter + { + /// + /// The format to use to serialize FormulaVersionDate + /// + public static string FormulaVersionDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize MixDate + /// + public static string MixDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixLog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option description = default; + Option formulaVersionDate = default; + Option id = default; + Option mixDate = default; + Option totalOverPoors = default; + Option totalRecalculations = default; + Option totalSkips = default; + Option totalUnderPours = default; + Option batchNumber = default; + Option brandCode = default; + Option brandId = default; + Option brandName = default; + Option categoryCode = default; + Option color = default; + Option colorDescription = default; + Option comment = default; + Option commercialProductCode = default; + Option country = default; + Option createdBy = default; + Option createdByFirstName = default; + Option createdByLastName = default; + Option deltaECalculationRepaired = default; + Option deltaECalculationSprayout = default; + Option ownColorVariantNumber = default; + Option primerProductId = default; + Option productId = default; + Option productLineCode = default; + Option productName = default; + Option selectedVersionIndex = default; + Option shopId = default; + Option someCode = default; + Option totalPrice = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "description": + description = new Option(utf8JsonReader.GetString()); + break; + case "formulaVersionDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + formulaVersionDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetGuid()); + break; + case "mixDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mixDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "totalOverPoors": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalOverPoors = new Option(utf8JsonReader.GetInt32()); + break; + case "totalRecalculations": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalRecalculations = new Option(utf8JsonReader.GetInt32()); + break; + case "totalSkips": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalSkips = new Option(utf8JsonReader.GetInt32()); + break; + case "totalUnderPours": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalUnderPours = new Option(utf8JsonReader.GetInt32()); + break; + case "batchNumber": + batchNumber = new Option(utf8JsonReader.GetString()); + break; + case "brandCode": + brandCode = new Option(utf8JsonReader.GetString()); + break; + case "brandId": + brandId = new Option(utf8JsonReader.GetString()); + break; + case "brandName": + brandName = new Option(utf8JsonReader.GetString()); + break; + case "categoryCode": + categoryCode = new Option(utf8JsonReader.GetString()); + break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + case "colorDescription": + colorDescription = new Option(utf8JsonReader.GetString()); + break; + case "comment": + comment = new Option(utf8JsonReader.GetString()); + break; + case "commercialProductCode": + commercialProductCode = new Option(utf8JsonReader.GetString()); + break; + case "country": + country = new Option(utf8JsonReader.GetString()); + break; + case "createdBy": + createdBy = new Option(utf8JsonReader.GetString()); + break; + case "createdByFirstName": + createdByFirstName = new Option(utf8JsonReader.GetString()); + break; + case "createdByLastName": + createdByLastName = new Option(utf8JsonReader.GetString()); + break; + case "deltaECalculationRepaired": + deltaECalculationRepaired = new Option(utf8JsonReader.GetString()); + break; + case "deltaECalculationSprayout": + deltaECalculationSprayout = new Option(utf8JsonReader.GetString()); + break; + case "ownColorVariantNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + ownColorVariantNumber = new Option(utf8JsonReader.GetInt32()); + break; + case "primerProductId": + primerProductId = new Option(utf8JsonReader.GetString()); + break; + case "productId": + productId = new Option(utf8JsonReader.GetString()); + break; + case "productLineCode": + productLineCode = new Option(utf8JsonReader.GetString()); + break; + case "productName": + productName = new Option(utf8JsonReader.GetString()); + break; + case "selectedVersionIndex": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + selectedVersionIndex = new Option(utf8JsonReader.GetInt32()); + break; + case "shopId": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shopId = new Option(utf8JsonReader.GetGuid()); + break; + case "someCode": + someCode = new Option(utf8JsonReader.GetString()); + break; + case "totalPrice": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalPrice = new Option((float)utf8JsonReader.GetDouble()); + break; + default: + break; + } + } + } + + if (!description.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(description)); + + if (!formulaVersionDate.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(formulaVersionDate)); + + if (!id.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(id)); + + if (!mixDate.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(mixDate)); + + if (!totalOverPoors.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalOverPoors)); + + if (!totalRecalculations.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalRecalculations)); + + if (!totalSkips.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalSkips)); + + if (!totalUnderPours.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalUnderPours)); + + if (description.IsSet && description.Value == null) + throw new ArgumentNullException(nameof(description), "Property is not nullable for class MixLog."); + + if (formulaVersionDate.IsSet && formulaVersionDate.Value == null) + throw new ArgumentNullException(nameof(formulaVersionDate), "Property is not nullable for class MixLog."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixLog."); + + if (mixDate.IsSet && mixDate.Value == null) + throw new ArgumentNullException(nameof(mixDate), "Property is not nullable for class MixLog."); + + if (totalOverPoors.IsSet && totalOverPoors.Value == null) + throw new ArgumentNullException(nameof(totalOverPoors), "Property is not nullable for class MixLog."); + + if (totalRecalculations.IsSet && totalRecalculations.Value == null) + throw new ArgumentNullException(nameof(totalRecalculations), "Property is not nullable for class MixLog."); + + if (totalSkips.IsSet && totalSkips.Value == null) + throw new ArgumentNullException(nameof(totalSkips), "Property is not nullable for class MixLog."); + + if (totalUnderPours.IsSet && totalUnderPours.Value == null) + throw new ArgumentNullException(nameof(totalUnderPours), "Property is not nullable for class MixLog."); + + if (batchNumber.IsSet && batchNumber.Value == null) + throw new ArgumentNullException(nameof(batchNumber), "Property is not nullable for class MixLog."); + + if (brandCode.IsSet && brandCode.Value == null) + throw new ArgumentNullException(nameof(brandCode), "Property is not nullable for class MixLog."); + + if (brandId.IsSet && brandId.Value == null) + throw new ArgumentNullException(nameof(brandId), "Property is not nullable for class MixLog."); + + if (brandName.IsSet && brandName.Value == null) + throw new ArgumentNullException(nameof(brandName), "Property is not nullable for class MixLog."); + + if (categoryCode.IsSet && categoryCode.Value == null) + throw new ArgumentNullException(nameof(categoryCode), "Property is not nullable for class MixLog."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class MixLog."); + + if (colorDescription.IsSet && colorDescription.Value == null) + throw new ArgumentNullException(nameof(colorDescription), "Property is not nullable for class MixLog."); + + if (comment.IsSet && comment.Value == null) + throw new ArgumentNullException(nameof(comment), "Property is not nullable for class MixLog."); + + if (commercialProductCode.IsSet && commercialProductCode.Value == null) + throw new ArgumentNullException(nameof(commercialProductCode), "Property is not nullable for class MixLog."); + + if (country.IsSet && country.Value == null) + throw new ArgumentNullException(nameof(country), "Property is not nullable for class MixLog."); + + if (createdBy.IsSet && createdBy.Value == null) + throw new ArgumentNullException(nameof(createdBy), "Property is not nullable for class MixLog."); + + if (createdByFirstName.IsSet && createdByFirstName.Value == null) + throw new ArgumentNullException(nameof(createdByFirstName), "Property is not nullable for class MixLog."); + + if (createdByLastName.IsSet && createdByLastName.Value == null) + throw new ArgumentNullException(nameof(createdByLastName), "Property is not nullable for class MixLog."); + + if (deltaECalculationRepaired.IsSet && deltaECalculationRepaired.Value == null) + throw new ArgumentNullException(nameof(deltaECalculationRepaired), "Property is not nullable for class MixLog."); + + if (deltaECalculationSprayout.IsSet && deltaECalculationSprayout.Value == null) + throw new ArgumentNullException(nameof(deltaECalculationSprayout), "Property is not nullable for class MixLog."); + + if (primerProductId.IsSet && primerProductId.Value == null) + throw new ArgumentNullException(nameof(primerProductId), "Property is not nullable for class MixLog."); + + if (productId.IsSet && productId.Value == null) + throw new ArgumentNullException(nameof(productId), "Property is not nullable for class MixLog."); + + if (productLineCode.IsSet && productLineCode.Value == null) + throw new ArgumentNullException(nameof(productLineCode), "Property is not nullable for class MixLog."); + + if (productName.IsSet && productName.Value == null) + throw new ArgumentNullException(nameof(productName), "Property is not nullable for class MixLog."); + + if (selectedVersionIndex.IsSet && selectedVersionIndex.Value == null) + throw new ArgumentNullException(nameof(selectedVersionIndex), "Property is not nullable for class MixLog."); + + if (shopId.IsSet && shopId.Value == null) + throw new ArgumentNullException(nameof(shopId), "Property is not nullable for class MixLog."); + + return new MixLog(description.Value, formulaVersionDate.Value.Value, id.Value.Value, mixDate.Value.Value, totalOverPoors.Value.Value, totalRecalculations.Value.Value, totalSkips.Value.Value, totalUnderPours.Value.Value, batchNumber, brandCode, brandId, brandName, categoryCode, color, colorDescription, comment, commercialProductCode, country, createdBy, createdByFirstName, createdByLastName, deltaECalculationRepaired, deltaECalculationSprayout, ownColorVariantNumber, primerProductId, productId, productLineCode, productName, selectedVersionIndex, shopId, someCode, totalPrice); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixLog, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions) + { + if (mixLog.Description == null) + throw new ArgumentNullException(nameof(mixLog.Description), "Property is required for class MixLog."); + + if (mixLog.BatchNumberOption.IsSet && mixLog.BatchNumber == null) + throw new ArgumentNullException(nameof(mixLog.BatchNumber), "Property is required for class MixLog."); + + if (mixLog.BrandCodeOption.IsSet && mixLog.BrandCode == null) + throw new ArgumentNullException(nameof(mixLog.BrandCode), "Property is required for class MixLog."); + + if (mixLog.BrandIdOption.IsSet && mixLog.BrandId == null) + throw new ArgumentNullException(nameof(mixLog.BrandId), "Property is required for class MixLog."); + + if (mixLog.BrandNameOption.IsSet && mixLog.BrandName == null) + throw new ArgumentNullException(nameof(mixLog.BrandName), "Property is required for class MixLog."); + + if (mixLog.CategoryCodeOption.IsSet && mixLog.CategoryCode == null) + throw new ArgumentNullException(nameof(mixLog.CategoryCode), "Property is required for class MixLog."); + + if (mixLog.ColorOption.IsSet && mixLog.Color == null) + throw new ArgumentNullException(nameof(mixLog.Color), "Property is required for class MixLog."); + + if (mixLog.ColorDescriptionOption.IsSet && mixLog.ColorDescription == null) + throw new ArgumentNullException(nameof(mixLog.ColorDescription), "Property is required for class MixLog."); + + if (mixLog.CommentOption.IsSet && mixLog.Comment == null) + throw new ArgumentNullException(nameof(mixLog.Comment), "Property is required for class MixLog."); + + if (mixLog.CommercialProductCodeOption.IsSet && mixLog.CommercialProductCode == null) + throw new ArgumentNullException(nameof(mixLog.CommercialProductCode), "Property is required for class MixLog."); + + if (mixLog.CountryOption.IsSet && mixLog.Country == null) + throw new ArgumentNullException(nameof(mixLog.Country), "Property is required for class MixLog."); + + if (mixLog.CreatedByOption.IsSet && mixLog.CreatedBy == null) + throw new ArgumentNullException(nameof(mixLog.CreatedBy), "Property is required for class MixLog."); + + if (mixLog.CreatedByFirstNameOption.IsSet && mixLog.CreatedByFirstName == null) + throw new ArgumentNullException(nameof(mixLog.CreatedByFirstName), "Property is required for class MixLog."); + + if (mixLog.CreatedByLastNameOption.IsSet && mixLog.CreatedByLastName == null) + throw new ArgumentNullException(nameof(mixLog.CreatedByLastName), "Property is required for class MixLog."); + + if (mixLog.DeltaECalculationRepairedOption.IsSet && mixLog.DeltaECalculationRepaired == null) + throw new ArgumentNullException(nameof(mixLog.DeltaECalculationRepaired), "Property is required for class MixLog."); + + if (mixLog.DeltaECalculationSprayoutOption.IsSet && mixLog.DeltaECalculationSprayout == null) + throw new ArgumentNullException(nameof(mixLog.DeltaECalculationSprayout), "Property is required for class MixLog."); + + if (mixLog.PrimerProductIdOption.IsSet && mixLog.PrimerProductId == null) + throw new ArgumentNullException(nameof(mixLog.PrimerProductId), "Property is required for class MixLog."); + + if (mixLog.ProductIdOption.IsSet && mixLog.ProductId == null) + throw new ArgumentNullException(nameof(mixLog.ProductId), "Property is required for class MixLog."); + + if (mixLog.ProductLineCodeOption.IsSet && mixLog.ProductLineCode == null) + throw new ArgumentNullException(nameof(mixLog.ProductLineCode), "Property is required for class MixLog."); + + if (mixLog.ProductNameOption.IsSet && mixLog.ProductName == null) + throw new ArgumentNullException(nameof(mixLog.ProductName), "Property is required for class MixLog."); + + writer.WriteString("description", mixLog.Description); + + writer.WriteString("formulaVersionDate", mixLog.FormulaVersionDate.ToString(FormulaVersionDateFormat)); + + writer.WriteString("id", mixLog.Id); + + writer.WriteString("mixDate", mixLog.MixDate.ToString(MixDateFormat)); + + writer.WriteNumber("totalOverPoors", mixLog.TotalOverPoors); + + writer.WriteNumber("totalRecalculations", mixLog.TotalRecalculations); + + writer.WriteNumber("totalSkips", mixLog.TotalSkips); + + writer.WriteNumber("totalUnderPours", mixLog.TotalUnderPours); + + if (mixLog.BatchNumberOption.IsSet) + writer.WriteString("batchNumber", mixLog.BatchNumber); + + if (mixLog.BrandCodeOption.IsSet) + writer.WriteString("brandCode", mixLog.BrandCode); + + if (mixLog.BrandIdOption.IsSet) + writer.WriteString("brandId", mixLog.BrandId); + + if (mixLog.BrandNameOption.IsSet) + writer.WriteString("brandName", mixLog.BrandName); + + if (mixLog.CategoryCodeOption.IsSet) + writer.WriteString("categoryCode", mixLog.CategoryCode); + + if (mixLog.ColorOption.IsSet) + writer.WriteString("color", mixLog.Color); + + if (mixLog.ColorDescriptionOption.IsSet) + writer.WriteString("colorDescription", mixLog.ColorDescription); + + if (mixLog.CommentOption.IsSet) + writer.WriteString("comment", mixLog.Comment); + + if (mixLog.CommercialProductCodeOption.IsSet) + writer.WriteString("commercialProductCode", mixLog.CommercialProductCode); + + if (mixLog.CountryOption.IsSet) + writer.WriteString("country", mixLog.Country); + + if (mixLog.CreatedByOption.IsSet) + writer.WriteString("createdBy", mixLog.CreatedBy); + + if (mixLog.CreatedByFirstNameOption.IsSet) + writer.WriteString("createdByFirstName", mixLog.CreatedByFirstName); + + if (mixLog.CreatedByLastNameOption.IsSet) + writer.WriteString("createdByLastName", mixLog.CreatedByLastName); + + if (mixLog.DeltaECalculationRepairedOption.IsSet) + writer.WriteString("deltaECalculationRepaired", mixLog.DeltaECalculationRepaired); + + if (mixLog.DeltaECalculationSprayoutOption.IsSet) + writer.WriteString("deltaECalculationSprayout", mixLog.DeltaECalculationSprayout); + + if (mixLog.OwnColorVariantNumberOption.IsSet) + if (mixLog.OwnColorVariantNumberOption.Value != null) + writer.WriteNumber("ownColorVariantNumber", mixLog.OwnColorVariantNumberOption.Value.Value); + else + writer.WriteNull("ownColorVariantNumber"); + + if (mixLog.PrimerProductIdOption.IsSet) + writer.WriteString("primerProductId", mixLog.PrimerProductId); + + if (mixLog.ProductIdOption.IsSet) + writer.WriteString("productId", mixLog.ProductId); + + if (mixLog.ProductLineCodeOption.IsSet) + writer.WriteString("productLineCode", mixLog.ProductLineCode); + + if (mixLog.ProductNameOption.IsSet) + writer.WriteString("productName", mixLog.ProductName); + + if (mixLog.SelectedVersionIndexOption.IsSet) + writer.WriteNumber("selectedVersionIndex", mixLog.SelectedVersionIndexOption.Value.Value); + + if (mixLog.ShopIdOption.IsSet) + writer.WriteString("shopId", mixLog.ShopIdOption.Value.Value); + + if (mixLog.SomeCodeOption.IsSet) + if (mixLog.SomeCodeOption.Value != null) + writer.WriteString("someCode", mixLog.SomeCode); + else + writer.WriteNull("someCode"); + + if (mixLog.TotalPriceOption.IsSet) + if (mixLog.TotalPriceOption.Value != null) + writer.WriteNumber("totalPrice", mixLog.TotalPriceOption.Value.Value); + else + writer.WriteNull("totalPrice"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs new file mode 100644 index 000000000000..674358380306 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedAnyOf + /// + public partial class MixedAnyOf : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// content + [JsonConstructor] + public MixedAnyOf(Option content = default) + { + ContentOption = content; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Content + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ContentOption { get; private set; } + + /// + /// Gets or Sets Content + /// + [JsonPropertyName("content")] + public MixedAnyOfContent Content { get { return this.ContentOption; } set { this.ContentOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedAnyOf {\n"); + sb.Append(" Content: ").Append(Content).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedAnyOfJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option content = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "content": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (content.IsSet && content.Value == null) + throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedAnyOf."); + + return new MixedAnyOf(content); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedAnyOf, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) + throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + + if (mixedAnyOf.ContentOption.IsSet) + { + writer.WritePropertyName("content"); + JsonSerializer.Serialize(writer, mixedAnyOf.Content, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs new file mode 100644 index 000000000000..4d5b99d03e4c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs @@ -0,0 +1,283 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mixed anyOf types for testing + /// + public partial class MixedAnyOfContent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + public MixedAnyOfContent(Option @string, Option @bool, Option @int, Option @decimal, Option mixedSubId) + { + StringOption = @string; + BoolOption = @bool; + IntOption = @int; + DecimalOption = @decimal; + MixedSubIdOption = mixedSubId; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + public string String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Used to track the state of Bool + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BoolOption { get; private set; } + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get { return this.BoolOption; } set { this.BoolOption = new(value); } } + + /// + /// Used to track the state of Int + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntOption { get; private set; } + + /// + /// Gets or Sets Int + /// + public int? Int { get { return this.IntOption; } set { this.IntOption = new(value); } } + + /// + /// Used to track the state of Decimal + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DecimalOption { get; private set; } + + /// + /// Gets or Sets Decimal + /// + public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new(value); } } + + /// + /// Used to track the state of MixedSubId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MixedSubIdOption { get; private set; } + + /// + /// Gets or Sets MixedSubId + /// + public MixedSubId MixedSubId { get { return this.MixedSubIdOption; } set { this.MixedSubIdOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedAnyOfContent {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedAnyOfContentJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedAnyOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string varString = default; + bool? varBool = default; + int? varInt = default; + decimal? varDecimal = default; + MixedSubId mixedSubId = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderInt = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt); + + Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal); + + Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + Option varStringParsedValue = varString == null + ? default + : new Option(varString); + Option varBoolParsedValue = varBool == null + ? default + : new Option(varBool); + Option varIntParsedValue = varInt == null + ? default + : new Option(varInt); + Option varDecimalParsedValue = varDecimal == null + ? default + : new Option(varDecimal); + Option mixedSubIdParsedValue = mixedSubId == null + ? default + : new Option(mixedSubId); + + return new MixedAnyOfContent(varStringParsedValue, varBoolParsedValue, varIntParsedValue, varDecimalParsedValue, mixedSubIdParsedValue); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (mixedAnyOfContent.StringOption.IsSet && mixedAnyOfContent.StringOption.Value != null) + writer.WriteString("content", mixedAnyOfContent.StringOption.Value); + + if (mixedAnyOfContent.BoolOption.IsSet && mixedAnyOfContent.BoolOption.Value != null) + writer.WriteBoolean("content", mixedAnyOfContent.BoolOption.Value.Value); + + if (mixedAnyOfContent.IntOption.IsSet && mixedAnyOfContent.IntOption.Value != null) + writer.WriteNumber("content", mixedAnyOfContent.IntOption.Value.Value); + + if (mixedAnyOfContent.DecimalOption.IsSet && mixedAnyOfContent.DecimalOption.Value != null) + writer.WriteNumber("content", mixedAnyOfContent.DecimalOption.Value.Value); + + if (mixedAnyOfContent.MixedSubIdOption.IsSet && mixedAnyOfContent.MixedSubIdOption.Value != null) + { + MixedSubIdJsonConverter MixedSubIdJsonConverter = (MixedSubIdJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mixedAnyOfContent.MixedSubIdOption.Value.GetType())); + MixedSubIdJsonConverter.WriteProperties(writer, mixedAnyOfContent.MixedSubIdOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, mixedAnyOfContent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs new file mode 100644 index 000000000000..2467daa6e2b3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedOneOf + /// + public partial class MixedOneOf : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// content + [JsonConstructor] + public MixedOneOf(Option content = default) + { + ContentOption = content; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Content + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ContentOption { get; private set; } + + /// + /// Gets or Sets Content + /// + [JsonPropertyName("content")] + public MixedOneOfContent Content { get { return this.ContentOption; } set { this.ContentOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedOneOf {\n"); + sb.Append(" Content: ").Append(Content).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedOneOfJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option content = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "content": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (content.IsSet && content.Value == null) + throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedOneOf."); + + return new MixedOneOf(content); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedOneOf, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) + throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + + if (mixedOneOf.ContentOption.IsSet) + { + writer.WritePropertyName("content"); + JsonSerializer.Serialize(writer, mixedOneOf.Content, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOfContent.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOfContent.cs new file mode 100644 index 000000000000..4cb69dae28cd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedOneOfContent.cs @@ -0,0 +1,261 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mixed oneOf types for testing + /// + public partial class MixedOneOfContent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(string @string) + { + String = @string; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(bool @bool) + { + Bool = @bool; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(int @int) + { + Int = @int; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(decimal @decimal) + { + Decimal = @decimal; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(MixedSubId mixedSubId) + { + MixedSubId = mixedSubId; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets String + /// + public string String { get; set; } + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get; set; } + + /// + /// Gets or Sets Int + /// + public int? Int { get; set; } + + /// + /// Gets or Sets Decimal + /// + public decimal? Decimal { get; set; } + + /// + /// Gets or Sets MixedSubId + /// + public MixedSubId MixedSubId { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedOneOfContent {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedOneOfContentJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedOneOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string varString = default; + bool? varBool = default; + int? varInt = default; + decimal? varDecimal = default; + MixedSubId mixedSubId = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderInt = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt); + + Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal); + + Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varString != null) + return new MixedOneOfContent(varString); + + if (varBool != null) + return new MixedOneOfContent(varBool.Value); + + if (varInt != null) + return new MixedOneOfContent(varInt.Value); + + if (varDecimal != null) + return new MixedOneOfContent(varDecimal.Value); + + if (mixedSubId != null) + return new MixedOneOfContent(mixedSubId); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedOneOfContent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs new file mode 100644 index 000000000000..808a4b66c6f2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -0,0 +1,270 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedPropertiesAndAdditionalPropertiesClass + /// + public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// dateTime + /// map + /// uuid + /// uuidWithPattern + [JsonConstructor] + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) + { + DateTimeOption = dateTime; + MapOption = map; + UuidOption = uuid; + UuidWithPatternOption = uuidWithPattern; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateTimeOption { get; private set; } + + /// + /// Gets or Sets DateTime + /// + [JsonPropertyName("dateTime")] + public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new(value); } } + + /// + /// Used to track the state of Map + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapOption { get; private set; } + + /// + /// Gets or Sets Map + /// + [JsonPropertyName("map")] + public Dictionary Map { get { return this.MapOption; } set { this.MapOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Used to track the state of UuidWithPattern + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidWithPatternOption { get; private set; } + + /// + /// Gets or Sets UuidWithPattern + /// + [JsonPropertyName("uuid_with_pattern")] + public Guid? UuidWithPattern { get { return this.UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Map: ").Append(Map).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" UuidWithPattern: ").Append(UuidWithPattern).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + + if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedPropertiesAndAdditionalPropertiesClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateTime + /// + public static string DateTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option dateTime = default; + Option> map = default; + Option uuid = default; + Option uuidWithPattern = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "dateTime": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + case "uuid_with_pattern": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (map.IsSet && map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedPropertiesAndAdditionalPropertiesClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); + + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) + { + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + } + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs new file mode 100644 index 000000000000..05c06c0129ed --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedSubId + /// + public partial class MixedSubId : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + [JsonConstructor] + public MixedSubId(Option id = default) + { + IdOption = id; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public string Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedSubId {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedSubIdJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedSubId Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + id = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixedSubId."); + + return new MixedSubId(id); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedSubId, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) + throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + + if (mixedSubId.IdOption.IsSet) + writer.WriteString("id", mixedSubId.Id); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs new file mode 100644 index 000000000000..8e865d8efae7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Model200Response.cs @@ -0,0 +1,201 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name starting with number + /// + public partial class Model200Response : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// class + /// name + [JsonConstructor] + public Model200Response(Option @class = default, Option name = default) + { + ClassOption = @class; + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Class + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ClassOption { get; private set; } + + /// + /// Gets or Sets Class + /// + [JsonPropertyName("class")] + public string Class { get { return this.ClassOption; } set { this.ClassOption = new(value); } } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public int? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Model200Response {\n"); + sb.Append(" Class: ").Append(Class).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class Model200ResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClass = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "class": + varClass = new Option(utf8JsonReader.GetString()); + break; + case "name": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + name = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); + + return new Model200Response(varClass, name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, model200Response, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) + { + if (model200Response.ClassOption.IsSet && model200Response.Class == null) + throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + + if (model200Response.ClassOption.IsSet) + writer.WriteString("class", model200Response.Class); + + if (model200Response.NameOption.IsSet) + writer.WriteNumber("name", model200Response.NameOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs new file mode 100644 index 000000000000..60a778b3a743 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ModelClient.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ModelClient + /// + public partial class ModelClient : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varClient + [JsonConstructor] + public ModelClient(Option varClient = default) + { + VarClientOption = varClient; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of VarClient + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarClientOption { get; private set; } + + /// + /// Gets or Sets VarClient + /// + [JsonPropertyName("client")] + public string VarClient { get { return this.VarClientOption; } set { this.VarClientOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ModelClient {\n"); + sb.Append(" VarClient: ").Append(VarClient).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ModelClientJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClient = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "client": + varClient = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (varClient.IsSet && varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); + + return new ModelClient(varClient); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, modelClient, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) + { + if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + + if (modelClient.VarClientOption.IsSet) + writer.WriteString("client", modelClient.VarClient); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs new file mode 100644 index 000000000000..db407f5e3553 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Name.cs @@ -0,0 +1,291 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name same as property name + /// + public partial class Name : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varName + /// property + /// snakeCase + /// var123Number + [JsonConstructor] + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) + { + VarName = varName; + PropertyOption = property; + SnakeCaseOption = snakeCase; + Var123NumberOption = var123Number; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets VarName + /// + [JsonPropertyName("name")] + public int VarName { get; set; } + + /// + /// Used to track the state of Property + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PropertyOption { get; private set; } + + /// + /// Gets or Sets Property + /// + [JsonPropertyName("property")] + public string Property { get { return this.PropertyOption; } set { this.PropertyOption = new(value); } } + + /// + /// Used to track the state of SnakeCase + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SnakeCaseOption { get; } + + /// + /// Gets or Sets SnakeCase + /// + [JsonPropertyName("snake_case")] + public int? SnakeCase { get { return this.SnakeCaseOption; } } + + /// + /// Used to track the state of Var123Number + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Var123NumberOption { get; } + + /// + /// Gets or Sets Var123Number + /// + [JsonPropertyName("123Number")] + public int? Var123Number { get { return this.Var123NumberOption; } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Name {\n"); + sb.Append(" VarName: ").Append(VarName).Append("\n"); + sb.Append(" Property: ").Append(Property).Append("\n"); + sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); + sb.Append(" Var123Number: ").Append(Var123Number).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as Name).AreEqual; + } + + /// + /// Returns true if Name instances are equal + /// + /// Instance of Name to be compared + /// Boolean + public bool Equals(Name input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (SnakeCase != null) + hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); + + if (Var123Number != null) + hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NameJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varName = new Option(utf8JsonReader.GetInt32()); + break; + case "property": + property = new Option(utf8JsonReader.GetString()); + break; + case "snake_case": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + snakeCase = new Option(utf8JsonReader.GetInt32()); + break; + case "123Number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + var123Number = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (!varName.IsSet) + throw new ArgumentException("Property is required for class Name.", nameof(varName)); + + if (varName.IsSet && varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); + + if (property.IsSet && property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); + + if (snakeCase.IsSet && snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); + + if (var123Number.IsSet && var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); + + return new Name(varName.Value.Value, property, snakeCase, var123Number); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, name, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) + { + if (name.PropertyOption.IsSet && name.Property == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + + writer.WriteNumber("name", name.VarName); + + if (name.PropertyOption.IsSet) + writer.WriteString("property", name.Property); + + if (name.SnakeCaseOption.IsSet) + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value.Value); + + if (name.Var123NumberOption.IsSet) + writer.WriteNumber("123Number", name.Var123NumberOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs new file mode 100644 index 000000000000..ea8abdda0d78 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -0,0 +1,192 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NotificationtestGetElementsV1ResponseMPayload + /// + public partial class NotificationtestGetElementsV1ResponseMPayload : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// aObjVariableobject + /// pkiNotificationtestID + [JsonConstructor] + public NotificationtestGetElementsV1ResponseMPayload(List> aObjVariableobject, int pkiNotificationtestID) + { + AObjVariableobject = aObjVariableobject; + PkiNotificationtestID = pkiNotificationtestID; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets AObjVariableobject + /// + [JsonPropertyName("a_objVariableobject")] + public List> AObjVariableobject { get; set; } + + /// + /// Gets or Sets PkiNotificationtestID + /// + [JsonPropertyName("pkiNotificationtestID")] + public int PkiNotificationtestID { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NotificationtestGetElementsV1ResponseMPayload {\n"); + sb.Append(" AObjVariableobject: ").Append(AObjVariableobject).Append("\n"); + sb.Append(" PkiNotificationtestID: ").Append(PkiNotificationtestID).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NotificationtestGetElementsV1ResponseMPayloadJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>> aObjVariableobject = default; + Option pkiNotificationtestID = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "a_objVariableobject": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "pkiNotificationtestID": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (!aObjVariableobject.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); + + if (!pkiNotificationtestID.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); + + if (aObjVariableobject.IsSet && aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value, pkiNotificationtestID.Value.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, notificationtestGetElementsV1ResponseMPayload, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) + { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + + writer.WritePropertyName("a_objVariableobject"); + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs new file mode 100644 index 000000000000..3b9f00ed6666 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableClass.cs @@ -0,0 +1,496 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NullableClass + /// + public partial class NullableClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayAndItemsNullableProp + /// arrayItemsNullable + /// arrayNullableProp + /// booleanProp + /// dateProp + /// datetimeProp + /// integerProp + /// numberProp + /// objectAndItemsNullableProp + /// objectItemsNullable + /// objectNullableProp + /// stringProp + [JsonConstructor] + public NullableClass(Option> arrayAndItemsNullableProp = default, Option> arrayItemsNullable = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectItemsNullable = default, Option> objectNullableProp = default, Option stringProp = default) + { + ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayItemsNullableOption = arrayItemsNullable; + ArrayNullablePropOption = arrayNullableProp; + BooleanPropOption = booleanProp; + DatePropOption = dateProp; + DatetimePropOption = datetimeProp; + IntegerPropOption = integerProp; + NumberPropOption = numberProp; + ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectItemsNullableOption = objectItemsNullable; + ObjectNullablePropOption = objectNullableProp; + StringPropOption = stringProp; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayAndItemsNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayAndItemsNullablePropOption { get; private set; } + + /// + /// Gets or Sets ArrayAndItemsNullableProp + /// + [JsonPropertyName("array_and_items_nullable_prop")] + public List ArrayAndItemsNullableProp { get { return this.ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } + + /// + /// Used to track the state of ArrayItemsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ArrayItemsNullable + /// + [JsonPropertyName("array_items_nullable")] + public List ArrayItemsNullable { get { return this.ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } + + /// + /// Used to track the state of ArrayNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayNullablePropOption { get; private set; } + + /// + /// Gets or Sets ArrayNullableProp + /// + [JsonPropertyName("array_nullable_prop")] + public List ArrayNullableProp { get { return this.ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } + + /// + /// Used to track the state of BooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BooleanPropOption { get; private set; } + + /// + /// Gets or Sets BooleanProp + /// + [JsonPropertyName("boolean_prop")] + public bool? BooleanProp { get { return this.BooleanPropOption; } set { this.BooleanPropOption = new(value); } } + + /// + /// Used to track the state of DateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DatePropOption { get; private set; } + + /// + /// Gets or Sets DateProp + /// + [JsonPropertyName("date_prop")] + public DateOnly? DateProp { get { return this.DatePropOption; } set { this.DatePropOption = new(value); } } + + /// + /// Used to track the state of DatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DatetimePropOption { get; private set; } + + /// + /// Gets or Sets DatetimeProp + /// + [JsonPropertyName("datetime_prop")] + public DateTime? DatetimeProp { get { return this.DatetimePropOption; } set { this.DatetimePropOption = new(value); } } + + /// + /// Used to track the state of IntegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntegerPropOption { get; private set; } + + /// + /// Gets or Sets IntegerProp + /// + [JsonPropertyName("integer_prop")] + public int? IntegerProp { get { return this.IntegerPropOption; } set { this.IntegerPropOption = new(value); } } + + /// + /// Used to track the state of NumberProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NumberPropOption { get; private set; } + + /// + /// Gets or Sets NumberProp + /// + [JsonPropertyName("number_prop")] + public decimal? NumberProp { get { return this.NumberPropOption; } set { this.NumberPropOption = new(value); } } + + /// + /// Used to track the state of ObjectAndItemsNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ObjectAndItemsNullablePropOption { get; private set; } + + /// + /// Gets or Sets ObjectAndItemsNullableProp + /// + [JsonPropertyName("object_and_items_nullable_prop")] + public Dictionary ObjectAndItemsNullableProp { get { return this.ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } + + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ObjectItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ObjectItemsNullable + /// + [JsonPropertyName("object_items_nullable")] + public Dictionary ObjectItemsNullable { get { return this.ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + + /// + /// Used to track the state of ObjectNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ObjectNullablePropOption { get; private set; } + + /// + /// Gets or Sets ObjectNullableProp + /// + [JsonPropertyName("object_nullable_prop")] + public Dictionary ObjectNullableProp { get { return this.ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } + + /// + /// Used to track the state of StringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringPropOption { get; private set; } + + /// + /// Gets or Sets StringProp + /// + [JsonPropertyName("string_prop")] + public string StringProp { get { return this.StringPropOption; } set { this.StringPropOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableClass {\n"); + sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append("\n"); + sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); + sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append("\n"); + sb.Append(" BooleanProp: ").Append(BooleanProp).Append("\n"); + sb.Append(" DateProp: ").Append(DateProp).Append("\n"); + sb.Append(" DatetimeProp: ").Append(DatetimeProp).Append("\n"); + sb.Append(" IntegerProp: ").Append(IntegerProp).Append("\n"); + sb.Append(" NumberProp: ").Append(NumberProp).Append("\n"); + sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n"); + sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); + sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n"); + sb.Append(" StringProp: ").Append(StringProp).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateProp + /// + public static string DatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize DatetimeProp + /// + public static string DatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> arrayAndItemsNullableProp = default; + Option> arrayItemsNullable = default; + Option> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option> objectAndItemsNullableProp = default; + Option> objectItemsNullable = default; + Option> objectNullableProp = default; + Option stringProp = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_and_items_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_items_nullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + booleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + integerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "number_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + numberProp = new Option(utf8JsonReader.GetDecimal()); + break; + case "object_and_items_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "object_items_nullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "object_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "string_prop": + stringProp = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (arrayItemsNullable.IsSet && arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); + + if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); + + return new NullableClass(arrayAndItemsNullableProp, arrayItemsNullable, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectItemsNullable, objectNullableProp, stringProp); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, nullableClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) + { + if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) + if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayItemsNullableOption.IsSet) + { + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } + if (nullableClass.ArrayNullablePropOption.IsSet) + if (nullableClass.ArrayNullablePropOption.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanPropOption.IsSet) + if (nullableClass.BooleanPropOption.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value.Value); + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DatePropOption.IsSet) + if (nullableClass.DatePropOption.Value != null) + writer.WriteString("date_prop", nullableClass.DatePropOption.Value.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimePropOption.IsSet) + if (nullableClass.DatetimePropOption.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerPropOption.IsSet) + if (nullableClass.IntegerPropOption.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value.Value); + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberPropOption.IsSet) + if (nullableClass.NumberPropOption.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value.Value); + else + writer.WriteNull("number_prop"); + + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) + if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectItemsNullableOption.IsSet) + { + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } + if (nullableClass.ObjectNullablePropOption.IsSet) + if (nullableClass.ObjectNullablePropOption.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringPropOption.IsSet) + if (nullableClass.StringPropOption.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp); + else + writer.WriteNull("string_prop"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs new file mode 100644 index 000000000000..5f369537bb2a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -0,0 +1,173 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NullableGuidClass + /// + public partial class NullableGuidClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// uuid + [JsonConstructor] + public NullableGuidClass(Option uuid = default) + { + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableGuidClass {\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableGuidClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + return new NullableGuidClass(uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, nullableGuidClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) + { + if (nullableGuidClass.UuidOption.IsSet) + if (nullableGuidClass.UuidOption.Value != null) + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value.Value); + else + writer.WriteNull("uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableShape.cs new file mode 100644 index 000000000000..9a93cb734e9c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NullableShape.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// 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. + /// + public partial class NullableShape : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public NullableShape(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public NullableShape(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableShape {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableShapeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral quadrilateral = null; + Triangle triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("shapeType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("Quadrilateral")) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator.Equals("Triangle")) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); + + if (quadrilateral != null) + return new NullableShape(quadrilateral); + + if (triangle != null) + return new NullableShape(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (nullableShape.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, nullableShape.Triangle, jsonSerializerOptions); + } + + if (nullableShape.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, nullableShape.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, nullableShape, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs new file mode 100644 index 000000000000..f720208fafe0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -0,0 +1,172 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NumberOnly + /// + public partial class NumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// justNumber + [JsonConstructor] + public NumberOnly(Option justNumber = default) + { + JustNumberOption = justNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of JustNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option JustNumberOption { get; private set; } + + /// + /// Gets or Sets JustNumber + /// + [JsonPropertyName("JustNumber")] + public decimal? JustNumber { get { return this.JustNumberOption; } set { this.JustNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NumberOnly {\n"); + sb.Append(" JustNumber: ").Append(JustNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option justNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "JustNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + justNumber = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (justNumber.IsSet && justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); + + return new NumberOnly(justNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, numberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (numberOnly.JustNumberOption.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs new file mode 100644 index 000000000000..50ad5aef5a1b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -0,0 +1,268 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ObjectWithDeprecatedFields + /// + public partial class ObjectWithDeprecatedFields : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bars + /// deprecatedRef + /// id + /// uuid + [JsonConstructor] + public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) + { + BarsOption = bars; + DeprecatedRefOption = deprecatedRef; + IdOption = id; + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bars + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> BarsOption { get; private set; } + + /// + /// Gets or Sets Bars + /// + [JsonPropertyName("bars")] + [Obsolete] + public List Bars { get { return this.BarsOption; } set { this.BarsOption = new(value); } } + + /// + /// Used to track the state of DeprecatedRef + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeprecatedRefOption { get; private set; } + + /// + /// Gets or Sets DeprecatedRef + /// + [JsonPropertyName("deprecatedRef")] + [Obsolete] + public DeprecatedObject DeprecatedRef { get { return this.DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + [Obsolete] + public decimal? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + [JsonPropertyName("uuid")] + public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ObjectWithDeprecatedFields {\n"); + sb.Append(" Bars: ").Append(Bars).Append("\n"); + sb.Append(" DeprecatedRef: ").Append(DeprecatedRef).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ObjectWithDeprecatedFieldsJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bars": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "deprecatedRef": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetDecimal()); + break; + case "uuid": + uuid = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (bars.IsSet && bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (deprecatedRef.IsSet && deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); + + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, objectWithDeprecatedFields, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) + { + if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.BarsOption.IsSet) + { + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + } + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) + { + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + } + if (objectWithDeprecatedFields.IdOption.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); + + if (objectWithDeprecatedFields.UuidOption.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OneOfString.cs new file mode 100644 index 000000000000..c89963f55a36 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OneOfString.cs @@ -0,0 +1,157 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// OneOfString + /// + public partial class OneOfString : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + internal OneOfString(string @string) + { + String = @string; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets String + /// + public string String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OneOfString {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OneOfStringJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string varString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varString != null) + return new OneOfString(varString); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, oneOfString, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs new file mode 100644 index 000000000000..c9c24d32fc40 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Order.cs @@ -0,0 +1,317 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Order + /// + public partial class Order : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// complete (default to false) + /// id + /// petId + /// quantity + /// shipDate + /// status + [JsonConstructor] + public Order(Option complete = default, Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default) + { + CompleteOption = complete; + IdOption = id; + PetIdOption = petId; + QuantityOption = quantity; + ShipDateOption = shipDate; + StatusOption = status; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// Gets or Sets Status + /// + [JsonPropertyName("status")] + public OrderStatus? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CompleteOption { get; private set; } + + /// + /// Gets or Sets Complete + /// + [JsonPropertyName("complete")] + public bool? Complete { get { return this.CompleteOption; } set { this.CompleteOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of PetId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PetIdOption { get; private set; } + + /// + /// Gets or Sets PetId + /// + [JsonPropertyName("petId")] + public long? PetId { get { return this.PetIdOption; } set { this.PetIdOption = new(value); } } + + /// + /// Used to track the state of Quantity + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QuantityOption { get; private set; } + + /// + /// Gets or Sets Quantity + /// + [JsonPropertyName("quantity")] + public int? Quantity { get { return this.QuantityOption; } set { this.QuantityOption = new(value); } } + + /// + /// Used to track the state of ShipDate + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShipDateOption { get; private set; } + + /// + /// Gets or Sets ShipDate + /// + /* 2020-02-02T20:20:20.000222Z */ + [JsonPropertyName("shipDate")] + public DateTime? ShipDate { get { return this.ShipDateOption; } set { this.ShipDateOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Order {\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" PetId: ").Append(PetId).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OrderJsonConverter : JsonConverter + { + /// + /// The format to use to serialize ShipDate + /// + public static string ShipDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "complete": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + complete = new Option(utf8JsonReader.GetBoolean()); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "petId": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + petId = new Option(utf8JsonReader.GetInt64()); + break; + case "quantity": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + quantity = new Option(utf8JsonReader.GetInt32()); + break; + case "shipDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "status": + string statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(OrderStatusValueConverter.FromStringOrDefault(statusRawValue)); + break; + default: + break; + } + } + } + + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); + + if (petId.IsSet && petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); + + if (quantity.IsSet && quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); + + if (shipDate.IsSet && shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); + + return new Order(complete, id, petId, quantity, shipDate, status); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, order, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) + { + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value.Value); + + if (order.IdOption.IsSet) + writer.WriteNumber("id", order.IdOption.Value.Value); + + if (order.PetIdOption.IsSet) + writer.WriteNumber("petId", order.PetIdOption.Value.Value); + + if (order.QuantityOption.IsSet) + writer.WriteNumber("quantity", order.QuantityOption.Value.Value); + + if (order.ShipDateOption.IsSet) + writer.WriteString("shipDate", order.ShipDateOption.Value.Value.ToString(ShipDateFormat)); + + if (order.StatusOption.IsSet) + { + var statusRawValue = OrderStatusValueConverter.ToJsonValue(order.Status.Value); + writer.WriteString("status", statusRawValue); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OrderStatus.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OrderStatus.cs new file mode 100644 index 000000000000..6566ca4aa564 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OrderStatus.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Order Status + /// + /// Order Status + public enum OrderStatus + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class OrderStatusValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OrderStatus FromString(string value) + { + if (value.Equals("placed")) + return OrderStatus.Placed; + + if (value.Equals("approved")) + return OrderStatus.Approved; + + if (value.Equals("delivered")) + return OrderStatus.Delivered; + + throw new NotImplementedException($"Could not convert value to type OrderStatus: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OrderStatus? FromStringOrDefault(string value) + { + if (value.Equals("placed")) + return OrderStatus.Placed; + + if (value.Equals("approved")) + return OrderStatus.Approved; + + if (value.Equals("delivered")) + return OrderStatus.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OrderStatus value) + { + if (value == OrderStatus.Placed) + return "placed"; + + if (value == OrderStatus.Approved) + return "approved"; + + if (value == OrderStatus.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OrderStatusJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OrderStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OrderStatus? result = rawValue == null + ? null + : OrderStatusValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OrderStatus to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OrderStatus orderStatus, JsonSerializerOptions options) + { + writer.WriteStringValue(orderStatus.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OrderStatusNullableJsonConverter : JsonConverter + { + /// + /// Returns a OrderStatus from the Json object + /// + /// + /// + /// + /// + public override OrderStatus? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OrderStatus? result = rawValue == null + ? null + : OrderStatusValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OrderStatus? orderStatus, JsonSerializerOptions options) + { + writer.WriteStringValue(orderStatus?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs new file mode 100644 index 000000000000..5a072449fae0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -0,0 +1,228 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// OuterComposite + /// + public partial class OuterComposite : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// myBoolean + /// myNumber + /// myString + [JsonConstructor] + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) + { + MyBooleanOption = myBoolean; + MyNumberOption = myNumber; + MyStringOption = myString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of MyBoolean + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyBooleanOption { get; private set; } + + /// + /// Gets or Sets MyBoolean + /// + [JsonPropertyName("my_boolean")] + public bool? MyBoolean { get { return this.MyBooleanOption; } set { this.MyBooleanOption = new(value); } } + + /// + /// Used to track the state of MyNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyNumberOption { get; private set; } + + /// + /// Gets or Sets MyNumber + /// + [JsonPropertyName("my_number")] + public decimal? MyNumber { get { return this.MyNumberOption; } set { this.MyNumberOption = new(value); } } + + /// + /// Used to track the state of MyString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyStringOption { get; private set; } + + /// + /// Gets or Sets MyString + /// + [JsonPropertyName("my_string")] + public string MyString { get { return this.MyStringOption; } set { this.MyStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OuterComposite {\n"); + sb.Append(" MyBoolean: ").Append(MyBoolean).Append("\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); + sb.Append(" MyString: ").Append(MyString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OuterCompositeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option myBoolean = default; + Option myNumber = default; + Option myString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "my_boolean": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + myBoolean = new Option(utf8JsonReader.GetBoolean()); + break; + case "my_number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + myNumber = new Option(utf8JsonReader.GetDecimal()); + break; + case "my_string": + myString = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (myBoolean.IsSet && myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); + + if (myNumber.IsSet && myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); + + if (myString.IsSet && myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); + + return new OuterComposite(myBoolean, myNumber, myString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, outerComposite, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) + { + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + + if (outerComposite.MyBooleanOption.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); + + if (outerComposite.MyNumberOption.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value.Value); + + if (outerComposite.MyStringOption.IsSet) + writer.WriteString("my_string", outerComposite.MyString); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnum.cs new file mode 100644 index 000000000000..47bb6793c6ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnum + /// + public enum OuterEnum + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnum FromString(string value) + { + if (value.Equals("placed")) + return OuterEnum.Placed; + + if (value.Equals("approved")) + return OuterEnum.Approved; + + if (value.Equals("delivered")) + return OuterEnum.Delivered; + + throw new NotImplementedException($"Could not convert value to type OuterEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnum? FromStringOrDefault(string value) + { + if (value.Equals("placed")) + return OuterEnum.Placed; + + if (value.Equals("approved")) + return OuterEnum.Approved; + + if (value.Equals("delivered")) + return OuterEnum.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnum value) + { + if (value == OuterEnum.Placed) + return "placed"; + + if (value == OuterEnum.Approved) + return "approved"; + + if (value == OuterEnum.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnum? result = rawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnum outerEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnum.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnum from the Json object + /// + /// + /// + /// + /// + public override OuterEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnum? result = rawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnum? outerEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnum?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs new file mode 100644 index 000000000000..136fb4c54c4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumDefaultValue + /// + public enum OuterEnumDefaultValue + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumDefaultValueValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumDefaultValue FromString(string value) + { + if (value.Equals("placed")) + return OuterEnumDefaultValue.Placed; + + if (value.Equals("approved")) + return OuterEnumDefaultValue.Approved; + + if (value.Equals("delivered")) + return OuterEnumDefaultValue.Delivered; + + throw new NotImplementedException($"Could not convert value to type OuterEnumDefaultValue: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumDefaultValue? FromStringOrDefault(string value) + { + if (value.Equals("placed")) + return OuterEnumDefaultValue.Placed; + + if (value.Equals("approved")) + return OuterEnumDefaultValue.Approved; + + if (value.Equals("delivered")) + return OuterEnumDefaultValue.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnumDefaultValue value) + { + if (value == OuterEnumDefaultValue.Placed) + return "placed"; + + if (value == OuterEnumDefaultValue.Approved) + return "approved"; + + if (value == OuterEnumDefaultValue.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumDefaultValueJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumDefaultValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumDefaultValue? result = rawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumDefaultValue to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumDefaultValue outerEnumDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumDefaultValue.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumDefaultValueNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumDefaultValue from the Json object + /// + /// + /// + /// + /// + public override OuterEnumDefaultValue? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumDefaultValue? result = rawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumDefaultValue? outerEnumDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumDefaultValue?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumInteger.cs new file mode 100644 index 000000000000..2ed4f18a657e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumInteger + /// + public enum OuterEnumInteger + { + /// + /// Enum NUMBER_0 for value: 0 + /// + NUMBER_0 = 0, + + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumIntegerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumInteger FromString(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumInteger.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumInteger.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumInteger.NUMBER_2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumInteger: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumInteger? FromStringOrDefault(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumInteger.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumInteger.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumInteger.NUMBER_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(OuterEnumInteger value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumIntegerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumInteger Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumInteger? result = rawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumInteger to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumInteger outerEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumInteger.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumIntegerNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumInteger from the Json object + /// + /// + /// + /// + /// + public override OuterEnumInteger? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumInteger? result = rawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumInteger? outerEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumInteger?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs new file mode 100644 index 000000000000..c6a470cc64d1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumIntegerDefaultValue + /// + public enum OuterEnumIntegerDefaultValue + { + /// + /// Enum NUMBER_0 for value: 0 + /// + NUMBER_0 = 0, + + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumIntegerDefaultValueValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumIntegerDefaultValue FromString(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumIntegerDefaultValue: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumIntegerDefaultValue? FromStringOrDefault(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(OuterEnumIntegerDefaultValue value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumIntegerDefaultValueJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumIntegerDefaultValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumIntegerDefaultValue? result = rawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumIntegerDefaultValue to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumIntegerDefaultValue.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumIntegerDefaultValueNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumIntegerDefaultValue from the Json object + /// + /// + /// + /// + /// + public override OuterEnumIntegerDefaultValue? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumIntegerDefaultValue? result = rawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumIntegerDefaultValue?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumTest.cs new file mode 100644 index 000000000000..a2e789f2edef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -0,0 +1,258 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines Outer_Enum_Test + /// + public enum OuterEnumTest + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumTestValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumTest FromString(string value) + { + if (value.Equals("UPPER")) + return OuterEnumTest.UPPER; + + if (value.Equals("lower")) + return OuterEnumTest.Lower; + + if (value.Equals("")) + return OuterEnumTest.Empty; + + if (value.Equals("Value\twith tab")) + return OuterEnumTest.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return OuterEnumTest.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return OuterEnumTest.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return OuterEnumTest.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return OuterEnumTest.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumTest: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumTest? FromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return OuterEnumTest.UPPER; + + if (value.Equals("lower")) + return OuterEnumTest.Lower; + + if (value.Equals("")) + return OuterEnumTest.Empty; + + if (value.Equals("Value\twith tab")) + return OuterEnumTest.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return OuterEnumTest.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return OuterEnumTest.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return OuterEnumTest.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return OuterEnumTest.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnumTest value) + { + if (value == OuterEnumTest.UPPER) + return "UPPER"; + + if (value == OuterEnumTest.Lower) + return "lower"; + + if (value == OuterEnumTest.Empty) + return ""; + + if (value == OuterEnumTest.ValuewithTab) + return "Value\twith tab"; + + if (value == OuterEnumTest.ValueWithQuote) + return "Value with \" quote"; + + if (value == OuterEnumTest.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == OuterEnumTest.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == OuterEnumTest.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumTestJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumTest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumTest? result = rawValue == null + ? null + : OuterEnumTestValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumTest to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumTest outerEnumTest, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumTest.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumTestNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumTest from the Json object + /// + /// + /// + /// + /// + public override OuterEnumTest? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumTest? result = rawValue == null + ? null + : OuterEnumTestValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumTest? outerEnumTest, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumTest?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ParentPet.cs new file mode 100644 index 000000000000..83104e900d01 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ParentPet.cs @@ -0,0 +1,158 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ParentPet + /// + public partial class ParentPet : GrandparentAnimal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructor] + public ParentPet() : base() + { + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string PetType { get; } = "ParentPet"; + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ParentPet {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class ParentPetJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option petType = default; + + string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type"); + + if (discriminator != null && discriminator.Equals("ChildCat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pet_type": + petType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + return new ParentPet(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) + { + if (parentPet is ChildCat childCat){ + JsonSerializer.Serialize(writer, childCat, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, parentPet, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("pet_type", parentPet.PetType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs new file mode 100644 index 000000000000..6b354389b24a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pet.cs @@ -0,0 +1,317 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Pet + /// + public partial class Pet : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + /// photoUrls + /// category + /// id + /// status + /// tags + [JsonConstructor] + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) + { + Name = name; + PhotoUrls = photoUrls; + CategoryOption = category; + IdOption = id; + StatusOption = status; + TagsOption = tags; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// Gets or Sets Status + /// + [JsonPropertyName("status")] + public PetStatus? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Gets or Sets Name + /// + /* doggie */ + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or Sets PhotoUrls + /// + [JsonPropertyName("photoUrls")] + public List PhotoUrls { get; set; } + + /// + /// Used to track the state of Category + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CategoryOption { get; private set; } + + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Category Category { get { return this.CategoryOption; } set { this.CategoryOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Tags + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> TagsOption { get; private set; } + + /// + /// Gets or Sets Tags + /// + [JsonPropertyName("tags")] + public List Tags { get { return this.TagsOption; } set { this.TagsOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Pet {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Tags: ").Append(Tags).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PetJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + Option> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option> tags = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + case "photoUrls": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "status": + string statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(PetStatusValueConverter.FromStringOrDefault(statusRawValue)); + break; + case "tags": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (!name.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(name)); + + if (!photoUrls.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); + + if (photoUrls.IsSet && photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); + + if (category.IsSet && category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + + if (tags.IsSet && tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + + return new Pet(name.Value, photoUrls.Value, category, id, status, tags); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, pet, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) + { + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.CategoryOption.IsSet && pet.Category == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + + if (pet.TagsOption.IsSet && pet.Tags == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + + writer.WriteString("name", pet.Name); + + writer.WritePropertyName("photoUrls"); + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.CategoryOption.IsSet) + { + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + } + if (pet.IdOption.IsSet) + writer.WriteNumber("id", pet.IdOption.Value.Value); + + if (pet.StatusOption.IsSet) + { + var statusRawValue = PetStatusValueConverter.ToJsonValue(pet.Status.Value); + writer.WriteString("status", statusRawValue); + } + if (pet.TagsOption.IsSet) + { + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/PetStatus.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/PetStatus.cs new file mode 100644 index 000000000000..9e19b612bf97 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/PetStatus.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// pet status in the store + /// + /// pet status in the store + public enum PetStatus + { + /// + /// Enum Available for value: available + /// + Available = 1, + + /// + /// Enum Pending for value: pending + /// + Pending = 2, + + /// + /// Enum Sold for value: sold + /// + Sold = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class PetStatusValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static PetStatus FromString(string value) + { + if (value.Equals("available")) + return PetStatus.Available; + + if (value.Equals("pending")) + return PetStatus.Pending; + + if (value.Equals("sold")) + return PetStatus.Sold; + + throw new NotImplementedException($"Could not convert value to type PetStatus: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static PetStatus? FromStringOrDefault(string value) + { + if (value.Equals("available")) + return PetStatus.Available; + + if (value.Equals("pending")) + return PetStatus.Pending; + + if (value.Equals("sold")) + return PetStatus.Sold; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(PetStatus value) + { + if (value == PetStatus.Available) + return "available"; + + if (value == PetStatus.Pending) + return "pending"; + + if (value == PetStatus.Sold) + return "sold"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class PetStatusJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override PetStatus Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + PetStatus? result = rawValue == null + ? null + : PetStatusValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the PetStatus to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, PetStatus petStatus, JsonSerializerOptions options) + { + writer.WriteStringValue(petStatus.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class PetStatusNullableJsonConverter : JsonConverter + { + /// + /// Returns a PetStatus from the Json object + /// + /// + /// + /// + /// + public override PetStatus? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + PetStatus? result = rawValue == null + ? null + : PetStatusValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, PetStatus? petStatus, JsonSerializerOptions options) + { + writer.WriteStringValue(petStatus?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pig.cs new file mode 100644 index 000000000000..b6f300c94400 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Pig.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Pig + /// + public partial class Pig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Pig(BasquePig basquePig) + { + BasquePig = basquePig; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Pig(DanishPig danishPig) + { + DanishPig = danishPig; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets BasquePig + /// + public BasquePig BasquePig { get; set; } + + /// + /// Gets or Sets DanishPig + /// + public DanishPig DanishPig { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Pig {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + BasquePig basquePig = null; + DanishPig danishPig = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("className")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("BasquePig")) + { + Utf8JsonReader utf8JsonReaderBasquePig = utf8JsonReader; + basquePig = JsonSerializer.Deserialize(ref utf8JsonReaderBasquePig, jsonSerializerOptions); + } + if (discriminator.Equals("DanishPig")) + { + Utf8JsonReader utf8JsonReaderDanishPig = utf8JsonReader; + danishPig = JsonSerializer.Deserialize(ref utf8JsonReaderDanishPig, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Pig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); + + if (basquePig != null) + return new Pig(basquePig); + + if (danishPig != null) + return new Pig(danishPig); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (pig.BasquePig != null) + { + BasquePigJsonConverter basquePigJsonConverter = (BasquePigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.BasquePig.GetType())); + basquePigJsonConverter.WriteProperties(writer, pig.BasquePig, jsonSerializerOptions); + } + + if (pig.DanishPig != null) + { + DanishPigJsonConverter danishPigJsonConverter = (DanishPigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.DanishPig.GetType())); + danishPigJsonConverter.WriteProperties(writer, pig.DanishPig, jsonSerializerOptions); + } + + WriteProperties(writer, pig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/PolymorphicProperty.cs new file mode 100644 index 000000000000..ddea47edf40c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// PolymorphicProperty + /// + public partial class PolymorphicProperty : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(bool @bool) + { + Bool = @bool; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(string @string) + { + String = @string; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(Object @object) + { + Object = @object; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(List list) + { + List = list; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get; set; } + + /// + /// Gets or Sets String + /// + public string String { get; set; } + + /// + /// Gets or Sets Object + /// + public Object Object { get; set; } + + /// + /// Gets or Sets List + /// + public List List { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PolymorphicProperty {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PolymorphicPropertyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + bool? varBool = default; + string varString = default; + Object varObject = default; + List list = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderObject = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderObject, jsonSerializerOptions, out varObject); + + Utf8JsonReader utf8JsonReaderList = utf8JsonReader; + ClientUtils.TryDeserialize>(ref utf8JsonReaderList, jsonSerializerOptions, out list); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varBool != null) + return new PolymorphicProperty(varBool.Value); + + if (varString != null) + return new PolymorphicProperty(varString); + + if (varObject != null) + return new PolymorphicProperty(varObject); + + if (list != null) + return new PolymorphicProperty(list); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, polymorphicProperty, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Quadrilateral.cs new file mode 100644 index 000000000000..e8a2e2439975 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Quadrilateral + /// + public partial class Quadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Quadrilateral(SimpleQuadrilateral simpleQuadrilateral) + { + SimpleQuadrilateral = simpleQuadrilateral; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Quadrilateral(ComplexQuadrilateral complexQuadrilateral) + { + ComplexQuadrilateral = complexQuadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets SimpleQuadrilateral + /// + public SimpleQuadrilateral SimpleQuadrilateral { get; set; } + + /// + /// Gets or Sets ComplexQuadrilateral + /// + public ComplexQuadrilateral ComplexQuadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Quadrilateral {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class QuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + + ComplexQuadrilateral complexQuadrilateral = null; + SimpleQuadrilateral simpleQuadrilateral = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("quadrilateralType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("ComplexQuadrilateral")) + { + Utf8JsonReader utf8JsonReaderComplexQuadrilateral = utf8JsonReader; + complexQuadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderComplexQuadrilateral, jsonSerializerOptions); + } + if (discriminator.Equals("SimpleQuadrilateral")) + { + Utf8JsonReader utf8JsonReaderSimpleQuadrilateral = utf8JsonReader; + simpleQuadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderSimpleQuadrilateral, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); + + if (complexQuadrilateral != null) + return new Quadrilateral(complexQuadrilateral); + + if (simpleQuadrilateral != null) + return new Quadrilateral(simpleQuadrilateral); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (quadrilateral.SimpleQuadrilateral != null) + { + SimpleQuadrilateralJsonConverter simpleQuadrilateralJsonConverter = (SimpleQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.SimpleQuadrilateral.GetType())); + simpleQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.SimpleQuadrilateral, jsonSerializerOptions); + } + + if (quadrilateral.ComplexQuadrilateral != null) + { + ComplexQuadrilateralJsonConverter complexQuadrilateralJsonConverter = (ComplexQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.ComplexQuadrilateral.GetType())); + complexQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.ComplexQuadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, quadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs new file mode 100644 index 000000000000..519ed66393ca --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// QuadrilateralInterface + /// + public partial class QuadrilateralInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + [JsonConstructor] + public QuadrilateralInterface(string quadrilateralType) + { + QuadrilateralType = quadrilateralType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class QuadrilateralInterface {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class QuadrilateralInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + return new QuadrilateralInterface(quadrilateralType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, quadrilateralInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs new file mode 100644 index 000000000000..b1907fda8183 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ReadOnlyFirst + /// + public partial class ReadOnlyFirst : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar + /// baz + [JsonConstructor] + public ReadOnlyFirst(Option bar = default, Option baz = default) + { + BarOption = bar; + BazOption = baz; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string Bar { get { return this.BarOption; } } + + /// + /// Used to track the state of Baz + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BazOption { get; private set; } + + /// + /// Gets or Sets Baz + /// + [JsonPropertyName("baz")] + public string Baz { get { return this.BazOption; } set { this.BazOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ReadOnlyFirst {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Baz: ").Append(Baz).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ReadOnlyFirst).AreEqual; + } + + /// + /// Returns true if ReadOnlyFirst instances are equal + /// + /// Instance of ReadOnlyFirst to be compared + /// Boolean + public bool Equals(ReadOnlyFirst input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ReadOnlyFirstJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + Option baz = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()); + break; + case "baz": + baz = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); + + if (baz.IsSet && baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); + + return new ReadOnlyFirst(bar, baz); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, readOnlyFirst, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) + { + if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BarOption.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar); + + if (readOnlyFirst.BazOption.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..6465301de4d0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1335 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + [JsonConstructor] + public RequiredClass(DateOnly requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredClassRequiredNotnullableEnumInteger requiredNotnullableEnumInteger, RequiredClassRequiredNotnullableEnumIntegerOnly requiredNotnullableEnumIntegerOnly, RequiredClassRequiredNotnullableEnumString requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateOnly? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredClassRequiredNullableEnumInteger? requiredNullableEnumInteger = default, RequiredClassRequiredNullableEnumIntegerOnly? requiredNullableEnumIntegerOnly = default, RequiredClassRequiredNullableEnumString? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; + NotRequiredNullableDatePropOption = notRequiredNullableDateProp; + NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; + NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumIntegerOption = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnlyOption = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumStringOption = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValueOption = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringPropOption = notrequiredNullableStringProp; + NotrequiredNullableUuidOption = notrequiredNullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredClassRequiredNotnullableEnumInteger RequiredNotnullableEnumInteger { get; set; } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredClassRequiredNotnullableEnumIntegerOnly RequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredClassRequiredNotnullableEnumString RequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Used to track the state of NotrequiredNotnullableEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public RequiredClassRequiredNotnullableEnumInteger? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public RequiredClassRequiredNotnullableEnumIntegerOnly? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public RequiredClassRequiredNotnullableEnumString? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public RequiredClassRequiredNullableEnumInteger? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableEnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public RequiredClassRequiredNullableEnumIntegerOnly? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public RequiredClassRequiredNullableEnumString? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredClassRequiredNullableEnumInteger? RequiredNullableEnumInteger { get; set; } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredClassRequiredNullableEnumIntegerOnly? RequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredClassRequiredNullableEnumString? RequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateOnly RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Used to track the state of NotRequiredNotnullableDateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNotnullableDatePropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateOnly? NotRequiredNotnullableDateProp { get { return this.NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNotnullableintegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNotnullableintegerPropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this.NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNullableDateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNullableDatePropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public DateOnly? NotRequiredNullableDateProp { get { return this.NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNullableIntegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNullableIntegerPropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this.NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List NotrequiredNotnullableArrayOfString { get { return this.NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableBooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this.NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this.NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableStringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableStringPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string NotrequiredNotnullableStringProp { get { return this.NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableUuidOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this.NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> NotrequiredNullableArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public List NotrequiredNullableArrayOfString { get { return this.NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableBooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableBooleanPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public bool? NotrequiredNullableBooleanProp { get { return this.NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableDatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableDatetimePropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public DateTime? NotrequiredNullableDatetimeProp { get { return this.NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableStringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableStringPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public string NotrequiredNullableStringProp { get { return this.NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableUuidOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("notrequired_nullable_uuid")] + public Guid? NotrequiredNullableUuid { get { return this.NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateOnly? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + Option> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_enum_integer": + string requiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumIntegerRawValue != null) + requiredNotnullableEnumInteger = new Option(RequiredClassRequiredNotnullableEnumIntegerValueConverter.FromStringOrDefault(requiredNotnullableEnumIntegerRawValue)); + break; + case "required_notnullable_enum_integer_only": + string requiredNotnullableEnumIntegerOnlyRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumIntegerOnlyRawValue != null) + requiredNotnullableEnumIntegerOnly = new Option(RequiredClassRequiredNotnullableEnumIntegerOnlyValueConverter.FromStringOrDefault(requiredNotnullableEnumIntegerOnlyRawValue)); + break; + case "required_notnullable_enum_string": + string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClassRequiredNotnullableEnumStringValueConverter.FromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_enum_integer": + string notrequiredNotnullableEnumIntegerRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumIntegerRawValue != null) + notrequiredNotnullableEnumInteger = new Option(RequiredClassRequiredNotnullableEnumIntegerValueConverter.FromStringOrDefault(notrequiredNotnullableEnumIntegerRawValue)); + break; + case "notrequired_notnullable_enum_integer_only": + string notrequiredNotnullableEnumIntegerOnlyRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumIntegerOnlyRawValue != null) + notrequiredNotnullableEnumIntegerOnly = new Option(RequiredClassRequiredNotnullableEnumIntegerOnlyValueConverter.FromStringOrDefault(notrequiredNotnullableEnumIntegerOnlyRawValue)); + break; + case "notrequired_notnullable_enum_string": + string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClassRequiredNotnullableEnumStringValueConverter.FromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_enum_integer": + string notrequiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumIntegerRawValue != null) + notrequiredNullableEnumInteger = new Option(RequiredClassRequiredNullableEnumIntegerValueConverter.FromStringOrDefault(notrequiredNullableEnumIntegerRawValue)); + break; + case "notrequired_nullable_enum_integer_only": + string notrequiredNullableEnumIntegerOnlyRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumIntegerOnlyRawValue != null) + notrequiredNullableEnumIntegerOnly = new Option(RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.FromStringOrDefault(notrequiredNullableEnumIntegerOnlyRawValue)); + break; + case "notrequired_nullable_enum_string": + string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClassRequiredNullableEnumStringValueConverter.FromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_enum_integer": + string requiredNullableEnumIntegerRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumIntegerRawValue != null) + requiredNullableEnumInteger = new Option(RequiredClassRequiredNullableEnumIntegerValueConverter.FromStringOrDefault(requiredNullableEnumIntegerRawValue)); + break; + case "required_nullable_enum_integer_only": + string requiredNullableEnumIntegerOnlyRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumIntegerOnlyRawValue != null) + requiredNullableEnumIntegerOnly = new Option(RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.FromStringOrDefault(requiredNullableEnumIntegerOnlyRawValue)); + break; + case "required_nullable_enum_string": + string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClassRequiredNullableEnumStringValueConverter.FromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); + + if (requiredNotNullableDateProp.IsSet && requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.IsSet && requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.IsSet && requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.IsSet && requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.IsSet && requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.IsSet && requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.IsSet && requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.IsSet && requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.IsSet && requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.IsSet && requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.IsSet && requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.IsSet && notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.IsSet && notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.IsSet && notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.IsSet && notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.IsSet && notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.IsSet && notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.IsSet && notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.IsSet && notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.IsSet && notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.IsSet && notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); + + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); + + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); + + var requiredNotnullableEnumIntegerRawValue = RequiredClassRequiredNotnullableEnumIntegerValueConverter.ToJsonValue(requiredClass.RequiredNotnullableEnumInteger); + writer.WriteNumber("required_notnullable_enum_integer", requiredNotnullableEnumIntegerRawValue); + + var requiredNotnullableEnumIntegerOnlyRawValue = RequiredClassRequiredNotnullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly); + writer.WriteNumber("required_notnullable_enum_integer_only", requiredNotnullableEnumIntegerOnlyRawValue); + + var requiredNotnullableEnumStringRawValue = RequiredClassRequiredNotnullableEnumStringValueConverter.ToJsonValue(requiredClass.RequiredNotnullableEnumString); + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); + + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); + + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); + + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); + + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) + if (requiredClass.NotRequiredNullableDatePropOption.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); + + if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) + if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + { + var notrequiredNotnullableEnumIntegerRawValue = RequiredClassRequiredNotnullableEnumIntegerValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value); + writer.WriteNumber("notrequired_notnullable_enum_integer", notrequiredNotnullableEnumIntegerRawValue); + } + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + { + var notrequiredNotnullableEnumIntegerOnlyRawValue = RequiredClassRequiredNotnullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value); + writer.WriteNumber("notrequired_notnullable_enum_integer_only", notrequiredNotnullableEnumIntegerOnlyRawValue); + } + if (requiredClass.NotrequiredNotnullableEnumStringOption.IsSet) + { + var notrequiredNotnullableEnumStringRawValue = RequiredClassRequiredNotnullableEnumStringValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + } + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); + + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) + if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) + if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + + if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) + if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + + if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) + { + var notrequiredNullableEnumIntegerRawValue = RequiredClassRequiredNullableEnumIntegerValueConverter.ToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value.Value); + writer.WriteNumber("notrequired_nullable_enum_integer", notrequiredNullableEnumIntegerRawValue); + } + else + writer.WriteNull("notrequired_nullable_enum_integer"); + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) + { + var notrequiredNullableEnumIntegerOnlyRawValue = RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value.Value); + writer.WriteNumber("notrequired_nullable_enum_integer_only", notrequiredNullableEnumIntegerOnlyRawValue); + } + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + if (requiredClass.NotrequiredNullableEnumStringOption.IsSet) + if (requiredClass.NotrequiredNullableEnumStringOption.Value != null) + { + var notrequiredNullableEnumStringRawValue = RequiredClassRequiredNullableEnumStringValueConverter.ToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value.Value); + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + } + else + writer.WriteNull("notrequired_nullable_enum_string"); + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value != null) + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value.Value); + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringPropOption.IsSet) + if (requiredClass.NotrequiredNullableStringPropOption.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); + else + writer.WriteNull("notrequired_nullable_string_prop"); + + if (requiredClass.NotrequiredNullableUuidOption.IsSet) + if (requiredClass.NotrequiredNullableUuidOption.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value.Value); + else + writer.WriteNull("notrequired_nullable_uuid"); + + if (requiredClass.RequiredNullableArrayOfString != null) + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); + + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); + + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); + + if (requiredClass.RequiredNullableEnumInteger == null) + writer.WriteNull("required_nullable_enum_integer"); + else + { + var requiredNullableEnumIntegerRawValue = RequiredClassRequiredNullableEnumIntegerValueConverter.ToJsonValue(requiredClass.RequiredNullableEnumInteger.Value); + writer.WriteNumber("required_nullable_enum_integer", requiredNullableEnumIntegerRawValue); + } + + if (requiredClass.RequiredNullableEnumIntegerOnly == null) + writer.WriteNull("required_nullable_enum_integer_only"); + else + { + var requiredNullableEnumIntegerOnlyRawValue = RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.ToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value); + writer.WriteNumber("required_nullable_enum_integer_only", requiredNullableEnumIntegerOnlyRawValue); + } + + if (requiredClass.RequiredNullableEnumString == null) + writer.WriteNull("required_nullable_enum_string"); + else + { + var requiredNullableEnumStringRawValue = RequiredClassRequiredNullableEnumStringValueConverter.ToJsonValue(requiredClass.RequiredNullableEnumString.Value); + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + } + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); + + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); + + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumInteger.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumInteger.cs new file mode 100644 index 000000000000..04988ef3ee99 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumInteger.cs @@ -0,0 +1,168 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines RequiredClass_required_notnullable_enum_integer + /// + public enum RequiredClassRequiredNotnullableEnumInteger + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Converts to and from the JSON value + /// + public static class RequiredClassRequiredNotnullableEnumIntegerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNotnullableEnumInteger FromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredClassRequiredNotnullableEnumInteger.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredClassRequiredNotnullableEnumInteger.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredClassRequiredNotnullableEnumInteger: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNotnullableEnumInteger? FromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredClassRequiredNotnullableEnumInteger.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredClassRequiredNotnullableEnumInteger.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(RequiredClassRequiredNotnullableEnumInteger value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class RequiredClassRequiredNotnullableEnumIntegerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNotnullableEnumInteger Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNotnullableEnumInteger? result = rawValue == null + ? null + : RequiredClassRequiredNotnullableEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the RequiredClassRequiredNotnullableEnumInteger to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNotnullableEnumInteger requiredClassRequiredNotnullableEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNotnullableEnumInteger.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassRequiredNotnullableEnumIntegerNullableJsonConverter : JsonConverter + { + /// + /// Returns a RequiredClassRequiredNotnullableEnumInteger from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNotnullableEnumInteger? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNotnullableEnumInteger? result = rawValue == null + ? null + : RequiredClassRequiredNotnullableEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNotnullableEnumInteger? requiredClassRequiredNotnullableEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNotnullableEnumInteger?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumIntegerOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumIntegerOnly.cs new file mode 100644 index 000000000000..775aba4f6af0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumIntegerOnly.cs @@ -0,0 +1,168 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines RequiredClass_required_notnullable_enum_integer_only + /// + public enum RequiredClassRequiredNotnullableEnumIntegerOnly + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Converts to and from the JSON value + /// + public static class RequiredClassRequiredNotnullableEnumIntegerOnlyValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNotnullableEnumIntegerOnly FromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredClassRequiredNotnullableEnumIntegerOnly.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredClassRequiredNotnullableEnumIntegerOnly.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredClassRequiredNotnullableEnumIntegerOnly: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNotnullableEnumIntegerOnly? FromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredClassRequiredNotnullableEnumIntegerOnly.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredClassRequiredNotnullableEnumIntegerOnly.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(RequiredClassRequiredNotnullableEnumIntegerOnly value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class RequiredClassRequiredNotnullableEnumIntegerOnlyJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNotnullableEnumIntegerOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNotnullableEnumIntegerOnly? result = rawValue == null + ? null + : RequiredClassRequiredNotnullableEnumIntegerOnlyValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the RequiredClassRequiredNotnullableEnumIntegerOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNotnullableEnumIntegerOnly requiredClassRequiredNotnullableEnumIntegerOnly, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNotnullableEnumIntegerOnly.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassRequiredNotnullableEnumIntegerOnlyNullableJsonConverter : JsonConverter + { + /// + /// Returns a RequiredClassRequiredNotnullableEnumIntegerOnly from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNotnullableEnumIntegerOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNotnullableEnumIntegerOnly? result = rawValue == null + ? null + : RequiredClassRequiredNotnullableEnumIntegerOnlyValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNotnullableEnumIntegerOnly? requiredClassRequiredNotnullableEnumIntegerOnly, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNotnullableEnumIntegerOnly?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumString.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumString.cs new file mode 100644 index 000000000000..5b4f29294ac6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNotnullableEnumString.cs @@ -0,0 +1,258 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines RequiredClass_required_notnullable_enum_string + /// + public enum RequiredClassRequiredNotnullableEnumString + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Converts to and from the JSON value + /// + public static class RequiredClassRequiredNotnullableEnumStringValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNotnullableEnumString FromString(string value) + { + if (value.Equals("UPPER")) + return RequiredClassRequiredNotnullableEnumString.UPPER; + + if (value.Equals("lower")) + return RequiredClassRequiredNotnullableEnumString.Lower; + + if (value.Equals("")) + return RequiredClassRequiredNotnullableEnumString.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredClassRequiredNotnullableEnumString.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredClassRequiredNotnullableEnumString.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredClassRequiredNotnullableEnumString.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredClassRequiredNotnullableEnumString.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredClassRequiredNotnullableEnumString.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredClassRequiredNotnullableEnumString: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNotnullableEnumString? FromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredClassRequiredNotnullableEnumString.UPPER; + + if (value.Equals("lower")) + return RequiredClassRequiredNotnullableEnumString.Lower; + + if (value.Equals("")) + return RequiredClassRequiredNotnullableEnumString.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredClassRequiredNotnullableEnumString.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredClassRequiredNotnullableEnumString.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredClassRequiredNotnullableEnumString.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredClassRequiredNotnullableEnumString.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredClassRequiredNotnullableEnumString.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(RequiredClassRequiredNotnullableEnumString value) + { + if (value == RequiredClassRequiredNotnullableEnumString.UPPER) + return "UPPER"; + + if (value == RequiredClassRequiredNotnullableEnumString.Lower) + return "lower"; + + if (value == RequiredClassRequiredNotnullableEnumString.Empty) + return ""; + + if (value == RequiredClassRequiredNotnullableEnumString.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredClassRequiredNotnullableEnumString.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredClassRequiredNotnullableEnumString.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredClassRequiredNotnullableEnumString.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredClassRequiredNotnullableEnumString.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class RequiredClassRequiredNotnullableEnumStringJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNotnullableEnumString Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNotnullableEnumString? result = rawValue == null + ? null + : RequiredClassRequiredNotnullableEnumStringValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the RequiredClassRequiredNotnullableEnumString to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNotnullableEnumString requiredClassRequiredNotnullableEnumString, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNotnullableEnumString.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassRequiredNotnullableEnumStringNullableJsonConverter : JsonConverter + { + /// + /// Returns a RequiredClassRequiredNotnullableEnumString from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNotnullableEnumString? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNotnullableEnumString? result = rawValue == null + ? null + : RequiredClassRequiredNotnullableEnumStringValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNotnullableEnumString? requiredClassRequiredNotnullableEnumString, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNotnullableEnumString?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumInteger.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumInteger.cs new file mode 100644 index 000000000000..365504a241bf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumInteger.cs @@ -0,0 +1,168 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines RequiredClass_required_nullable_enum_integer + /// + public enum RequiredClassRequiredNullableEnumInteger + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Converts to and from the JSON value + /// + public static class RequiredClassRequiredNullableEnumIntegerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNullableEnumInteger FromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredClassRequiredNullableEnumInteger.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredClassRequiredNullableEnumInteger.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredClassRequiredNullableEnumInteger: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNullableEnumInteger? FromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredClassRequiredNullableEnumInteger.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredClassRequiredNullableEnumInteger.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(RequiredClassRequiredNullableEnumInteger value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class RequiredClassRequiredNullableEnumIntegerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNullableEnumInteger Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNullableEnumInteger? result = rawValue == null + ? null + : RequiredClassRequiredNullableEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the RequiredClassRequiredNullableEnumInteger to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNullableEnumInteger requiredClassRequiredNullableEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNullableEnumInteger.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassRequiredNullableEnumIntegerNullableJsonConverter : JsonConverter + { + /// + /// Returns a RequiredClassRequiredNullableEnumInteger from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNullableEnumInteger? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNullableEnumInteger? result = rawValue == null + ? null + : RequiredClassRequiredNullableEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNullableEnumInteger? requiredClassRequiredNullableEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNullableEnumInteger?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumIntegerOnly.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumIntegerOnly.cs new file mode 100644 index 000000000000..4c5f2c56ba58 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumIntegerOnly.cs @@ -0,0 +1,168 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines RequiredClass_required_nullable_enum_integer_only + /// + public enum RequiredClassRequiredNullableEnumIntegerOnly + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Converts to and from the JSON value + /// + public static class RequiredClassRequiredNullableEnumIntegerOnlyValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNullableEnumIntegerOnly FromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredClassRequiredNullableEnumIntegerOnly.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredClassRequiredNullableEnumIntegerOnly.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredClassRequiredNullableEnumIntegerOnly: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNullableEnumIntegerOnly? FromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredClassRequiredNullableEnumIntegerOnly.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredClassRequiredNullableEnumIntegerOnly.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(RequiredClassRequiredNullableEnumIntegerOnly value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class RequiredClassRequiredNullableEnumIntegerOnlyJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNullableEnumIntegerOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNullableEnumIntegerOnly? result = rawValue == null + ? null + : RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the RequiredClassRequiredNullableEnumIntegerOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNullableEnumIntegerOnly requiredClassRequiredNullableEnumIntegerOnly, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNullableEnumIntegerOnly.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassRequiredNullableEnumIntegerOnlyNullableJsonConverter : JsonConverter + { + /// + /// Returns a RequiredClassRequiredNullableEnumIntegerOnly from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNullableEnumIntegerOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNullableEnumIntegerOnly? result = rawValue == null + ? null + : RequiredClassRequiredNullableEnumIntegerOnlyValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNullableEnumIntegerOnly? requiredClassRequiredNullableEnumIntegerOnly, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNullableEnumIntegerOnly?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumString.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumString.cs new file mode 100644 index 000000000000..36bcb1481310 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RequiredClassRequiredNullableEnumString.cs @@ -0,0 +1,258 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines RequiredClass_required_nullable_enum_string + /// + public enum RequiredClassRequiredNullableEnumString + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Converts to and from the JSON value + /// + public static class RequiredClassRequiredNullableEnumStringValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNullableEnumString FromString(string value) + { + if (value.Equals("UPPER")) + return RequiredClassRequiredNullableEnumString.UPPER; + + if (value.Equals("lower")) + return RequiredClassRequiredNullableEnumString.Lower; + + if (value.Equals("")) + return RequiredClassRequiredNullableEnumString.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredClassRequiredNullableEnumString.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredClassRequiredNullableEnumString.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredClassRequiredNullableEnumString.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredClassRequiredNullableEnumString.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredClassRequiredNullableEnumString.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredClassRequiredNullableEnumString: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static RequiredClassRequiredNullableEnumString? FromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredClassRequiredNullableEnumString.UPPER; + + if (value.Equals("lower")) + return RequiredClassRequiredNullableEnumString.Lower; + + if (value.Equals("")) + return RequiredClassRequiredNullableEnumString.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredClassRequiredNullableEnumString.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredClassRequiredNullableEnumString.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredClassRequiredNullableEnumString.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredClassRequiredNullableEnumString.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredClassRequiredNullableEnumString.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(RequiredClassRequiredNullableEnumString value) + { + if (value == RequiredClassRequiredNullableEnumString.UPPER) + return "UPPER"; + + if (value == RequiredClassRequiredNullableEnumString.Lower) + return "lower"; + + if (value == RequiredClassRequiredNullableEnumString.Empty) + return ""; + + if (value == RequiredClassRequiredNullableEnumString.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredClassRequiredNullableEnumString.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredClassRequiredNullableEnumString.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredClassRequiredNullableEnumString.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredClassRequiredNullableEnumString.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class RequiredClassRequiredNullableEnumStringJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNullableEnumString Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNullableEnumString? result = rawValue == null + ? null + : RequiredClassRequiredNullableEnumStringValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the RequiredClassRequiredNullableEnumString to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNullableEnumString requiredClassRequiredNullableEnumString, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNullableEnumString.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassRequiredNullableEnumStringNullableJsonConverter : JsonConverter + { + /// + /// Returns a RequiredClassRequiredNullableEnumString from the Json object + /// + /// + /// + /// + /// + public override RequiredClassRequiredNullableEnumString? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + RequiredClassRequiredNullableEnumString? result = rawValue == null + ? null + : RequiredClassRequiredNullableEnumStringValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClassRequiredNullableEnumString? requiredClassRequiredNullableEnumString, JsonSerializerOptions options) + { + writer.WriteStringValue(requiredClassRequiredNullableEnumString?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs new file mode 100644 index 000000000000..9d1fbcfd0f6f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Return.cs @@ -0,0 +1,246 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing reserved words + /// + public partial class Return : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lock + /// abstract + /// varReturn + /// unsafe + [JsonConstructor] + public Return(string @lock, string @abstract = default, Option varReturn = default, Option @unsafe = default) + { + Lock = @lock; + Abstract = @abstract; + VarReturnOption = varReturn; + UnsafeOption = @unsafe; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Lock + /// + [JsonPropertyName("lock")] + public string Lock { get; set; } + + /// + /// Gets or Sets Abstract + /// + [JsonPropertyName("abstract")] + public string Abstract { get; set; } + + /// + /// Used to track the state of VarReturn + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarReturnOption { get; private set; } + + /// + /// Gets or Sets VarReturn + /// + [JsonPropertyName("return")] + public int? VarReturn { get { return this.VarReturnOption; } set { this.VarReturnOption = new(value); } } + + /// + /// Used to track the state of Unsafe + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsafeOption { get; private set; } + + /// + /// Gets or Sets Unsafe + /// + [JsonPropertyName("unsafe")] + public string Unsafe { get { return this.UnsafeOption; } set { this.UnsafeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Return {\n"); + sb.Append(" Lock: ").Append(Lock).Append("\n"); + sb.Append(" Abstract: ").Append(Abstract).Append("\n"); + sb.Append(" VarReturn: ").Append(VarReturn).Append("\n"); + sb.Append(" Unsafe: ").Append(Unsafe).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ReturnJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varLock = default; + Option varAbstract = default; + Option varReturn = default; + Option varUnsafe = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lock": + varLock = new Option(utf8JsonReader.GetString()); + break; + case "abstract": + varAbstract = new Option(utf8JsonReader.GetString()); + break; + case "return": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varReturn = new Option(utf8JsonReader.GetInt32()); + break; + case "unsafe": + varUnsafe = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!varLock.IsSet) + throw new ArgumentException("Property is required for class Return.", nameof(varLock)); + + if (!varAbstract.IsSet) + throw new ArgumentException("Property is required for class Return.", nameof(varAbstract)); + + if (varLock.IsSet && varLock.Value == null) + throw new ArgumentNullException(nameof(varLock), "Property is not nullable for class Return."); + + if (varReturn.IsSet && varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); + + if (varUnsafe.IsSet && varUnsafe.Value == null) + throw new ArgumentNullException(nameof(varUnsafe), "Property is not nullable for class Return."); + + return new Return(varLock.Value, varAbstract.Value, varReturn, varUnsafe); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, varReturn, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) + { + if (varReturn.Lock == null) + throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); + + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) + throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + + writer.WriteString("lock", varReturn.Lock); + + if (varReturn.Abstract != null) + writer.WriteString("abstract", varReturn.Abstract); + else + writer.WriteNull("abstract"); + + if (varReturn.VarReturnOption.IsSet) + writer.WriteNumber("return", varReturn.VarReturnOption.Value.Value); + + if (varReturn.UnsafeOption.IsSet) + writer.WriteString("unsafe", varReturn.Unsafe); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs new file mode 100644 index 000000000000..749507fe8e0c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -0,0 +1,204 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Role report Hash + /// + public partial class RolesReportsHash : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// role + /// roleUuid + [JsonConstructor] + public RolesReportsHash(Option role = default, Option roleUuid = default) + { + RoleOption = role; + RoleUuidOption = roleUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Role + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option RoleOption { get; private set; } + + /// + /// Gets or Sets Role + /// + [JsonPropertyName("role")] + public RolesReportsHashRole Role { get { return this.RoleOption; } set { this.RoleOption = new(value); } } + + /// + /// Used to track the state of RoleUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option RoleUuidOption { get; private set; } + + /// + /// Gets or Sets RoleUuid + /// + [JsonPropertyName("role_uuid")] + public Guid? RoleUuid { get { return this.RoleUuidOption; } set { this.RoleUuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RolesReportsHash {\n"); + sb.Append(" Role: ").Append(Role).Append("\n"); + sb.Append(" RoleUuid: ").Append(RoleUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RolesReportsHashJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option role = default; + Option roleUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "role": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "role_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + roleUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (role.IsSet && role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); + + if (roleUuid.IsSet && roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); + + return new RolesReportsHash(role, roleUuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, rolesReportsHash, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) + { + if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + + if (rolesReportsHash.RoleOption.IsSet) + { + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + } + if (rolesReportsHash.RoleUuidOption.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs new file mode 100644 index 000000000000..5b5b7899e3cf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RolesReportsHashRole + /// + public partial class RolesReportsHashRole : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public RolesReportsHashRole(Option name = default) + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RolesReportsHashRole {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RolesReportsHashRoleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); + + return new RolesReportsHashRole(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, rolesReportsHashRole, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) + { + if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + + if (rolesReportsHashRole.NameOption.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs new file mode 100644 index 000000000000..5c960eb54744 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ScaleneTriangle + /// + public partial class ScaleneTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public ScaleneTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ScaleneTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ScaleneTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + return new ScaleneTriangle(shapeType.Value, triangleType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, scaleneTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + + writer.WriteString("triangleType", scaleneTriangle.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Shape.cs new file mode 100644 index 000000000000..c651ac7d2454 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Shape.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Shape + /// + public partial class Shape : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Shape(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Shape(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Shape {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral quadrilateral = null; + Triangle triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("shapeType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("Quadrilateral")) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator.Equals("Triangle")) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); + + if (quadrilateral != null) + return new Shape(quadrilateral); + + if (triangle != null) + return new Shape(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (shape.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, shape.Triangle, jsonSerializerOptions); + } + + if (shape.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, shape.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, shape, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs new file mode 100644 index 000000000000..37db5df64908 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ShapeInterface + /// + public partial class ShapeInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + [JsonConstructor] + public ShapeInterface(string shapeType) + { + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShapeInterface {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + return new ShapeInterface(shapeType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, shapeInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + + writer.WriteString("shapeType", shapeInterface.ShapeType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeOrNull.cs new file mode 100644 index 000000000000..1f0b22030070 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + /// + public partial class ShapeOrNull : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public ShapeOrNull(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public ShapeOrNull(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShapeOrNull {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeOrNullJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral quadrilateral = null; + Triangle triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("shapeType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("Quadrilateral")) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator.Equals("Triangle")) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); + + if (quadrilateral != null) + return new ShapeOrNull(quadrilateral); + + if (triangle != null) + return new ShapeOrNull(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (shapeOrNull.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, shapeOrNull.Triangle, jsonSerializerOptions); + } + + if (shapeOrNull.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, shapeOrNull.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, shapeOrNull, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs new file mode 100644 index 000000000000..ffa68d1e75de --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// SimpleQuadrilateral + /// + public partial class SimpleQuadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + /// shapeType + [JsonConstructor] + public SimpleQuadrilateral(string quadrilateralType, string shapeType) + { + QuadrilateralType = quadrilateralType; + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SimpleQuadrilateral {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SimpleQuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()); + break; + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + return new SimpleQuadrilateral(quadrilateralType.Value, shapeType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, simpleQuadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs new file mode 100644 index 000000000000..08b9d580d9f1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -0,0 +1,201 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// SpecialModelName + /// + public partial class SpecialModelName : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varSpecialModelName + /// specialPropertyName + [JsonConstructor] + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) + { + VarSpecialModelNameOption = varSpecialModelName; + SpecialPropertyNameOption = specialPropertyName; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of VarSpecialModelName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarSpecialModelNameOption { get; private set; } + + /// + /// Gets or Sets VarSpecialModelName + /// + [JsonPropertyName("_special_model.name_")] + public string VarSpecialModelName { get { return this.VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } + + /// + /// Used to track the state of SpecialPropertyName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SpecialPropertyNameOption { get; private set; } + + /// + /// Gets or Sets SpecialPropertyName + /// + [JsonPropertyName("$special[property.name]")] + public long? SpecialPropertyName { get { return this.SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SpecialModelName {\n"); + sb.Append(" VarSpecialModelName: ").Append(VarSpecialModelName).Append("\n"); + sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SpecialModelNameJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varSpecialModelName = default; + Option specialPropertyName = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "_special_model.name_": + varSpecialModelName = new Option(utf8JsonReader.GetString()); + break; + case "$special[property.name]": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + specialPropertyName = new Option(utf8JsonReader.GetInt64()); + break; + default: + break; + } + } + } + + if (varSpecialModelName.IsSet && varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); + + if (specialPropertyName.IsSet && specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); + + return new SpecialModelName(varSpecialModelName, specialPropertyName); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, specialModelName, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) + { + if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + + if (specialModelName.VarSpecialModelNameOption.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); + + if (specialModelName.SpecialPropertyNameOption.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs new file mode 100644 index 000000000000..d5fb2f5610ad --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Tag.cs @@ -0,0 +1,201 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Tag + /// + public partial class Tag : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + /// name + [JsonConstructor] + public Tag(Option id = default, Option name = default) + { + IdOption = id; + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Tag {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TagJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); + + return new Tag(id, name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, tag, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) + { + if (tag.NameOption.IsSet && tag.Name == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + + if (tag.IdOption.IsSet) + writer.WriteNumber("id", tag.IdOption.Value.Value); + + if (tag.NameOption.IsSet) + writer.WriteString("name", tag.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs new file mode 100644 index 000000000000..215caa45302b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestCollectionEndingWithWordList + /// + public partial class TestCollectionEndingWithWordList : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// value + [JsonConstructor] + public TestCollectionEndingWithWordList(Option value = default) + { + ValueOption = value; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Value + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ValueOption { get; private set; } + + /// + /// Gets or Sets Value + /// + [JsonPropertyName("value")] + public string Value { get { return this.ValueOption; } set { this.ValueOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestCollectionEndingWithWordList {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestCollectionEndingWithWordListJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option value = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "value": + value = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (value.IsSet && value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); + + return new TestCollectionEndingWithWordList(value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testCollectionEndingWithWordList, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) + { + if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + + if (testCollectionEndingWithWordList.ValueOption.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs new file mode 100644 index 000000000000..1936341f8ba6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestCollectionEndingWithWordListObject + /// + public partial class TestCollectionEndingWithWordListObject : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// testCollectionEndingWithWordList + [JsonConstructor] + public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) + { + TestCollectionEndingWithWordListOption = testCollectionEndingWithWordList; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of TestCollectionEndingWithWordList + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> TestCollectionEndingWithWordListOption { get; private set; } + + /// + /// Gets or Sets TestCollectionEndingWithWordList + /// + [JsonPropertyName("TestCollectionEndingWithWordList")] + public List TestCollectionEndingWithWordList { get { return this.TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestCollectionEndingWithWordListObject {\n"); + sb.Append(" TestCollectionEndingWithWordList: ").Append(TestCollectionEndingWithWordList).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestCollectionEndingWithWordListObjectJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> testCollectionEndingWithWordList = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "TestCollectionEndingWithWordList": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); + + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testCollectionEndingWithWordListObject, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) + { + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) + { + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersEnumHeaderStringParameter.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersEnumHeaderStringParameter.cs new file mode 100644 index 000000000000..ccb446b02503 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersEnumHeaderStringParameter.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines testEnumParameters_enum_header_string_parameter + /// + public enum TestEnumParametersEnumHeaderStringParameter + { + /// + /// Enum Abc for value: _abc + /// + Abc = 1, + + /// + /// Enum Efg for value: -efg + /// + Efg = 2, + + /// + /// Enum Xyz for value: (xyz) + /// + Xyz = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class TestEnumParametersEnumHeaderStringParameterValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersEnumHeaderStringParameter FromString(string value) + { + if (value.Equals("_abc")) + return TestEnumParametersEnumHeaderStringParameter.Abc; + + if (value.Equals("-efg")) + return TestEnumParametersEnumHeaderStringParameter.Efg; + + if (value.Equals("(xyz)")) + return TestEnumParametersEnumHeaderStringParameter.Xyz; + + throw new NotImplementedException($"Could not convert value to type TestEnumParametersEnumHeaderStringParameter: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersEnumHeaderStringParameter? FromStringOrDefault(string value) + { + if (value.Equals("_abc")) + return TestEnumParametersEnumHeaderStringParameter.Abc; + + if (value.Equals("-efg")) + return TestEnumParametersEnumHeaderStringParameter.Efg; + + if (value.Equals("(xyz)")) + return TestEnumParametersEnumHeaderStringParameter.Xyz; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(TestEnumParametersEnumHeaderStringParameter value) + { + if (value == TestEnumParametersEnumHeaderStringParameter.Abc) + return "_abc"; + + if (value == TestEnumParametersEnumHeaderStringParameter.Efg) + return "-efg"; + + if (value == TestEnumParametersEnumHeaderStringParameter.Xyz) + return "(xyz)"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class TestEnumParametersEnumHeaderStringParameterJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersEnumHeaderStringParameter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersEnumHeaderStringParameter? result = rawValue == null + ? null + : TestEnumParametersEnumHeaderStringParameterValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the TestEnumParametersEnumHeaderStringParameter to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersEnumHeaderStringParameter testEnumParametersEnumHeaderStringParameter, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersEnumHeaderStringParameter.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class TestEnumParametersEnumHeaderStringParameterNullableJsonConverter : JsonConverter + { + /// + /// Returns a TestEnumParametersEnumHeaderStringParameter from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersEnumHeaderStringParameter? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersEnumHeaderStringParameter? result = rawValue == null + ? null + : TestEnumParametersEnumHeaderStringParameterValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersEnumHeaderStringParameter? testEnumParametersEnumHeaderStringParameter, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersEnumHeaderStringParameter?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryDoubleParameter.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryDoubleParameter.cs new file mode 100644 index 000000000000..ec14b39944da --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryDoubleParameter.cs @@ -0,0 +1,168 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines testEnumParameters_enum_query_double_parameter + /// + public enum TestEnumParametersEnumQueryDoubleParameter + { + /// + /// Enum NUMBER_1_DOT_1 for value: 1.1 + /// + NUMBER_1_DOT_1 = 1, + + /// + /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 + /// + NUMBER_MINUS_1_DOT_2 = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class TestEnumParametersEnumQueryDoubleParameterValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersEnumQueryDoubleParameter FromString(string value) + { + if (value.Equals("1.1")) + return TestEnumParametersEnumQueryDoubleParameter.NUMBER_1_DOT_1; + + if (value.Equals("-1.2")) + return TestEnumParametersEnumQueryDoubleParameter.NUMBER_MINUS_1_DOT_2; + + throw new NotImplementedException($"Could not convert value to type TestEnumParametersEnumQueryDoubleParameter: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersEnumQueryDoubleParameter? FromStringOrDefault(string value) + { + if (value.Equals("1.1")) + return TestEnumParametersEnumQueryDoubleParameter.NUMBER_1_DOT_1; + + if (value.Equals("-1.2")) + return TestEnumParametersEnumQueryDoubleParameter.NUMBER_MINUS_1_DOT_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static double ToJsonValue(TestEnumParametersEnumQueryDoubleParameter value) + { + return (double) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class TestEnumParametersEnumQueryDoubleParameterJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersEnumQueryDoubleParameter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersEnumQueryDoubleParameter? result = rawValue == null + ? null + : TestEnumParametersEnumQueryDoubleParameterValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the TestEnumParametersEnumQueryDoubleParameter to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersEnumQueryDoubleParameter testEnumParametersEnumQueryDoubleParameter, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersEnumQueryDoubleParameter.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class TestEnumParametersEnumQueryDoubleParameterNullableJsonConverter : JsonConverter + { + /// + /// Returns a TestEnumParametersEnumQueryDoubleParameter from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersEnumQueryDoubleParameter? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersEnumQueryDoubleParameter? result = rawValue == null + ? null + : TestEnumParametersEnumQueryDoubleParameterValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersEnumQueryDoubleParameter? testEnumParametersEnumQueryDoubleParameter, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersEnumQueryDoubleParameter?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs new file mode 100644 index 000000000000..33ff2ce2cc21 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersEnumQueryIntegerParameter.cs @@ -0,0 +1,168 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines testEnumParameters_enum_query_integer_parameter + /// + public enum TestEnumParametersEnumQueryIntegerParameter + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Converts to and from the JSON value + /// + public static class TestEnumParametersEnumQueryIntegerParameterValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersEnumQueryIntegerParameter FromString(string value) + { + if (value.Equals((1).ToString())) + return TestEnumParametersEnumQueryIntegerParameter.NUMBER_1; + + if (value.Equals((-2).ToString())) + return TestEnumParametersEnumQueryIntegerParameter.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type TestEnumParametersEnumQueryIntegerParameter: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersEnumQueryIntegerParameter? FromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return TestEnumParametersEnumQueryIntegerParameter.NUMBER_1; + + if (value.Equals((-2).ToString())) + return TestEnumParametersEnumQueryIntegerParameter.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(TestEnumParametersEnumQueryIntegerParameter value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class TestEnumParametersEnumQueryIntegerParameterJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersEnumQueryIntegerParameter Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersEnumQueryIntegerParameter? result = rawValue == null + ? null + : TestEnumParametersEnumQueryIntegerParameterValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the TestEnumParametersEnumQueryIntegerParameter to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersEnumQueryIntegerParameter testEnumParametersEnumQueryIntegerParameter, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersEnumQueryIntegerParameter.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class TestEnumParametersEnumQueryIntegerParameterNullableJsonConverter : JsonConverter + { + /// + /// Returns a TestEnumParametersEnumQueryIntegerParameter from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersEnumQueryIntegerParameter? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersEnumQueryIntegerParameter? result = rawValue == null + ? null + : TestEnumParametersEnumQueryIntegerParameterValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersEnumQueryIntegerParameter? testEnumParametersEnumQueryIntegerParameter, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersEnumQueryIntegerParameter?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormString.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormString.cs new file mode 100644 index 000000000000..d86b48d4a9b7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormString.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Form parameter enum test (string) + /// + /// Form parameter enum test (string) + public enum TestEnumParametersRequestEnumFormString + { + /// + /// Enum Abc for value: _abc + /// + Abc = 1, + + /// + /// Enum Efg for value: -efg + /// + Efg = 2, + + /// + /// Enum Xyz for value: (xyz) + /// + Xyz = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class TestEnumParametersRequestEnumFormStringValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersRequestEnumFormString FromString(string value) + { + if (value.Equals("_abc")) + return TestEnumParametersRequestEnumFormString.Abc; + + if (value.Equals("-efg")) + return TestEnumParametersRequestEnumFormString.Efg; + + if (value.Equals("(xyz)")) + return TestEnumParametersRequestEnumFormString.Xyz; + + throw new NotImplementedException($"Could not convert value to type TestEnumParametersRequestEnumFormString: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersRequestEnumFormString? FromStringOrDefault(string value) + { + if (value.Equals("_abc")) + return TestEnumParametersRequestEnumFormString.Abc; + + if (value.Equals("-efg")) + return TestEnumParametersRequestEnumFormString.Efg; + + if (value.Equals("(xyz)")) + return TestEnumParametersRequestEnumFormString.Xyz; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(TestEnumParametersRequestEnumFormString value) + { + if (value == TestEnumParametersRequestEnumFormString.Abc) + return "_abc"; + + if (value == TestEnumParametersRequestEnumFormString.Efg) + return "-efg"; + + if (value == TestEnumParametersRequestEnumFormString.Xyz) + return "(xyz)"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class TestEnumParametersRequestEnumFormStringJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersRequestEnumFormString Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersRequestEnumFormString? result = rawValue == null + ? null + : TestEnumParametersRequestEnumFormStringValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the TestEnumParametersRequestEnumFormString to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersRequestEnumFormString testEnumParametersRequestEnumFormString, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersRequestEnumFormString.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class TestEnumParametersRequestEnumFormStringNullableJsonConverter : JsonConverter + { + /// + /// Returns a TestEnumParametersRequestEnumFormString from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersRequestEnumFormString? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersRequestEnumFormString? result = rawValue == null + ? null + : TestEnumParametersRequestEnumFormStringValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersRequestEnumFormString? testEnumParametersRequestEnumFormString, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersRequestEnumFormString?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormStringArrayInner.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormStringArrayInner.cs new file mode 100644 index 000000000000..4f1c9c53c603 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestEnumParametersRequestEnumFormStringArrayInner.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines testEnumParameters_request_enum_form_string_array_inner + /// + public enum TestEnumParametersRequestEnumFormStringArrayInner + { + /// + /// Enum GreaterThan for value: > + /// + GreaterThan = 1, + + /// + /// Enum Dollar for value: $ + /// + Dollar = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class TestEnumParametersRequestEnumFormStringArrayInnerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersRequestEnumFormStringArrayInner FromString(string value) + { + if (value.Equals(">")) + return TestEnumParametersRequestEnumFormStringArrayInner.GreaterThan; + + if (value.Equals("$")) + return TestEnumParametersRequestEnumFormStringArrayInner.Dollar; + + throw new NotImplementedException($"Could not convert value to type TestEnumParametersRequestEnumFormStringArrayInner: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static TestEnumParametersRequestEnumFormStringArrayInner? FromStringOrDefault(string value) + { + if (value.Equals(">")) + return TestEnumParametersRequestEnumFormStringArrayInner.GreaterThan; + + if (value.Equals("$")) + return TestEnumParametersRequestEnumFormStringArrayInner.Dollar; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(TestEnumParametersRequestEnumFormStringArrayInner value) + { + if (value == TestEnumParametersRequestEnumFormStringArrayInner.GreaterThan) + return ">"; + + if (value == TestEnumParametersRequestEnumFormStringArrayInner.Dollar) + return "$"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class TestEnumParametersRequestEnumFormStringArrayInnerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersRequestEnumFormStringArrayInner Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersRequestEnumFormStringArrayInner? result = rawValue == null + ? null + : TestEnumParametersRequestEnumFormStringArrayInnerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the TestEnumParametersRequestEnumFormStringArrayInner to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersRequestEnumFormStringArrayInner testEnumParametersRequestEnumFormStringArrayInner, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersRequestEnumFormStringArrayInner.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class TestEnumParametersRequestEnumFormStringArrayInnerNullableJsonConverter : JsonConverter + { + /// + /// Returns a TestEnumParametersRequestEnumFormStringArrayInner from the Json object + /// + /// + /// + /// + /// + public override TestEnumParametersRequestEnumFormStringArrayInner? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + TestEnumParametersRequestEnumFormStringArrayInner? result = rawValue == null + ? null + : TestEnumParametersRequestEnumFormStringArrayInnerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestEnumParametersRequestEnumFormStringArrayInner? testEnumParametersRequestEnumFormStringArrayInner, JsonSerializerOptions options) + { + writer.WriteStringValue(testEnumParametersRequestEnumFormStringArrayInner?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs new file mode 100644 index 000000000000..fbd7dddd9dce --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestInlineFreeformAdditionalPropertiesRequest + /// + public partial class TestInlineFreeformAdditionalPropertiesRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// someProperty + [JsonConstructor] + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) + { + SomePropertyOption = someProperty; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of SomeProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SomePropertyOption { get; private set; } + + /// + /// Gets or Sets SomeProperty + /// + [JsonPropertyName("someProperty")] + public string SomeProperty { get { return this.SomePropertyOption; } set { this.SomePropertyOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.Append(" SomeProperty: ").Append(SomeProperty).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestInlineFreeformAdditionalPropertiesRequestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option someProperty = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "someProperty": + someProperty = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (someProperty.IsSet && someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); + + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testInlineFreeformAdditionalPropertiesRequest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) + { + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Triangle.cs new file mode 100644 index 000000000000..cf22051519ad --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Triangle.cs @@ -0,0 +1,269 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Triangle + /// + public partial class Triangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(EquilateralTriangle equilateralTriangle) + { + EquilateralTriangle = equilateralTriangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(IsoscelesTriangle isoscelesTriangle) + { + IsoscelesTriangle = isoscelesTriangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(ScaleneTriangle scaleneTriangle) + { + ScaleneTriangle = scaleneTriangle; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets EquilateralTriangle + /// + public EquilateralTriangle EquilateralTriangle { get; set; } + + /// + /// Gets or Sets IsoscelesTriangle + /// + public IsoscelesTriangle IsoscelesTriangle { get; set; } + + /// + /// Gets or Sets ScaleneTriangle + /// + public ScaleneTriangle ScaleneTriangle { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Triangle {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option triangleType = default; + + EquilateralTriangle equilateralTriangle = null; + IsoscelesTriangle isoscelesTriangle = null; + ScaleneTriangle scaleneTriangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("triangleType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("EquilateralTriangle")) + { + Utf8JsonReader utf8JsonReaderEquilateralTriangle = utf8JsonReader; + equilateralTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderEquilateralTriangle, jsonSerializerOptions); + } + if (discriminator.Equals("IsoscelesTriangle")) + { + Utf8JsonReader utf8JsonReaderIsoscelesTriangle = utf8JsonReader; + isoscelesTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderIsoscelesTriangle, jsonSerializerOptions); + } + if (discriminator.Equals("ScaleneTriangle")) + { + Utf8JsonReader utf8JsonReaderScaleneTriangle = utf8JsonReader; + scaleneTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderScaleneTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); + + if (equilateralTriangle != null) + return new Triangle(equilateralTriangle); + + if (isoscelesTriangle != null) + return new Triangle(isoscelesTriangle); + + if (scaleneTriangle != null) + return new Triangle(scaleneTriangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (triangle.EquilateralTriangle != null) + { + EquilateralTriangleJsonConverter equilateralTriangleJsonConverter = (EquilateralTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.EquilateralTriangle.GetType())); + equilateralTriangleJsonConverter.WriteProperties(writer, triangle.EquilateralTriangle, jsonSerializerOptions); + } + + if (triangle.IsoscelesTriangle != null) + { + IsoscelesTriangleJsonConverter isoscelesTriangleJsonConverter = (IsoscelesTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.IsoscelesTriangle.GetType())); + isoscelesTriangleJsonConverter.WriteProperties(writer, triangle.IsoscelesTriangle, jsonSerializerOptions); + } + + if (triangle.ScaleneTriangle != null) + { + ScaleneTriangleJsonConverter scaleneTriangleJsonConverter = (ScaleneTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.ScaleneTriangle.GetType())); + scaleneTriangleJsonConverter.WriteProperties(writer, triangle.ScaleneTriangle, jsonSerializerOptions); + } + + WriteProperties(writer, triangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs new file mode 100644 index 000000000000..0f13b0e77451 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TriangleInterface + /// + public partial class TriangleInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// triangleType + [JsonConstructor] + public TriangleInterface(string triangleType) + { + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TriangleInterface {\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TriangleInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + return new TriangleInterface(triangleType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, triangleInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + + writer.WriteString("triangleType", triangleInterface.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs new file mode 100644 index 000000000000..0c2e096925ef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/User.cs @@ -0,0 +1,497 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// User + /// + public partial class User : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// 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 + /// 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. + /// email + /// firstName + /// id + /// lastName + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// password + /// phone + /// User Status + /// username + [JsonConstructor] + public User(Option anyTypeProp = default, Option anyTypePropNullable = default, Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option objectWithNoDeclaredPropsNullable = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default) + { + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; + EmailOption = email; + FirstNameOption = firstName; + IdOption = id; + LastNameOption = lastName; + ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; + PasswordOption = password; + PhoneOption = phone; + UserStatusOption = userStatus; + UsernameOption = username; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropOption { get; private set; } + + /// + /// 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 + /// + /// 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 + [JsonPropertyName("anyTypeProp")] + public Object AnyTypeProp { get { return this.AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropNullableOption { get; private set; } + + /// + /// 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. + /// + /// 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. + [JsonPropertyName("anyTypePropNullable")] + public Object AnyTypePropNullable { get { return this.AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } + + /// + /// Used to track the state of Email + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EmailOption { get; private set; } + + /// + /// Gets or Sets Email + /// + [JsonPropertyName("email")] + public string Email { get { return this.EmailOption; } set { this.EmailOption = new(value); } } + + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FirstNameOption { get; private set; } + + /// + /// Gets or Sets FirstName + /// + [JsonPropertyName("firstName")] + public string FirstName { get { return this.FirstNameOption; } set { this.FirstNameOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option LastNameOption { get; private set; } + + /// + /// Gets or Sets LastName + /// + [JsonPropertyName("lastName")] + public string LastName { get { return this.LastNameOption; } set { this.LastNameOption = new(value); } } + + /// + /// Used to track the state of ObjectWithNoDeclaredProps + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsOption { get; private set; } + + /// + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + [JsonPropertyName("objectWithNoDeclaredProps")] + public Object ObjectWithNoDeclaredProps { get { return this.ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } + + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } + + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + [JsonPropertyName("objectWithNoDeclaredPropsNullable")] + public Object ObjectWithNoDeclaredPropsNullable { get { return this.ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } + + /// + /// Used to track the state of Password + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PasswordOption { get; private set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get { return this.PasswordOption; } set { this.PasswordOption = new(value); } } + + /// + /// Used to track the state of Phone + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PhoneOption { get; private set; } + + /// + /// Gets or Sets Phone + /// + [JsonPropertyName("phone")] + public string Phone { get { return this.PhoneOption; } set { this.PhoneOption = new(value); } } + + /// + /// Used to track the state of UserStatus + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UserStatusOption { get; private set; } + + /// + /// User Status + /// + /// User Status + [JsonPropertyName("userStatus")] + public int? UserStatus { get { return this.UserStatusOption; } set { this.UserStatusOption = new(value); } } + + /// + /// Used to track the state of Username + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UsernameOption { get; private set; } + + /// + /// Gets or Sets Username + /// + [JsonPropertyName("username")] + public string Username { get { return this.UsernameOption; } set { this.UsernameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class User {\n"); + sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); + sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append("\n"); + sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); + sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class UserJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option objectWithNoDeclaredPropsNullable = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "anyTypeProp": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "anyTypePropNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "email": + email = new Option(utf8JsonReader.GetString()); + break; + case "firstName": + firstName = new Option(utf8JsonReader.GetString()); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "lastName": + lastName = new Option(utf8JsonReader.GetString()); + break; + case "objectWithNoDeclaredProps": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "objectWithNoDeclaredPropsNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "password": + password = new Option(utf8JsonReader.GetString()); + break; + case "phone": + phone = new Option(utf8JsonReader.GetString()); + break; + case "userStatus": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + userStatus = new Option(utf8JsonReader.GetInt32()); + break; + case "username": + username = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (email.IsSet && email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); + + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); + + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); + + if (objectWithNoDeclaredProps.IsSet && objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); + + if (phone.IsSet && phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); + + if (userStatus.IsSet && userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); + + if (username.IsSet && username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); + + return new User(anyTypeProp, anyTypePropNullable, email, firstName, id, lastName, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, password, phone, userStatus, username); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, user, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) + { + if (user.EmailOption.IsSet && user.Email == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstNameOption.IsSet && user.FirstName == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastNameOption.IsSet && user.LastName == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.PasswordOption.IsSet && user.Password == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.PhoneOption.IsSet && user.Phone == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.UsernameOption.IsSet && user.Username == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + + if (user.AnyTypePropOption.IsSet) + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.EmailOption.IsSet) + writer.WriteString("email", user.Email); + + if (user.FirstNameOption.IsSet) + writer.WriteString("firstName", user.FirstName); + + if (user.IdOption.IsSet) + writer.WriteNumber("id", user.IdOption.Value.Value); + + if (user.LastNameOption.IsSet) + writer.WriteString("lastName", user.LastName); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet) + { + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + } + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); + if (user.PasswordOption.IsSet) + writer.WriteString("password", user.Password); + + if (user.PhoneOption.IsSet) + writer.WriteString("phone", user.Phone); + + if (user.UserStatusOption.IsSet) + writer.WriteNumber("userStatus", user.UserStatusOption.Value.Value); + + if (user.UsernameOption.IsSet) + writer.WriteString("username", user.Username); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs new file mode 100644 index 000000000000..a445c5ac182b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Whale.cs @@ -0,0 +1,223 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Whale + /// + public partial class Whale : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + /// hasBaleen + /// hasTeeth + [JsonConstructor] + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) + { + ClassName = className; + HasBaleenOption = hasBaleen; + HasTeethOption = hasTeeth; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Used to track the state of HasBaleen + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option HasBaleenOption { get; private set; } + + /// + /// Gets or Sets HasBaleen + /// + [JsonPropertyName("hasBaleen")] + public bool? HasBaleen { get { return this.HasBaleenOption; } set { this.HasBaleenOption = new(value); } } + + /// + /// Used to track the state of HasTeeth + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option HasTeethOption { get; private set; } + + /// + /// Gets or Sets HasTeeth + /// + [JsonPropertyName("hasTeeth")] + public bool? HasTeeth { get { return this.HasTeethOption; } set { this.HasTeethOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Whale {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" HasBaleen: ").Append(HasBaleen).Append("\n"); + sb.Append(" HasTeeth: ").Append(HasTeeth).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class WhaleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "hasBaleen": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + hasBaleen = new Option(utf8JsonReader.GetBoolean()); + break; + case "hasTeeth": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + hasTeeth = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Whale.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); + + if (hasBaleen.IsSet && hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); + + if (hasTeeth.IsSet && hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); + + return new Whale(className.Value, hasBaleen, hasTeeth); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, whale, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) + { + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + + writer.WriteString("className", whale.ClassName); + + if (whale.HasBaleenOption.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value.Value); + + if (whale.HasTeethOption.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs new file mode 100644 index 000000000000..d3fbe37b12e5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/Zebra.cs @@ -0,0 +1,200 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Zebra + /// + public partial class Zebra : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + /// type + [JsonConstructor] + public Zebra(string className, Option type = default) + { + ClassName = className; + TypeOption = type; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TypeOption { get; private set; } + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public ZebraType? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Zebra {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ZebraJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option type = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "type": + string typeRawValue = utf8JsonReader.GetString(); + if (typeRawValue != null) + type = new Option(ZebraTypeValueConverter.FromStringOrDefault(typeRawValue)); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + + return new Zebra(className.Value, type); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, zebra, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) + { + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + + writer.WriteString("className", zebra.ClassName); + + if (zebra.TypeOption.IsSet) + { + var typeRawValue = ZebraTypeValueConverter.ToJsonValue(zebra.Type.Value); + writer.WriteString("type", typeRawValue); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZebraType.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZebraType.cs new file mode 100644 index 000000000000..4a54f2a265a1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZebraType.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines zebra_type + /// + public enum ZebraType + { + /// + /// Enum Plains for value: plains + /// + Plains = 1, + + /// + /// Enum Mountain for value: mountain + /// + Mountain = 2, + + /// + /// Enum Grevys for value: grevys + /// + Grevys = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class ZebraTypeValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static ZebraType FromString(string value) + { + if (value.Equals("plains")) + return ZebraType.Plains; + + if (value.Equals("mountain")) + return ZebraType.Mountain; + + if (value.Equals("grevys")) + return ZebraType.Grevys; + + throw new NotImplementedException($"Could not convert value to type ZebraType: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static ZebraType? FromStringOrDefault(string value) + { + if (value.Equals("plains")) + return ZebraType.Plains; + + if (value.Equals("mountain")) + return ZebraType.Mountain; + + if (value.Equals("grevys")) + return ZebraType.Grevys; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(ZebraType value) + { + if (value == ZebraType.Plains) + return "plains"; + + if (value == ZebraType.Mountain) + return "mountain"; + + if (value == ZebraType.Grevys) + return "grevys"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class ZebraTypeJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override ZebraType Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ZebraType? result = rawValue == null + ? null + : ZebraTypeValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the ZebraType to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZebraType zebraType, JsonSerializerOptions options) + { + writer.WriteStringValue(zebraType.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class ZebraTypeNullableJsonConverter : JsonConverter + { + /// + /// Returns a ZebraType from the Json object + /// + /// + /// + /// + /// + public override ZebraType? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ZebraType? result = rawValue == null + ? null + : ZebraTypeValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZebraType? zebraType, JsonSerializerOptions options) + { + writer.WriteStringValue(zebraType?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs new file mode 100644 index 000000000000..34a044fb8b13 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + } + + /// + /// Converts to and from the JSON value + /// + public static class ZeroBasedEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnum FromString(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnum? FromStringOrDefault(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnum.NotUnknown; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(ZeroBasedEnum value) + { + if (value == ZeroBasedEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class ZeroBasedEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the ZeroBasedEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnum zeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnum.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class ZeroBasedEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a ZeroBasedEnum from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnum? zeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnum?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 000000000000..7373bc5873d5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + public partial class ZeroBasedEnumClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum + [JsonConstructor] + public ZeroBasedEnumClass(Option zeroBasedEnum = default) + { + ZeroBasedEnumOption = zeroBasedEnum; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ZeroBasedEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ZeroBasedEnumOption { get; private set; } + + /// + /// Gets or Sets ZeroBasedEnum + /// + [JsonPropertyName("ZeroBasedEnum")] + public ZeroBasedEnumClassZeroBasedEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ZeroBasedEnumClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option zeroBasedEnum = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ZeroBasedEnum": + string zeroBasedEnumRawValue = utf8JsonReader.GetString(); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClassZeroBasedEnumValueConverter.FromStringOrDefault(zeroBasedEnumRawValue)); + break; + default: + break; + } + } + } + + if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); + + return new ZeroBasedEnumClass(zeroBasedEnum); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, zeroBasedEnumClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + if (zeroBasedEnumClass.ZeroBasedEnumOption.IsSet) + { + var zeroBasedEnumRawValue = ZeroBasedEnumClassZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); + writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClassZeroBasedEnum.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClassZeroBasedEnum.cs new file mode 100644 index 000000000000..2b062a550aba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Model/ZeroBasedEnumClassZeroBasedEnum.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines ZeroBasedEnumClass_ZeroBasedEnum + /// + public enum ZeroBasedEnumClassZeroBasedEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + } + + /// + /// Converts to and from the JSON value + /// + public static class ZeroBasedEnumClassZeroBasedEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnumClassZeroBasedEnum FromString(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnumClassZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnumClassZeroBasedEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnumClassZeroBasedEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnumClassZeroBasedEnum? FromStringOrDefault(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnumClassZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnumClassZeroBasedEnum.NotUnknown; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(ZeroBasedEnumClassZeroBasedEnum value) + { + if (value == ZeroBasedEnumClassZeroBasedEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnumClassZeroBasedEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class ZeroBasedEnumClassZeroBasedEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnumClassZeroBasedEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ZeroBasedEnumClassZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumClassZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the ZeroBasedEnumClassZeroBasedEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClassZeroBasedEnum zeroBasedEnumClassZeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnumClassZeroBasedEnum.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class ZeroBasedEnumClassZeroBasedEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a ZeroBasedEnumClassZeroBasedEnum from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnumClassZeroBasedEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ZeroBasedEnumClassZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumClassZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClassZeroBasedEnum? zeroBasedEnumClassZeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnumClassZeroBasedEnum?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..cd46b39d2076 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,31 @@ + + + + true + net9.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + false + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..5d92cf7b732d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/README.md @@ -0,0 +1,223 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net9.0', + 'validatable=true', + 'nullableReferenceTypes=false', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + Call123TestSpecialTagsApiResponse apiResponse = await api.Call123TestSpecialTagsAsync("todo"); + ModelClient model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + // the type of token here depends on the api security specifications + ApiKeyToken token = new("", ClientUtils.ApiKeyHeader.Authorization); + options.AddTokens(token); + + // optionally choose the method the tokens will be provided with, default is RateLimitProvider + options.UseProvider, ApiKeyToken>(); + + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: +- write:pets: modify pets in your account +- read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api-key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: Bearer Authentication + + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.11.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: OpenAPI Petstore +- appVersion: 1.0.0 +- appDescription: This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: false +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: false +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net9.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.gitignore b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/FILES new file mode 100644 index 000000000000..afb25a1c17e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/FILES @@ -0,0 +1,246 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/AnotherFakeApi.md +docs/apis/DefaultApi.md +docs/apis/FakeApi.md +docs/apis/FakeClassnameTags123Api.md +docs/apis/PetApi.md +docs/apis/StoreApi.md +docs/apis/UserApi.md +docs/models/Activity.md +docs/models/ActivityOutputElementRepresentation.md +docs/models/AdditionalPropertiesClass.md +docs/models/Animal.md +docs/models/ApiResponse.md +docs/models/Apple.md +docs/models/AppleReq.md +docs/models/ArrayOfArrayOfNumberOnly.md +docs/models/ArrayOfNumberOnly.md +docs/models/ArrayTest.md +docs/models/Banana.md +docs/models/BananaReq.md +docs/models/BasquePig.md +docs/models/Capitalization.md +docs/models/Cat.md +docs/models/Category.md +docs/models/ChildCat.md +docs/models/ClassModel.md +docs/models/ComplexQuadrilateral.md +docs/models/DanishPig.md +docs/models/DateOnlyClass.md +docs/models/DeprecatedObject.md +docs/models/Dog.md +docs/models/Drawing.md +docs/models/EnumArrays.md +docs/models/EnumClass.md +docs/models/EnumTest.md +docs/models/EquilateralTriangle.md +docs/models/File.md +docs/models/FileSchemaTestClass.md +docs/models/Foo.md +docs/models/FooGetDefaultResponse.md +docs/models/FormatTest.md +docs/models/Fruit.md +docs/models/FruitReq.md +docs/models/GmFruit.md +docs/models/GrandparentAnimal.md +docs/models/HasOnlyReadOnly.md +docs/models/HealthCheckResult.md +docs/models/IsoscelesTriangle.md +docs/models/List.md +docs/models/LiteralStringClass.md +docs/models/Mammal.md +docs/models/MapTest.md +docs/models/MixLog.md +docs/models/MixedAnyOf.md +docs/models/MixedAnyOfContent.md +docs/models/MixedOneOf.md +docs/models/MixedOneOfContent.md +docs/models/MixedPropertiesAndAdditionalPropertiesClass.md +docs/models/MixedSubId.md +docs/models/Model200Response.md +docs/models/ModelClient.md +docs/models/Name.md +docs/models/NotificationtestGetElementsV1ResponseMPayload.md +docs/models/NullableClass.md +docs/models/NullableGuidClass.md +docs/models/NullableShape.md +docs/models/NumberOnly.md +docs/models/ObjectWithDeprecatedFields.md +docs/models/OneOfString.md +docs/models/Order.md +docs/models/OuterComposite.md +docs/models/OuterEnum.md +docs/models/OuterEnumDefaultValue.md +docs/models/OuterEnumInteger.md +docs/models/OuterEnumIntegerDefaultValue.md +docs/models/OuterEnumTest.md +docs/models/ParentPet.md +docs/models/Pet.md +docs/models/Pig.md +docs/models/PolymorphicProperty.md +docs/models/Quadrilateral.md +docs/models/QuadrilateralInterface.md +docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md +docs/models/Return.md +docs/models/RolesReportsHash.md +docs/models/RolesReportsHashRole.md +docs/models/ScaleneTriangle.md +docs/models/Shape.md +docs/models/ShapeInterface.md +docs/models/ShapeOrNull.md +docs/models/SimpleQuadrilateral.md +docs/models/SpecialModelName.md +docs/models/Tag.md +docs/models/TestCollectionEndingWithWordList.md +docs/models/TestCollectionEndingWithWordListObject.md +docs/models/TestInlineFreeformAdditionalPropertiesRequest.md +docs/models/Triangle.md +docs/models/TriangleInterface.md +docs/models/User.md +docs/models/Whale.md +docs/models/Zebra.md +docs/models/ZeroBasedEnum.md +docs/models/ZeroBasedEnumClass.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/AnotherFakeApi.cs +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/FakeApi.cs +src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Api/PetApi.cs +src/Org.OpenAPITools/Api/StoreApi.cs +src/Org.OpenAPITools/Api/UserApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiKeyToken.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/BasicToken.cs +src/Org.OpenAPITools/Client/BearerToken.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +src/Org.OpenAPITools/Client/HttpSigningToken.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/OAuthToken.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/Activity.cs +src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/Animal.cs +src/Org.OpenAPITools/Model/ApiResponse.cs +src/Org.OpenAPITools/Model/Apple.cs +src/Org.OpenAPITools/Model/AppleReq.cs +src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayTest.cs +src/Org.OpenAPITools/Model/Banana.cs +src/Org.OpenAPITools/Model/BananaReq.cs +src/Org.OpenAPITools/Model/BasquePig.cs +src/Org.OpenAPITools/Model/Capitalization.cs +src/Org.OpenAPITools/Model/Cat.cs +src/Org.OpenAPITools/Model/Category.cs +src/Org.OpenAPITools/Model/ChildCat.cs +src/Org.OpenAPITools/Model/ClassModel.cs +src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +src/Org.OpenAPITools/Model/DanishPig.cs +src/Org.OpenAPITools/Model/DateOnlyClass.cs +src/Org.OpenAPITools/Model/DeprecatedObject.cs +src/Org.OpenAPITools/Model/Dog.cs +src/Org.OpenAPITools/Model/Drawing.cs +src/Org.OpenAPITools/Model/EnumArrays.cs +src/Org.OpenAPITools/Model/EnumClass.cs +src/Org.OpenAPITools/Model/EnumTest.cs +src/Org.OpenAPITools/Model/EquilateralTriangle.cs +src/Org.OpenAPITools/Model/File.cs +src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +src/Org.OpenAPITools/Model/FormatTest.cs +src/Org.OpenAPITools/Model/Fruit.cs +src/Org.OpenAPITools/Model/FruitReq.cs +src/Org.OpenAPITools/Model/GmFruit.cs +src/Org.OpenAPITools/Model/GrandparentAnimal.cs +src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +src/Org.OpenAPITools/Model/HealthCheckResult.cs +src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs +src/Org.OpenAPITools/Model/Mammal.cs +src/Org.OpenAPITools/Model/MapTest.cs +src/Org.OpenAPITools/Model/MixLog.cs +src/Org.OpenAPITools/Model/MixedAnyOf.cs +src/Org.OpenAPITools/Model/MixedAnyOfContent.cs +src/Org.OpenAPITools/Model/MixedOneOf.cs +src/Org.OpenAPITools/Model/MixedOneOfContent.cs +src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/MixedSubId.cs +src/Org.OpenAPITools/Model/Model200Response.cs +src/Org.OpenAPITools/Model/ModelClient.cs +src/Org.OpenAPITools/Model/Name.cs +src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +src/Org.OpenAPITools/Model/NullableClass.cs +src/Org.OpenAPITools/Model/NullableGuidClass.cs +src/Org.OpenAPITools/Model/NullableShape.cs +src/Org.OpenAPITools/Model/NumberOnly.cs +src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +src/Org.OpenAPITools/Model/OneOfString.cs +src/Org.OpenAPITools/Model/Order.cs +src/Org.OpenAPITools/Model/OuterComposite.cs +src/Org.OpenAPITools/Model/OuterEnum.cs +src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumInteger.cs +src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumTest.cs +src/Org.OpenAPITools/Model/ParentPet.cs +src/Org.OpenAPITools/Model/Pet.cs +src/Org.OpenAPITools/Model/Pig.cs +src/Org.OpenAPITools/Model/PolymorphicProperty.cs +src/Org.OpenAPITools/Model/Quadrilateral.cs +src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs +src/Org.OpenAPITools/Model/Return.cs +src/Org.OpenAPITools/Model/RolesReportsHash.cs +src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +src/Org.OpenAPITools/Model/ScaleneTriangle.cs +src/Org.OpenAPITools/Model/Shape.cs +src/Org.OpenAPITools/Model/ShapeInterface.cs +src/Org.OpenAPITools/Model/ShapeOrNull.cs +src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +src/Org.OpenAPITools/Model/SpecialModelName.cs +src/Org.OpenAPITools/Model/Tag.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +src/Org.OpenAPITools/Model/Triangle.cs +src/Org.OpenAPITools/Model/TriangleInterface.cs +src/Org.OpenAPITools/Model/User.cs +src/Org.OpenAPITools/Model/Whale.cs +src/Org.OpenAPITools/Model/Zebra.cs +src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/README.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/api/openapi.yaml rename to samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/appveyor.yml b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/AnotherFakeApi.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/AnotherFakeApi.md new file mode 100644 index 000000000000..369488986579 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/AnotherFakeApi.md @@ -0,0 +1,99 @@ +# Org.OpenAPITools.Api.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** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class Call123TestSpecialTagsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new AnotherFakeApi(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test special tags + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the Call123TestSpecialTagsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test special tags + ApiResponse response = apiInstance.Call123TestSpecialTagsWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTagsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/DefaultApi.md new file mode 100644 index 000000000000..0bdfd6af3474 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/DefaultApi.md @@ -0,0 +1,429 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | | +| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | | +| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello | +| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | | +| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements | + + +# **FooGet** +> FooGetDefaultResponse FooGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FooGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + FooGetDefaultResponse result = apiInstance.FooGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.FooGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FooGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FooGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.FooGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.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 | - | + +[[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) + + +# **GetCountry** +> void GetCountry (string country) + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetCountryExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + var country = "country_example"; // string | + + try + { + apiInstance.GetCountry(country); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.GetCountry: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetCountryWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.GetCountryWithHttpInfo(country); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.GetCountryWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **country** | **string** | | | + +### Return type + +void (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** | OK | - | + +[[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) + + +# **Hello** +> List<Guid> Hello () + +Hello + +Hello + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class HelloExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + // Hello + List result = apiInstance.Hello(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.Hello: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the HelloWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Hello + ApiResponse> response = apiInstance.HelloWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.HelloWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**List** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | UUIDs | - | + +[[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) + + +# **RolesReportGet** +> List<List<RolesReportsHash>> RolesReportGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class RolesReportGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + List> result = apiInstance.RolesReportGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.RolesReportGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the RolesReportGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse>> response = apiInstance.RolesReportGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.RolesReportGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**List>** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | returns report | - | + +[[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** +> NotificationtestGetElementsV1ResponseMPayload Test () + +Retrieve an existing Notificationtest's Elements + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + // Retrieve an existing Notificationtest's Elements + NotificationtestGetElementsV1ResponseMPayload result = apiInstance.Test(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.Test: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Retrieve an existing Notificationtest's Elements + ApiResponse response = apiInstance.TestWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.TestWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**NotificationtestGetElementsV1ResponseMPayload**](NotificationtestGetElementsV1ResponseMPayload.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful response | - | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/apis/FakeApi.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/FakeApi.md new file mode 100644 index 000000000000..ba7ed134222e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/FakeApi.md @@ -0,0 +1,1830 @@ +# Org.OpenAPITools.Api.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 | +| [**GetMixedAnyOf**](FakeApi.md#getmixedanyof) | **GET** /fake/mixed/anyOf | Test mixed type anyOf deserialization | +| [**GetMixedOneOf**](FakeApi.md#getmixedoneof) | **GET** /fake/mixed/oneOf | Test mixed type oneOf deserialization | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**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 | +| [**TestInlineFreeformAdditionalProperties**](FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**TestQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | | +| [**TestStringMapReference**](FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map | + + +# **FakeHealthGet** +> HealthCheckResult FakeHealthGet () + +Health check endpoint + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeHealthGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Health check endpoint + HealthCheckResult result = apiInstance.FakeHealthGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeHealthGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeHealthGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Health check endpoint + ApiResponse response = apiInstance.FakeHealthGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeHealthGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **FakeOuterBooleanSerialize** +> bool FakeOuterBooleanSerialize (bool body = null) + + + +Test serialization of outer boolean types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterBooleanSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var body = true; // bool | Input boolean as post body (optional) + + try + { + bool result = apiInstance.FakeOuterBooleanSerialize(body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterBooleanSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterBooleanSerializeWithHttpInfo(body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **body** | **bool** | Input boolean as post body | [optional] | + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + +[[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) + + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize (OuterComposite outerComposite = null) + + + +Test serialization of object with outer number type + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterCompositeSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body (optional) + + try + { + OuterComposite result = apiInstance.FakeOuterCompositeSerialize(outerComposite); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterCompositeSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterCompositeSerializeWithHttpInfo(outerComposite); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **FakeOuterNumberSerialize** +> decimal FakeOuterNumberSerialize (decimal body = null) + + + +Test serialization of outer number types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterNumberSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var body = 8.14D; // decimal | Input number as post body (optional) + + try + { + decimal result = apiInstance.FakeOuterNumberSerialize(body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterNumberSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterNumberSerializeWithHttpInfo(body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + +[[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) + + +# **FakeOuterStringSerialize** +> string FakeOuterStringSerialize (Guid requiredStringUuid, string body = null) + + + +Test serialization of outer string types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterStringSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requiredStringUuid = "requiredStringUuid_example"; // Guid | Required UUID String + var body = "body_example"; // string | Input string as post body (optional) + + try + { + string result = apiInstance.FakeOuterStringSerialize(requiredStringUuid, body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterStringSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterStringSerializeWithHttpInfo(requiredStringUuid, body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requiredStringUuid** | **Guid** | Required UUID String | | +| **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 | - | + +[[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) + + +# **GetArrayOfEnums** +> List<OuterEnum> GetArrayOfEnums () + +Array of Enums + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetArrayOfEnumsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Array of Enums + List result = apiInstance.GetArrayOfEnums(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetArrayOfEnums: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetArrayOfEnumsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Array of Enums + ApiResponse> response = apiInstance.GetArrayOfEnumsWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetArrayOfEnumsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **GetMixedAnyOf** +> MixedAnyOf GetMixedAnyOf () + +Test mixed type anyOf deserialization + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetMixedAnyOfExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Test mixed type anyOf deserialization + MixedAnyOf result = apiInstance.GetMixedAnyOf(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetMixedAnyOf: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetMixedAnyOfWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Test mixed type anyOf deserialization + ApiResponse response = apiInstance.GetMixedAnyOfWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetMixedAnyOfWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**MixedAnyOf**](MixedAnyOf.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 mixed anyOf | - | + +[[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) + + +# **GetMixedOneOf** +> MixedOneOf GetMixedOneOf () + +Test mixed type oneOf deserialization + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetMixedOneOfExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Test mixed type oneOf deserialization + MixedOneOf result = apiInstance.GetMixedOneOf(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetMixedOneOf: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetMixedOneOfWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Test mixed type oneOf deserialization + ApiResponse response = apiInstance.GetMixedOneOfWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetMixedOneOfWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**MixedOneOf**](MixedOneOf.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 mixed oneOf | - | + +[[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) + + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestBodyWithFileSchema** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestBodyWithFileSchemaWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchemaWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestBodyWithQueryParams** +> void TestBodyWithQueryParams (string query, User user) + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithQueryParamsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var query = "query_example"; // string | + var user = new User(); // User | + + try + { + apiInstance.TestBodyWithQueryParams(query, user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParams: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestBodyWithQueryParamsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestBodyWithQueryParamsWithHttpInfo(query, user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParamsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestClientModel** +> ModelClient TestClientModel (ModelClient modelClient) + +To test \"client\" model + +To test \"client\" model + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClientModelExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test \"client\" model + ModelClient result = apiInstance.TestClientModel(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestClientModelWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test \"client\" model + ApiResponse response = apiInstance.TestClientModelWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestClientModelWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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) + + +# **TestEndpointParameters** +> void TestEndpointParameters (decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, System.IO.Stream binary = null, string callback = null, DateOnly date = null, DateTime dateTime = null, int int32 = null, long int64 = null, int integer = null, string password = null, float varFloat = null, string varString = null) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEndpointParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure HTTP basic authorization: http_basic_test + config.Username = "YOUR_USERNAME"; + config.Password = "YOUR_PASSWORD"; + + var apiInstance = new FakeApi(config); + var number = 8.14D; // decimal | None + var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // string | None + var varByte = System.Text.Encoding.ASCII.GetBytes("BYTE_ARRAY_DATA_HERE"); // byte[] | None + var varDouble = 1.2D; // double | None + var binary = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | None (optional) + var callback = "callback_example"; // string | None (optional) + var date = DateOnly.Parse("2013-10-20"); // DateOnly | None (optional) + var dateTime = DateTime.Parse(""2010-02-01T10:20:10.111110+01:00""); // DateTime | None (optional) (default to "2010-02-01T10:20:10.111110+01:00") + var int32 = 56; // int | None (optional) + var int64 = 789L; // long | None (optional) + var integer = 56; // int | None (optional) + var password = "password_example"; // string | None (optional) + var varFloat = 3.4F; // float | None (optional) + var varString = "varString_example"; // string | None (optional) + + try + { + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + apiInstance.TestEndpointParameters(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestEndpointParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + apiInstance.TestEndpointParametersWithHttpInfo(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestEndpointParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **number** | **decimal** | None | | +| **patternWithoutDelimiter** | **string** | None | | +| **varByte** | **byte[]** | None | | +| **varDouble** | **double** | None | | +| **binary** | **System.IO.Stream****System.IO.Stream** | None | [optional] | +| **callback** | **string** | None | [optional] | +| **date** | **DateOnly** | None | [optional] | +| **dateTime** | **DateTime** | None | [optional] [default to "2010-02-01T10:20:10.111110+01:00"] | +| **int32** | **int** | None | [optional] | +| **int64** | **long** | None | [optional] | +| **integer** | **int** | None | [optional] | +| **password** | **string** | None | [optional] | +| **varFloat** | **float** | None | [optional] | +| **varString** | **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 + + +### 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) + + +# **TestEnumParameters** +> void TestEnumParameters (string enumFormString = null, List enumFormStringArray = null, string enumHeaderString = null, List enumHeaderStringArray = null, double enumQueryDouble = null, int enumQueryInteger = null, string enumQueryString = null, List enumQueryStringArray = null) + +To test enum parameters + +To test enum parameters + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEnumParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var enumFormString = "_abc"; // string | Form parameter enum test (string) (optional) (default to -efg) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) + var enumHeaderString = "_abc"; // string | Header parameter enum test (string) (optional) (default to -efg) + var enumHeaderStringArray = new List(); // List | Header parameter enum test (string array) (optional) + var enumQueryDouble = 1.1D; // double | Query parameter enum test (double) (optional) + var enumQueryInteger = 1; // int | Query parameter enum test (double) (optional) + var enumQueryString = "_abc"; // string | Query parameter enum test (string) (optional) (default to -efg) + var enumQueryStringArray = new List(); // List | Query parameter enum test (string array) (optional) + + try + { + // To test enum parameters + apiInstance.TestEnumParameters(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestEnumParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test enum parameters + apiInstance.TestEnumParametersWithHttpInfo(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestEnumParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **enumFormString** | **string** | Form parameter enum test (string) | [optional] [default to -efg] | +| **enumFormStringArray** | [**List<string>**](string.md) | Form parameter enum test (string array) | [optional] [default to $] | +| **enumHeaderString** | **string** | Header parameter enum test (string) | [optional] [default to -efg] | +| **enumHeaderStringArray** | [**List<string>**](string.md) | Header parameter enum test (string array) | [optional] | +| **enumQueryDouble** | **double** | Query parameter enum test (double) | [optional] | +| **enumQueryInteger** | **int** | Query parameter enum test (double) | [optional] | +| **enumQueryString** | **string** | Query parameter enum test (string) | [optional] [default to -efg] | +| **enumQueryStringArray** | [**List<string>**](string.md) | Query parameter enum test (string array) | [optional] | + +### Return type + +void (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 | - | + +[[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) + + +# **TestGroupParameters** +> void TestGroupParameters (bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, bool booleanGroup = null, long int64Group = null, int stringGroup = null) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestGroupParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure Bearer token for authorization: bearer_test + config.AccessToken = "YOUR_BEARER_TOKEN"; + + var apiInstance = new FakeApi(config); + var requiredBooleanGroup = true; // bool | Required Boolean in group parameters + var requiredInt64Group = 789L; // long | Required Integer in group parameters + var requiredStringGroup = 56; // int | Required String in group parameters + var booleanGroup = true; // bool | Boolean in group parameters (optional) + var int64Group = 789L; // long | Integer in group parameters (optional) + var stringGroup = 56; // int | String in group parameters (optional) + + try + { + // Fake endpoint to test group parameters (optional) + apiInstance.TestGroupParameters(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestGroupParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestGroupParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Fake endpoint to test group parameters (optional) + apiInstance.TestGroupParametersWithHttpInfo(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestGroupParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requiredBooleanGroup** | **bool** | Required Boolean in group parameters | | +| **requiredInt64Group** | **long** | Required Integer in group parameters | | +| **requiredStringGroup** | **int** | Required String in group parameters | | +| **booleanGroup** | **bool** | Boolean in group parameters | [optional] | +| **int64Group** | **long** | Integer in group parameters | [optional] | +| **stringGroup** | **int** | String 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + +[[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) + + +# **TestInlineAdditionalProperties** +> void TestInlineAdditionalProperties (Dictionary requestBody) + +test inline additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestInlineAdditionalPropertiesExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test inline additionalProperties + apiInstance.TestInlineAdditionalProperties(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestInlineAdditionalPropertiesWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test inline additionalProperties + apiInstance.TestInlineAdditionalPropertiesWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalPropertiesWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, string>**](string.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestInlineFreeformAdditionalProperties** +> void TestInlineFreeformAdditionalProperties (TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestInlineFreeformAdditionalPropertiesExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + + try + { + // test inline free-form additionalProperties + apiInstance.TestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalProperties: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestInlineFreeformAdditionalPropertiesWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test inline free-form additionalProperties + apiInstance.TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalPropertiesWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestJsonFormData** +> void TestJsonFormData (string param, string param2) + +test json serialization of form data + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestJsonFormDataExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var param = "param_example"; // string | field1 + var param2 = "param2_example"; // string | field2 + + try + { + // test json serialization of form data + apiInstance.TestJsonFormData(param, param2); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestJsonFormDataWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test json serialization of form data + apiInstance.TestJsonFormDataWithHttpInfo(param, param2); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestJsonFormDataWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### 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) + + +# **TestQueryParameterCollectionFormat** +> void TestQueryParameterCollectionFormat (List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, string notRequiredNotNullable = null, string notRequiredNullable = null, string requiredNullable) + + + +To test the collection format in query parameters + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestQueryParameterCollectionFormatExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var context = new List(); // List | + var http = new List(); // List | + var ioutil = new List(); // List | + var pipe = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var url = new List(); // List | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) + var requiredNullable = "requiredNullable_example"; // string | + + try + { + apiInstance.TestQueryParameterCollectionFormat(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestQueryParameterCollectionFormat: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestQueryParameterCollectionFormatWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestQueryParameterCollectionFormatWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **context** | [**List<string>**](string.md) | | | +| **http** | [**List<string>**](string.md) | | | +| **ioutil** | [**List<string>**](string.md) | | | +| **pipe** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **url** | [**List<string>**](string.md) | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | +| **requiredNullable** | **string** | | | + +### 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 | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestStringMapReference** +> void TestStringMapReference (Dictionary requestBody) + +test referenced string map + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestStringMapReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced string map + apiInstance.TestStringMapReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestStringMapReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestStringMapReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced string map + apiInstance.TestStringMapReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestStringMapReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, string>**](string.md) | request body | | + +### Return type + +void (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 | - | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/apis/FakeClassnameTags123Api.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..dfe1adefd0a7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/FakeClassnameTags123Api.md @@ -0,0 +1,104 @@ +# Org.OpenAPITools.Api.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** +> ModelClient TestClassname (ModelClient modelClient) + +To test class name in snake case + +To test class name in snake case + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClassnameExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key_query + config.AddApiKey("api_key_query", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key_query", "Bearer"); + + var apiInstance = new FakeClassnameTags123Api(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test class name in snake case + ModelClient result = apiInstance.TestClassname(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestClassnameWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test class name in snake case + ApiResponse response = apiInstance.TestClassnameWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassnameWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/PetApi.md new file mode 100644 index 000000000000..92e5a48277df --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/PetApi.md @@ -0,0 +1,862 @@ +# Org.OpenAPITools.Api.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** +> void AddPet (Pet pet) + +Add a new pet to the store + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class AddPetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(pet); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the AddPetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Add a new pet to the store + apiInstance.AddPetWithHttpInfo(pet); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.AddPetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **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) + + +# **DeletePet** +> void DeletePet (long petId, string apiKey = null) + +Deletes a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeletePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | Pet id to delete + var apiKey = "apiKey_example"; // string | (optional) + + try + { + // Deletes a pet + apiInstance.DeletePet(petId, apiKey); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeletePetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Deletes a pet + apiInstance.DeletePetWithHttpInfo(petId, apiKey); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.DeletePetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | Pet id to delete | | +| **apiKey** | **string** | | [optional] | + +### 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** +> List<Pet> FindPetsByStatus (List status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByStatusExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var status = new List(); // List | Status values that need to be considered for filter + + try + { + // Finds Pets by status + List result = apiInstance.FindPetsByStatus(status); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FindPetsByStatusWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Finds Pets by status + ApiResponse> response = apiInstance.FindPetsByStatusWithHttpInfo(status); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.FindPetsByStatusWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **status** | [**List<string>**](string.md) | Status values that need to be considered for filter | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | + +[[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** +> List<Pet> FindPetsByTags (List tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByTagsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var tags = new List(); // List | Tags to filter by + + try + { + // Finds Pets by tags + List result = apiInstance.FindPetsByTags(tags); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FindPetsByTagsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Finds Pets by tags + ApiResponse> response = apiInstance.FindPetsByTagsWithHttpInfo(tags); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.FindPetsByTagsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **tags** | [**List<string>**](string.md) | Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 (long petId) + +Find pet by ID + +Returns a single pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetPetByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api-key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api-key", "Bearer"); + // Configure API key authorization: api_key_query + config.AddApiKey("api_key_query", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key_query", "Bearer"); + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to return + + try + { + // Find pet by ID + Pet result = apiInstance.GetPetById(petId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetPetByIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Find pet by ID + ApiResponse response = apiInstance.GetPetByIdWithHttpInfo(petId); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.GetPetByIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key), [api_key_query](../README.md#api_key_query) + +### 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** +> void UpdatePet (Pet pet) + +Update an existing pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + apiInstance.UpdatePet(pet); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdatePetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Update an existing pet + apiInstance.UpdatePetWithHttpInfo(pet); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UpdatePetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 | - | + +[[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** +> void UpdatePetWithForm (long petId, string name = null, string status = null) + +Updates a pet in the store with form data + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetWithFormExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet that needs to be updated + var name = "name_example"; // string | Updated name of the pet (optional) + var status = "status_example"; // string | Updated status of the pet (optional) + + try + { + // Updates a pet in the store with form data + apiInstance.UpdatePetWithForm(petId, name, status); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdatePetWithFormWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Updates a pet in the store with form data + apiInstance.UpdatePetWithFormWithHttpInfo(petId, name, status); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UpdatePetWithFormWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet that needs to be updated | | +| **name** | **string** | Updated name of the pet | [optional] | +| **status** | **string** | Updated status of the pet | [optional] | + +### Return type + +void (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 (long petId, string additionalMetadata = null, System.IO.Stream file = null) + +uploads an image + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to update + var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional) + var file = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload (optional) + + try + { + // uploads an image + ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UploadFileWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // uploads an image + ApiResponse response = apiInstance.UploadFileWithHttpInfo(petId, additionalMetadata, file); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UploadFileWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to update | | +| **additionalMetadata** | **string** | Additional data to pass to server | [optional] | +| **file** | **System.IO.Stream****System.IO.Stream** | file to upload | [optional] | + +### Return type + +[**ApiResponse**](ApiResponse.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 | - | + +[[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) + + +# **UploadFileWithRequiredFile** +> ApiResponse UploadFileWithRequiredFile (long petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to update + var requiredFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload + var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UploadFileWithRequiredFileWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // uploads an image (required) + ApiResponse response = apiInstance.UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFileWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to update | | +| **requiredFile** | **System.IO.Stream****System.IO.Stream** | file to upload | | +| **additionalMetadata** | **string** | Additional data to pass to server | [optional] | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + +### 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/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/StoreApi.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/StoreApi.md new file mode 100644 index 000000000000..e169ad74f907 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/StoreApi.md @@ -0,0 +1,373 @@ +# Org.OpenAPITools.Api.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** +> void DeleteOrder (string 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 +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var orderId = "orderId_example"; // string | ID of the order that needs to be deleted + + try + { + // Delete purchase order by ID + apiInstance.DeleteOrder(orderId); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeleteOrderWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Delete purchase order by ID + apiInstance.DeleteOrderWithHttpInfo(orderId); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.DeleteOrderWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **orderId** | **string** | ID of the order that needs to be deleted | | + +### 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** +> Dictionary<string, int> GetInventory () + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetInventoryExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api-key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api-key", "Bearer"); + + var apiInstance = new StoreApi(config); + + try + { + // Returns pet inventories by status + Dictionary result = apiInstance.GetInventory(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetInventoryWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Returns pet inventories by status + ApiResponse> response = apiInstance.GetInventoryWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.GetInventoryWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**Dictionary** + +### 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 (long orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetOrderByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var orderId = 789L; // long | ID of pet that needs to be fetched + + try + { + // Find purchase order by ID + Order result = apiInstance.GetOrderById(orderId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetOrderByIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Find purchase order by ID + ApiResponse response = apiInstance.GetOrderByIdWithHttpInfo(orderId); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.GetOrderByIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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 order) + +Place an order for a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class PlaceOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var order = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + Order result = apiInstance.PlaceOrder(order); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the PlaceOrderWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Place an order for a pet + ApiResponse response = apiInstance.PlaceOrderWithHttpInfo(order); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.PlaceOrderWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/apis/UserApi.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/UserApi.md new file mode 100644 index 000000000000..34064e25c4a8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/UserApi.md @@ -0,0 +1,715 @@ +# Org.OpenAPITools.Api.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** +> void CreateUser (User user) + +Create user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Create user + apiInstance.CreateUserWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**User**](User.md) | Created user object | | + +### Return type + +void (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 | - | + +[[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** +> void CreateUsersWithArrayInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithArrayInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUsersWithArrayInputWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInputWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInputWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**List<User>**](User.md) | List of user object | | + +### Return type + +void (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 | - | + +[[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** +> void CreateUsersWithListInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithListInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUsersWithListInputWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Creates list of users with given input array + apiInstance.CreateUsersWithListInputWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUsersWithListInputWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**List<User>**](User.md) | List of user object | | + +### Return type + +void (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 | - | + +[[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** +> void DeleteUser (string username) + +Delete user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var username = "username_example"; // string | The name that needs to be deleted + + try + { + // Delete user + apiInstance.DeleteUser(username); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeleteUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Delete user + apiInstance.DeleteUserWithHttpInfo(username); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.DeleteUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **username** | **string** | The name that needs to be deleted | | + +### 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 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 (string username) + +Get user by user name + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetUserByNameExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var username = "username_example"; // string | The name that needs to be fetched. Use user1 for testing. + + try + { + // Get user by user name + User result = apiInstance.GetUserByName(username); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetUserByNameWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Get user by user name + ApiResponse response = apiInstance.GetUserByNameWithHttpInfo(username); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.GetUserByNameWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | +| **598** | Not a real HTTP status code | - | +| **599** | Not a real HTTP status code with a return object | - | + +[[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 (string password, string username) + +Logs user into the system + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LoginUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var password = "password_example"; // string | The password for login in clear text + var username = "username_example"; // string | The user name for login + + try + { + // Logs user into the system + string result = apiInstance.LoginUser(password, username); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the LoginUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Logs user into the system + ApiResponse response = apiInstance.LoginUserWithHttpInfo(password, username); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.LoginUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **password** | **string** | The password for login in clear text | | +| **username** | **string** | The user name for login | | + +### 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** +> void LogoutUser () + +Logs out current logged in user session + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LogoutUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + + try + { + // Logs out current logged in user session + apiInstance.LogoutUser(); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the LogoutUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Logs out current logged in user session + apiInstance.LogoutUserWithHttpInfo(); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.LogoutUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### 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 | +|-------------|-------------|------------------| +| **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** +> void UpdateUser (User user, string username) + +Updated user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new User(); // User | Updated user object + var username = "username_example"; // string | name that need to be deleted + + try + { + // Updated user + apiInstance.UpdateUser(user, username); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdateUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Updated user + apiInstance.UpdateUserWithHttpInfo(user, username); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.UpdateUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**User**](User.md) | Updated user object | | +| **username** | **string** | name that need to be deleted | | + +### Return type + +void (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 | - | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/Activity.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Activity.md new file mode 100644 index 000000000000..6f69ec32545d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Activity.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Activity +test map of maps + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ActivityOutputs** | **Dictionary<string, List<ActivityOutputElementRepresentation>>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ActivityOutputElementRepresentation.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ActivityOutputElementRepresentation.md new file mode 100644 index 000000000000..33d79a27692f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ActivityOutputElementRepresentation.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ActivityOutputElementRepresentation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Prop1** | **string** | | [optional] +**Prop2** | **Object** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..2bbe882fcfcc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/AdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# Org.OpenAPITools.Model.AdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Anytype1** | **Object** | | [optional] +**EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] +**MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MapProperty** | **Dictionary<string, string>** | | [optional] +**MapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] +**MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] +**MapWithUndeclaredPropertiesAnytype3** | **Dictionary<string, Object>** | | [optional] +**MapWithUndeclaredPropertiesString** | **Dictionary<string, string>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Animal.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Animal.md new file mode 100644 index 000000000000..1a1760bd8697 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Animal.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Animal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/ApiResponse.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ApiResponse.md new file mode 100644 index 000000000000..d89ed1a25dc7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ApiResponse.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.ApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int** | | [optional] +**Message** | **string** | | [optional] +**Type** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Apple.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Apple.md new file mode 100644 index 000000000000..9ad1da8cd688 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Apple.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ColorCode** | **string** | | [optional] +**Cultivar** | **string** | | [optional] +**Origin** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/AppleReq.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/AppleReq.md new file mode 100644 index 000000000000..325521123f12 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/AppleReq.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.AppleReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | **string** | | +**Mealy** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..a23ba59e609c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ArrayOfArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | **List<List<decimal>>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ArrayOfNumberOnly.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..10b8413439b8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | **List<decimal>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ArrayTest.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ArrayTest.md new file mode 100644 index 000000000000..ed572120cd6d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ArrayTest.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.ArrayTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayOfInteger** | **List<List<long>>** | | [optional] +**ArrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] +**ArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Banana.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Banana.md new file mode 100644 index 000000000000..d32e90cf2985 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Banana.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/BananaReq.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/BananaReq.md new file mode 100644 index 000000000000..c8372b73c5f7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/BananaReq.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.BananaReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **decimal** | | +**Sweet** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/BasquePig.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/BasquePig.md new file mode 100644 index 000000000000..db4f7a362268 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/BasquePig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.BasquePig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/Capitalization.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Capitalization.md new file mode 100644 index 000000000000..9e225c17232a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Capitalization.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Capitalization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ATT_NAME** | **string** | Name of the pet | [optional] +**CapitalCamel** | **string** | | [optional] +**CapitalSnake** | **string** | | [optional] +**SCAETHFlowPoints** | **string** | | [optional] +**SmallCamel** | **string** | | [optional] +**SmallSnake** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Cat.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Cat.md new file mode 100644 index 000000000000..310a5e6575ec --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Cat.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Cat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Declawed** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Category.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Category.md new file mode 100644 index 000000000000..6eb0a2e13eaa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Category.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/ChildCat.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ChildCat.md new file mode 100644 index 000000000000..88fe8f7a7fdd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ChildCat.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ChildCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] +**PetType** | **string** | | [default to PetTypeEnum.ChildCat] + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/ClassModel.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ClassModel.md new file mode 100644 index 000000000000..bb35816c9148 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ClassModel.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ClassModel +Model for testing model with \"_class\" property + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ComplexQuadrilateral.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ComplexQuadrilateral.md new file mode 100644 index 000000000000..fb00d4ebf089 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ComplexQuadrilateral.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ComplexQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/DanishPig.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/DanishPig.md new file mode 100644 index 000000000000..4d6ec1400a7e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/DanishPig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DanishPig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/DateOnlyClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/DateOnlyClass.md new file mode 100644 index 000000000000..4fc3775ed87d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/DateOnlyClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DateOnlyClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateOnlyProperty** | **DateOnly** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/DeprecatedObject.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/DeprecatedObject.md new file mode 100644 index 000000000000..e90c59555a0d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/DeprecatedObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DeprecatedObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Dog.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Dog.md new file mode 100644 index 000000000000..70cdc80e83e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Dog.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Dog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Breed** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Drawing.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Drawing.md new file mode 100644 index 000000000000..95f49b2ed600 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Drawing.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.Drawing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MainShape** | [**Shape**](Shape.md) | | [optional] +**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional] +**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**Shapes** | [**List<Shape>**](Shape.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumArrays.md new file mode 100644 index 000000000000..7467f67978c5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumArrays.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.EnumArrays + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**JustSymbol** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumClass.md new file mode 100644 index 000000000000..d259f0f46968 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumClass.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.EnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumTest.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumTest.md new file mode 100644 index 000000000000..ebd7ccf2c864 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EnumTest.md @@ -0,0 +1,18 @@ +# Org.OpenAPITools.Model.EnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | +**EnumInteger** | **int** | | [optional] +**EnumIntegerOnly** | **int** | | [optional] +**EnumNumber** | **double** | | [optional] +**EnumString** | **string** | | [optional] +**OuterEnum** | **OuterEnum** | | [optional] +**OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**OuterEnumInteger** | **OuterEnumInteger** | | [optional] +**OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EquilateralTriangle.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EquilateralTriangle.md new file mode 100644 index 000000000000..8360b5c16a5b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/EquilateralTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.EquilateralTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/File.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/File.md new file mode 100644 index 000000000000..58b9c2fc3698 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/File.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.File +Must be named `File` for test. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **string** | Test capitalization | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FileSchemaTestClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FileSchemaTestClass.md new file mode 100644 index 000000000000..a47efad77d8a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | [**File**](File.md) | | [optional] +**Files** | [**List<File>**](File.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Foo.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Foo.md new file mode 100644 index 000000000000..b9e7d261736f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Foo.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Foo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to "bar"] + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/FooGetDefaultResponse.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FooGetDefaultResponse.md new file mode 100644 index 000000000000..47e50daca3e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FormatTest.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FormatTest.md new file mode 100644 index 000000000000..1009f35198fb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FormatTest.md @@ -0,0 +1,33 @@ +# Org.OpenAPITools.Model.FormatTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Byte** | **byte[]** | | +**Date** | **DateOnly** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] +**DateTime** | **DateTime** | | [optional] +**Decimal** | **decimal** | | [optional] +**Double** | **double** | | [optional] +**Float** | **float** | | [optional] +**Int32** | **int** | | [optional] +**Int32Range** | **int** | | [optional] +**Int64** | **long** | | [optional] +**Int64Negative** | **long** | | [optional] +**Int64NegativeExclusive** | **long** | | [optional] +**Int64Positive** | **long** | | [optional] +**Int64PositiveExclusive** | **long** | | [optional] +**Integer** | **int** | | [optional] +**PatternWithBackslash** | **string** | None | [optional] +**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] +**String** | **string** | | [optional] +**UnsignedInteger** | **uint** | | [optional] +**UnsignedLong** | **ulong** | | [optional] +**Uuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Fruit.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Fruit.md new file mode 100644 index 000000000000..b3bee18f7ba0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Fruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Fruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FruitReq.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FruitReq.md new file mode 100644 index 000000000000..38ab0c1a6caa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/FruitReq.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.FruitReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/GmFruit.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/GmFruit.md new file mode 100644 index 000000000000..584c4fd323d8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/GmFruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.GmFruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/GrandparentAnimal.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/GrandparentAnimal.md new file mode 100644 index 000000000000..eca96162b6f8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/GrandparentAnimal.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.GrandparentAnimal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/HasOnlyReadOnly.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/HasOnlyReadOnly.md new file mode 100644 index 000000000000..060a614a6981 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.HasOnlyReadOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [readonly] +**Foo** | **string** | | [optional] [readonly] + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/HealthCheckResult.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/HealthCheckResult.md new file mode 100644 index 000000000000..682cfc50e3a4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/HealthCheckResult.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.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] + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/IsoscelesTriangle.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/IsoscelesTriangle.md new file mode 100644 index 000000000000..07c62ac93382 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/IsoscelesTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.IsoscelesTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/List.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/List.md new file mode 100644 index 000000000000..0b54858ac247 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/List.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.List + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Var123List** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/LiteralStringClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/LiteralStringClass.md new file mode 100644 index 000000000000..782021909655 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/Mammal.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Mammal.md new file mode 100644 index 000000000000..ac14f00c0ff0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Mammal.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Mammal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/MapTest.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MapTest.md new file mode 100644 index 000000000000..5dd27228bb06 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MapTest.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.MapTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DirectMap** | **Dictionary<string, bool>** | | [optional] +**IndirectMap** | **Dictionary<string, bool>** | | [optional] +**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MapOfEnumString** | **Dictionary<string, MapTest.InnerEnum>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixLog.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixLog.md new file mode 100644 index 000000000000..5184c03bea97 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixLog.md @@ -0,0 +1,41 @@ +# Org.OpenAPITools.Model.MixLog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Description** | **string** | | +**FormulaVersionDate** | **DateTime** | | +**Id** | **Guid** | | +**MixDate** | **DateTime** | | +**TotalOverPoors** | **int** | | +**TotalRecalculations** | **int** | | +**TotalSkips** | **int** | | +**TotalUnderPours** | **int** | | +**BatchNumber** | **string** | | [optional] +**BrandCode** | **string** | BrandCode is only required for non-color mixes | [optional] +**BrandId** | **string** | BrandId is only required for color mixes | [optional] +**BrandName** | **string** | BrandName is only required for color mixes | [optional] +**CategoryCode** | **string** | CategoryCode is not used anymore | [optional] +**Color** | **string** | Color is only required for color mixes | [optional] +**ColorDescription** | **string** | | [optional] +**Comment** | **string** | | [optional] +**CommercialProductCode** | **string** | | [optional] +**Country** | **string** | | [optional] +**CreatedBy** | **string** | | [optional] +**CreatedByFirstName** | **string** | | [optional] +**CreatedByLastName** | **string** | | [optional] +**DeltaECalculationRepaired** | **string** | | [optional] +**DeltaECalculationSprayout** | **string** | | [optional] +**OwnColorVariantNumber** | **int** | | [optional] +**PrimerProductId** | **string** | | [optional] +**ProductId** | **string** | ProductId is only required for color mixes | [optional] +**ProductLineCode** | **string** | ProductLineCode is only required for color mixes | [optional] +**ProductName** | **string** | ProductName is only required for color mixes | [optional] +**SelectedVersionIndex** | **int** | | [optional] +**ShopId** | **Guid** | | [optional] +**SomeCode** | **string** | SomeCode is only required for color mixes | [optional] +**TotalPrice** | **float** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedAnyOf.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedAnyOf.md new file mode 100644 index 000000000000..2e9a2ca23f67 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedAnyOf.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedAnyOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Content** | [**MixedAnyOfContent**](MixedAnyOfContent.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedAnyOfContent.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedAnyOfContent.md new file mode 100644 index 000000000000..141ffe5a41dc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedAnyOfContent.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedAnyOfContent +Mixed anyOf types for testing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedOneOf.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedOneOf.md new file mode 100644 index 000000000000..6cb1d5adff01 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedOneOf.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Content** | [**MixedOneOfContent**](MixedOneOfContent.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedOneOfContent.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedOneOfContent.md new file mode 100644 index 000000000000..168d5ee83628 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedOneOfContent.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedOneOfContent +Mixed oneOf types for testing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..1bc0740add9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.MixedPropertiesAndAdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateTime** | **DateTime** | | [optional] +**Map** | [**Dictionary<string, Animal>**](Animal.md) | | [optional] +**Uuid** | **Guid** | | [optional] +**UuidWithPattern** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedSubId.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedSubId.md new file mode 100644 index 000000000000..1df3d4002bf5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/MixedSubId.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedSubId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Model200Response.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Model200Response.md new file mode 100644 index 000000000000..2752a0d87c82 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Model200Response.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Model200Response +Model for testing model name starting with number + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **string** | | [optional] +**Name** | **int** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ModelClient.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ModelClient.md new file mode 100644 index 000000000000..c658e84ef57e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ModelClient.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ModelClient + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarClient** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Name.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Name.md new file mode 100644 index 000000000000..ffe61a31d61b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Name.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Name +Model for testing model name same as property name + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarName** | **int** | | +**Property** | **string** | | [optional] +**SnakeCase** | **int** | | [optional] [readonly] +**Var123Number** | **int** | | [optional] [readonly] + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/NotificationtestGetElementsV1ResponseMPayload.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NotificationtestGetElementsV1ResponseMPayload.md new file mode 100644 index 000000000000..25f223a8360a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NotificationtestGetElementsV1ResponseMPayload.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AObjVariableobject** | **List<Dictionary<string, Object>>** | | +**PkiNotificationtestID** | **int** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/NullableClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NullableClass.md new file mode 100644 index 000000000000..c9afe86510da --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NullableClass.md @@ -0,0 +1,21 @@ +# Org.OpenAPITools.Model.NullableClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayAndItemsNullableProp** | **List<Object>** | | [optional] +**ArrayItemsNullable** | **List<Object>** | | [optional] +**ArrayNullableProp** | **List<Object>** | | [optional] +**BooleanProp** | **bool** | | [optional] +**DateProp** | **DateOnly** | | [optional] +**DatetimeProp** | **DateTime** | | [optional] +**IntegerProp** | **int** | | [optional] +**NumberProp** | **decimal** | | [optional] +**ObjectAndItemsNullableProp** | **Dictionary<string, Object>** | | [optional] +**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] +**ObjectNullableProp** | **Dictionary<string, Object>** | | [optional] +**StringProp** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NullableGuidClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NullableGuidClass.md new file mode 100644 index 000000000000..8d939afe9984 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NullableGuidClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.NullableGuidClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NullableShape.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NullableShape.md new file mode 100644 index 000000000000..2720167ccaaa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NullableShape.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.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. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/NumberOnly.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NumberOnly.md new file mode 100644 index 000000000000..1b83cce764d3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/NumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.NumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ObjectWithDeprecatedFields.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..9f44c24d19ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ObjectWithDeprecatedFields.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.ObjectWithDeprecatedFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bars** | **List<string>** | | [optional] +**DeprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**Id** | **decimal** | | [optional] +**Uuid** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OneOfString.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OneOfString.md new file mode 100644 index 000000000000..54caf618776c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OneOfString.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OneOfString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/Order.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Order.md new file mode 100644 index 000000000000..f7d6827ed5c9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Order.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Complete** | **bool** | | [optional] [default to false] +**Id** | **long** | | [optional] +**PetId** | **long** | | [optional] +**Quantity** | **int** | | [optional] +**ShipDate** | **DateTime** | | [optional] +**Status** | **string** | Order Status | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterComposite.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterComposite.md new file mode 100644 index 000000000000..8985c59d094f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterComposite.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.OuterComposite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyBoolean** | **bool** | | [optional] +**MyNumber** | **decimal** | | [optional] +**MyString** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnum.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnum.md new file mode 100644 index 000000000000..36844bc4b175 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnum.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumDefaultValue.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..351383f0aeae --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumDefaultValue.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumInteger.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumInteger.md new file mode 100644 index 000000000000..1013b5b19565 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumInteger.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..55e314e3102d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumIntegerDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumTest.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumTest.md new file mode 100644 index 000000000000..b99d27c2c2e7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/OuterEnumTest.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/ParentPet.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ParentPet.md new file mode 100644 index 000000000000..bdf570056372 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ParentPet.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ParentPet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/Pet.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Pet.md new file mode 100644 index 000000000000..4f019b613bd7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Pet.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Pet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] +**Status** | **string** | pet status in the store | [optional] +**Tags** | [**List<Tag>**](Tag.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Pig.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Pig.md new file mode 100644 index 000000000000..fd7bb9359ac4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Pig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Pig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/PolymorphicProperty.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/PolymorphicProperty.md new file mode 100644 index 000000000000..4507ec41cd51 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/PolymorphicProperty.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.PolymorphicProperty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/Quadrilateral.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Quadrilateral.md new file mode 100644 index 000000000000..fbbf4f81cec6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Quadrilateral.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Quadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/QuadrilateralInterface.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/QuadrilateralInterface.md new file mode 100644 index 000000000000..756ba09c6ddf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/QuadrilateralInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.QuadrilateralInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/ReadOnlyFirst.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ReadOnlyFirst.md new file mode 100644 index 000000000000..afaf2ee4fb6c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ReadOnlyFirst + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [readonly] +**Baz** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/RequiredClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/RequiredClass.md new file mode 100644 index 000000000000..990aeb5de3d7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateOnly** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateOnly** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotRequiredNullableDateProp** | **DateOnly** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateOnly** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/Return.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Return.md new file mode 100644 index 000000000000..ad96a170bbbb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Return.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Return +Model for testing reserved words + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Lock** | **string** | | +**Abstract** | **string** | | +**VarReturn** | **int** | | [optional] +**Unsafe** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/RolesReportsHash.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/RolesReportsHash.md new file mode 100644 index 000000000000..d92c01de9ef7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/RolesReportsHash.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.RolesReportsHash +Role report Hash + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Role** | [**RolesReportsHashRole**](RolesReportsHashRole.md) | | [optional] +**RoleUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/RolesReportsHashRole.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/RolesReportsHashRole.md new file mode 100644 index 000000000000..760f77b30e78 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/RolesReportsHashRole.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.RolesReportsHashRole + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ScaleneTriangle.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ScaleneTriangle.md new file mode 100644 index 000000000000..d3f15354bccc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ScaleneTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ScaleneTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/Shape.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Shape.md new file mode 100644 index 000000000000..ae75c5925401 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Shape.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Shape + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/ShapeInterface.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ShapeInterface.md new file mode 100644 index 000000000000..882d31868305 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ShapeInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ShapeInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/ShapeOrNull.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ShapeOrNull.md new file mode 100644 index 000000000000..7fcd31a3a5e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ShapeOrNull.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ShapeOrNull +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/SimpleQuadrilateral.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/SimpleQuadrilateral.md new file mode 100644 index 000000000000..a9c7f93b67ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/SimpleQuadrilateral.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.SimpleQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/SpecialModelName.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/SpecialModelName.md new file mode 100644 index 000000000000..890bcd923dee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/SpecialModelName.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.SpecialModelName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarSpecialModelName** | **string** | | [optional] +**SpecialPropertyName** | **long** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Tag.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Tag.md new file mode 100644 index 000000000000..2b2d9674d619 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Tag.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TestCollectionEndingWithWordList.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TestCollectionEndingWithWordList.md new file mode 100644 index 000000000000..5c5eb22d9a8a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TestCollectionEndingWithWordList.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestCollectionEndingWithWordList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Value** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TestCollectionEndingWithWordListObject.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TestCollectionEndingWithWordListObject.md new file mode 100644 index 000000000000..cfa933cc576e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TestCollectionEndingWithWordListObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestCollectionEndingWithWordListObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TestCollectionEndingWithWordList** | [**List<TestCollectionEndingWithWordList>**](TestCollectionEndingWithWordList.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..b6f9fc948474 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestInlineFreeformAdditionalPropertiesRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SomeProperty** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Triangle.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Triangle.md new file mode 100644 index 000000000000..e15109911958 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Triangle.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Triangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/TriangleInterface.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TriangleInterface.md new file mode 100644 index 000000000000..4127c08b14f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/TriangleInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TriangleInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/User.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/User.md new file mode 100644 index 000000000000..b5700f1c75d9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/User.md @@ -0,0 +1,21 @@ +# Org.OpenAPITools.Model.User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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] +**Email** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**Id** | **long** | | [optional] +**LastName** | **string** | | [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] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int** | User Status | [optional] +**Username** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Whale.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Whale.md new file mode 100644 index 000000000000..1c633fdce61b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Whale.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Whale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**HasBaleen** | **bool** | | [optional] +**HasTeeth** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Zebra.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Zebra.md new file mode 100644 index 000000000000..aef3866b92c9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/Zebra.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Zebra + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Type** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ZeroBasedEnum.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ZeroBasedEnum.md new file mode 100644 index 000000000000..cb71966c4c81 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ZeroBasedEnum.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ZeroBasedEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/NullReferenceTypes/docs/models/ZeroBasedEnumClass.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ZeroBasedEnumClass.md new file mode 100644 index 000000000000..614d00cbe878 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/models/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs new file mode 100644 index 000000000000..53d2c74655f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing AnotherFakeApi + /// + public sealed class AnotherFakeApiTests : ApiTestsBase + { + private readonly IAnotherFakeApi _instance; + + public AnotherFakeApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test Call123TestSpecialTags + /// + [Fact (Skip = "not implemented")] + public async Task Call123TestSpecialTagsAsyncTest() + { + ModelClient modelClient = default!; + var response = await _instance.Call123TestSpecialTagsAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..03ad026fa146 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,81 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + string apiKeyTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken2 = new(apiKeyTokenValue2, ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + string bearerTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + BearerToken bearerToken1 = new(bearerTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + string basicTokenUsername1 = context.Configuration[""] ?? throw new Exception("Username not found."); + string basicTokenPassword1 = context.Configuration[""] ?? throw new Exception("Password not found."); + BasicToken basicToken1 = new(basicTokenUsername1, basicTokenPassword1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 000000000000..3e6e9af57c4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing DefaultApi + /// + public sealed class DefaultApiTests : ApiTestsBase + { + private readonly IDefaultApi _instance; + + public DefaultApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test FooGet + /// + [Fact (Skip = "not implemented")] + public async Task FooGetAsyncTest() + { + var response = await _instance.FooGetAsync(); + var model = response.Default(); + Assert.IsType(model); + } + + /// + /// Test GetCountry + /// + [Fact (Skip = "not implemented")] + public async Task GetCountryAsyncTest() + { + string country = default!; + await _instance.GetCountryAsync(country); + } + + /// + /// Test Hello + /// + [Fact (Skip = "not implemented")] + public async Task HelloAsyncTest() + { + var response = await _instance.HelloAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test RolesReportGet + /// + [Fact (Skip = "not implemented")] + public async Task RolesReportGetAsyncTest() + { + var response = await _instance.RolesReportGetAsync(); + var model = response.Ok(); + Assert.IsType>>(model); + } + + /// + /// Test Test + /// + [Fact (Skip = "not implemented")] + public async Task TestAsyncTest() + { + var response = await _instance.TestAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..028d71f43359 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,243 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var anotherFakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var anotherFakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var anotherFakeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var anotherFakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs new file mode 100644 index 000000000000..406dbc964a6d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -0,0 +1,303 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing FakeApi + /// + public sealed class FakeApiTests : ApiTestsBase + { + private readonly IFakeApi _instance; + + public FakeApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test FakeHealthGet + /// + [Fact (Skip = "not implemented")] + public async Task FakeHealthGetAsyncTest() + { + var response = await _instance.FakeHealthGetAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterBooleanSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterBooleanSerializeAsyncTest() + { + Client.Option body = default!; + var response = await _instance.FakeOuterBooleanSerializeAsync(body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterCompositeSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterCompositeSerializeAsyncTest() + { + Client.Option outerComposite = default!; + var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterNumberSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterNumberSerializeAsyncTest() + { + Client.Option body = default!; + var response = await _instance.FakeOuterNumberSerializeAsync(body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterStringSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterStringSerializeAsyncTest() + { + Guid requiredStringUuid = default!; + Client.Option body = default!; + var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test GetArrayOfEnums + /// + [Fact (Skip = "not implemented")] + public async Task GetArrayOfEnumsAsyncTest() + { + var response = await _instance.GetArrayOfEnumsAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetMixedAnyOf + /// + [Fact (Skip = "not implemented")] + public async Task GetMixedAnyOfAsyncTest() + { + var response = await _instance.GetMixedAnyOfAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test GetMixedOneOf + /// + [Fact (Skip = "not implemented")] + public async Task GetMixedOneOfAsyncTest() + { + var response = await _instance.GetMixedOneOfAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test TestAdditionalPropertiesReference + /// + [Fact (Skip = "not implemented")] + public async Task TestAdditionalPropertiesReferenceAsyncTest() + { + Dictionary requestBody = default!; + await _instance.TestAdditionalPropertiesReferenceAsync(requestBody); + } + + /// + /// Test TestBodyWithFileSchema + /// + [Fact (Skip = "not implemented")] + public async Task TestBodyWithFileSchemaAsyncTest() + { + FileSchemaTestClass fileSchemaTestClass = default!; + await _instance.TestBodyWithFileSchemaAsync(fileSchemaTestClass); + } + + /// + /// Test TestBodyWithQueryParams + /// + [Fact (Skip = "not implemented")] + public async Task TestBodyWithQueryParamsAsyncTest() + { + string query = default!; + User user = default!; + await _instance.TestBodyWithQueryParamsAsync(query, user); + } + + /// + /// Test TestClientModel + /// + [Fact (Skip = "not implemented")] + public async Task TestClientModelAsyncTest() + { + ModelClient modelClient = default!; + var response = await _instance.TestClientModelAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test TestEndpointParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestEndpointParametersAsyncTest() + { + decimal number = default!; + string patternWithoutDelimiter = default!; + byte[] varByte = default!; + double varDouble = default!; + Client.Option binary = default!; + Client.Option callback = default!; + Client.Option date = default!; + Client.Option dateTime = default!; + Client.Option int32 = default!; + Client.Option int64 = default!; + Client.Option integer = default!; + Client.Option password = default!; + Client.Option varFloat = default!; + Client.Option varString = default!; + await _instance.TestEndpointParametersAsync(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + } + + /// + /// Test TestEnumParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestEnumParametersAsyncTest() + { + Client.Option enumFormString = default!; + Client.Option> enumFormStringArray = default!; + Client.Option enumHeaderString = default!; + Client.Option> enumHeaderStringArray = default!; + Client.Option enumQueryDouble = default!; + Client.Option enumQueryInteger = default!; + Client.Option enumQueryString = default!; + Client.Option> enumQueryStringArray = default!; + await _instance.TestEnumParametersAsync(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + } + + /// + /// Test TestGroupParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestGroupParametersAsyncTest() + { + bool requiredBooleanGroup = default!; + long requiredInt64Group = default!; + int requiredStringGroup = default!; + Client.Option booleanGroup = default!; + Client.Option int64Group = default!; + Client.Option stringGroup = default!; + await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + } + + /// + /// Test TestInlineAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineAdditionalPropertiesAsyncTest() + { + Dictionary requestBody = default!; + await _instance.TestInlineAdditionalPropertiesAsync(requestBody); + } + + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default!; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + + /// + /// Test TestJsonFormData + /// + [Fact (Skip = "not implemented")] + public async Task TestJsonFormDataAsyncTest() + { + string param = default!; + string param2 = default!; + await _instance.TestJsonFormDataAsync(param, param2); + } + + /// + /// Test TestQueryParameterCollectionFormat + /// + [Fact (Skip = "not implemented")] + public async Task TestQueryParameterCollectionFormatAsyncTest() + { + List context = default!; + List http = default!; + List ioutil = default!; + List pipe = default!; + string requiredNotNullable = default!; + List url = default!; + Client.Option notRequiredNotNullable = default!; + Client.Option notRequiredNullable = default!; + string? requiredNullable = default!; + await _instance.TestQueryParameterCollectionFormatAsync(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + } + + /// + /// Test TestStringMapReference + /// + [Fact (Skip = "not implemented")] + public async Task TestStringMapReferenceAsyncTest() + { + Dictionary requestBody = default!; + await _instance.TestStringMapReferenceAsync(requestBody); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs new file mode 100644 index 000000000000..626331ef9b7f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing FakeClassnameTags123Api + /// + public sealed class FakeClassnameTags123ApiTests : ApiTestsBase + { + private readonly IFakeClassnameTags123Api _instance; + + public FakeClassnameTags123ApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test TestClassname + /// + [Fact (Skip = "not implemented")] + public async Task TestClassnameAsyncTest() + { + ModelClient modelClient = default!; + var response = await _instance.TestClassnameAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/PetApiTests.cs new file mode 100644 index 000000000000..49e7b21b53c2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -0,0 +1,160 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing PetApi + /// + public sealed class PetApiTests : ApiTestsBase + { + private readonly IPetApi _instance; + + public PetApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test AddPet + /// + [Fact (Skip = "not implemented")] + public async Task AddPetAsyncTest() + { + Pet pet = default!; + await _instance.AddPetAsync(pet); + } + + /// + /// Test DeletePet + /// + [Fact (Skip = "not implemented")] + public async Task DeletePetAsyncTest() + { + long petId = default!; + Client.Option apiKey = default!; + await _instance.DeletePetAsync(petId, apiKey); + } + + /// + /// Test FindPetsByStatus + /// + [Fact (Skip = "not implemented")] + public async Task FindPetsByStatusAsyncTest() + { + List status = default!; + var response = await _instance.FindPetsByStatusAsync(status); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test FindPetsByTags + /// + [Fact (Skip = "not implemented")] + public async Task FindPetsByTagsAsyncTest() + { + List tags = default!; + var response = await _instance.FindPetsByTagsAsync(tags); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetPetById + /// + [Fact (Skip = "not implemented")] + public async Task GetPetByIdAsyncTest() + { + long petId = default!; + var response = await _instance.GetPetByIdAsync(petId); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test UpdatePet + /// + [Fact (Skip = "not implemented")] + public async Task UpdatePetAsyncTest() + { + Pet pet = default!; + await _instance.UpdatePetAsync(pet); + } + + /// + /// Test UpdatePetWithForm + /// + [Fact (Skip = "not implemented")] + public async Task UpdatePetWithFormAsyncTest() + { + long petId = default!; + Client.Option name = default!; + Client.Option status = default!; + await _instance.UpdatePetWithFormAsync(petId, name, status); + } + + /// + /// Test UploadFile + /// + [Fact (Skip = "not implemented")] + public async Task UploadFileAsyncTest() + { + long petId = default!; + Client.Option additionalMetadata = default!; + Client.Option file = default!; + var response = await _instance.UploadFileAsync(petId, additionalMetadata, file); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test UploadFileWithRequiredFile + /// + [Fact (Skip = "not implemented")] + public async Task UploadFileWithRequiredFileAsyncTest() + { + long petId = default!; + System.IO.Stream requiredFile = default!; + Client.Option additionalMetadata = default!; + var response = await _instance.UploadFileWithRequiredFileAsync(petId, requiredFile, additionalMetadata); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs new file mode 100644 index 000000000000..b2a25a3e6f07 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing StoreApi + /// + public sealed class StoreApiTests : ApiTestsBase + { + private readonly IStoreApi _instance; + + public StoreApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test DeleteOrder + /// + [Fact (Skip = "not implemented")] + public async Task DeleteOrderAsyncTest() + { + string orderId = default!; + await _instance.DeleteOrderAsync(orderId); + } + + /// + /// Test GetInventory + /// + [Fact (Skip = "not implemented")] + public async Task GetInventoryAsyncTest() + { + var response = await _instance.GetInventoryAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetOrderById + /// + [Fact (Skip = "not implemented")] + public async Task GetOrderByIdAsyncTest() + { + long orderId = default!; + var response = await _instance.GetOrderByIdAsync(orderId); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test PlaceOrder + /// + [Fact (Skip = "not implemented")] + public async Task PlaceOrderAsyncTest() + { + Order order = default!; + var response = await _instance.PlaceOrderAsync(order); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/UserApiTests.cs new file mode 100644 index 000000000000..bc750295c346 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/UserApiTests.cs @@ -0,0 +1,138 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing UserApi + /// + public sealed class UserApiTests : ApiTestsBase + { + private readonly IUserApi _instance; + + public UserApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test CreateUser + /// + [Fact (Skip = "not implemented")] + public async Task CreateUserAsyncTest() + { + User user = default!; + await _instance.CreateUserAsync(user); + } + + /// + /// Test CreateUsersWithArrayInput + /// + [Fact (Skip = "not implemented")] + public async Task CreateUsersWithArrayInputAsyncTest() + { + List user = default!; + await _instance.CreateUsersWithArrayInputAsync(user); + } + + /// + /// Test CreateUsersWithListInput + /// + [Fact (Skip = "not implemented")] + public async Task CreateUsersWithListInputAsyncTest() + { + List user = default!; + await _instance.CreateUsersWithListInputAsync(user); + } + + /// + /// Test DeleteUser + /// + [Fact (Skip = "not implemented")] + public async Task DeleteUserAsyncTest() + { + string username = default!; + await _instance.DeleteUserAsync(username); + } + + /// + /// Test GetUserByName + /// + [Fact (Skip = "not implemented")] + public async Task GetUserByNameAsyncTest() + { + string username = default!; + var response = await _instance.GetUserByNameAsync(username); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test LoginUser + /// + [Fact (Skip = "not implemented")] + public async Task LoginUserAsyncTest() + { + string password = default!; + string username = default!; + var response = await _instance.LoginUserAsync(password, username); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test LogoutUser + /// + [Fact (Skip = "not implemented")] + public async Task LogoutUserAsyncTest() + { + await _instance.LogoutUserAsync(); + } + + /// + /// Test UpdateUser + /// + [Fact (Skip = "not implemented")] + public async Task UpdateUserAsyncTest() + { + User user = default!; + string username = default!; + await _instance.UpdateUserAsync(user, username); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs new file mode 100644 index 000000000000..adbf639fd720 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ActivityOutputElementRepresentation + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActivityOutputElementRepresentationTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ActivityOutputElementRepresentation + //private ActivityOutputElementRepresentation instance; + + public ActivityOutputElementRepresentationTests() + { + // TODO uncomment below to create an instance of ActivityOutputElementRepresentation + //instance = new ActivityOutputElementRepresentation(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ActivityOutputElementRepresentation + /// + [Fact] + public void ActivityOutputElementRepresentationInstanceTest() + { + // TODO uncomment below to test "IsType" ActivityOutputElementRepresentation + //Assert.IsType(instance); + } + + /// + /// Test the property 'Prop1' + /// + [Fact] + public void Prop1Test() + { + // TODO unit test for the property 'Prop1' + } + + /// + /// Test the property 'Prop2' + /// + [Fact] + public void Prop2Test() + { + // TODO unit test for the property 'Prop2' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ActivityTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ActivityTests.cs new file mode 100644 index 000000000000..6cc2927eaaf3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ActivityTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Activity + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActivityTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Activity + //private Activity instance; + + public ActivityTests() + { + // TODO uncomment below to create an instance of Activity + //instance = new Activity(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Activity + /// + [Fact] + public void ActivityInstanceTest() + { + // TODO uncomment below to test "IsType" Activity + //Assert.IsType(instance); + } + + /// + /// Test the property 'ActivityOutputs' + /// + [Fact] + public void ActivityOutputsTest() + { + // TODO unit test for the property 'ActivityOutputs' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs new file mode 100644 index 000000000000..e157b477193e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -0,0 +1,128 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing AdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for AdditionalPropertiesClass + //private AdditionalPropertiesClass instance; + + public AdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of AdditionalPropertiesClass + //instance = new AdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AdditionalPropertiesClass + /// + [Fact] + public void AdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsType" AdditionalPropertiesClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'Anytype1' + /// + [Fact] + public void Anytype1Test() + { + // TODO unit test for the property 'Anytype1' + } + + /// + /// Test the property 'EmptyMap' + /// + [Fact] + public void EmptyMapTest() + { + // TODO unit test for the property 'EmptyMap' + } + + /// + /// Test the property 'MapOfMapProperty' + /// + [Fact] + public void MapOfMapPropertyTest() + { + // TODO unit test for the property 'MapOfMapProperty' + } + + /// + /// Test the property 'MapProperty' + /// + [Fact] + public void MapPropertyTest() + { + // TODO unit test for the property 'MapProperty' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype1' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype1Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype1' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype2' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype2Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype2' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype3' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype3Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype3' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesString' + /// + [Fact] + public void MapWithUndeclaredPropertiesStringTest() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AnimalTests.cs new file mode 100644 index 000000000000..1db9725afb85 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AnimalTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Animal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AnimalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Animal + //private Animal instance; + + public AnimalTests() + { + // TODO uncomment below to create an instance of Animal + //instance = new Animal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Animal + /// + [Fact] + public void AnimalInstanceTest() + { + // TODO uncomment below to test "IsType" Animal + //Assert.IsType(instance); + } + + /// + /// Test deserialize a Cat from type Animal + /// + [Fact] + public void CatDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Cat from type Animal + //Assert.IsType(JsonConvert.DeserializeObject(new Cat().ToJson())); + } + + /// + /// Test deserialize a Dog from type Animal + /// + [Fact] + public void DogDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Dog from type Animal + //Assert.IsType(JsonConvert.DeserializeObject(new Dog().ToJson())); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs new file mode 100644 index 000000000000..c296a82116a7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ApiResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ApiResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ApiResponse + //private ApiResponse instance; + + public ApiResponseTests() + { + // TODO uncomment below to create an instance of ApiResponse + //instance = new ApiResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ApiResponse + /// + [Fact] + public void ApiResponseInstanceTest() + { + // TODO uncomment below to test "IsType" ApiResponse + //Assert.IsType(instance); + } + + /// + /// Test the property 'Code' + /// + [Fact] + public void CodeTest() + { + // TODO unit test for the property 'Code' + } + + /// + /// Test the property 'Message' + /// + [Fact] + public void MessageTest() + { + // TODO unit test for the property 'Message' + } + + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs new file mode 100644 index 000000000000..d698ee445048 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing AppleReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for AppleReq + //private AppleReq instance; + + public AppleReqTests() + { + // TODO uncomment below to create an instance of AppleReq + //instance = new AppleReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AppleReq + /// + [Fact] + public void AppleReqInstanceTest() + { + // TODO uncomment below to test "IsType" AppleReq + //Assert.IsType(instance); + } + + /// + /// Test the property 'Cultivar' + /// + [Fact] + public void CultivarTest() + { + // TODO unit test for the property 'Cultivar' + } + + /// + /// Test the property 'Mealy' + /// + [Fact] + public void MealyTest() + { + // TODO unit test for the property 'Mealy' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AppleTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AppleTests.cs new file mode 100644 index 000000000000..c7c8ccd47c11 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/AppleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Apple + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Apple + //private Apple instance; + + public AppleTests() + { + // TODO uncomment below to create an instance of Apple + //instance = new Apple(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Apple + /// + [Fact] + public void AppleInstanceTest() + { + // TODO uncomment below to test "IsType" Apple + //Assert.IsType(instance); + } + + /// + /// Test the property 'ColorCode' + /// + [Fact] + public void ColorCodeTest() + { + // TODO unit test for the property 'ColorCode' + } + + /// + /// Test the property 'Cultivar' + /// + [Fact] + public void CultivarTest() + { + // TODO unit test for the property 'Cultivar' + } + + /// + /// Test the property 'Origin' + /// + [Fact] + public void OriginTest() + { + // TODO unit test for the property 'Origin' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs new file mode 100644 index 000000000000..29fe9cfb1d47 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayOfArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfArrayOfNumberOnly + //private ArrayOfArrayOfNumberOnly instance; + + public ArrayOfArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfArrayOfNumberOnly + //instance = new ArrayOfArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfArrayOfNumberOnly + /// + [Fact] + public void ArrayOfArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayOfArrayOfNumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayArrayNumber' + /// + [Fact] + public void ArrayArrayNumberTest() + { + // TODO unit test for the property 'ArrayArrayNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs new file mode 100644 index 000000000000..2b0956c0b984 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfNumberOnly + //private ArrayOfNumberOnly instance; + + public ArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfNumberOnly + //instance = new ArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfNumberOnly + /// + [Fact] + public void ArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayOfNumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayNumber' + /// + [Fact] + public void ArrayNumberTest() + { + // TODO unit test for the property 'ArrayNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs new file mode 100644 index 000000000000..3b01d0b7abbc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayTest + //private ArrayTest instance; + + public ArrayTestTests() + { + // TODO uncomment below to create an instance of ArrayTest + //instance = new ArrayTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayTest + /// + [Fact] + public void ArrayTestInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayArrayOfInteger' + /// + [Fact] + public void ArrayArrayOfIntegerTest() + { + // TODO unit test for the property 'ArrayArrayOfInteger' + } + + /// + /// Test the property 'ArrayArrayOfModel' + /// + [Fact] + public void ArrayArrayOfModelTest() + { + // TODO unit test for the property 'ArrayArrayOfModel' + } + + /// + /// Test the property 'ArrayOfString' + /// + [Fact] + public void ArrayOfStringTest() + { + // TODO unit test for the property 'ArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs new file mode 100644 index 000000000000..1e54c1f3e41d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing BananaReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for BananaReq + //private BananaReq instance; + + public BananaReqTests() + { + // TODO uncomment below to create an instance of BananaReq + //instance = new BananaReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of BananaReq + /// + [Fact] + public void BananaReqInstanceTest() + { + // TODO uncomment below to test "IsType" BananaReq + //Assert.IsType(instance); + } + + /// + /// Test the property 'LengthCm' + /// + [Fact] + public void LengthCmTest() + { + // TODO unit test for the property 'LengthCm' + } + + /// + /// Test the property 'Sweet' + /// + [Fact] + public void SweetTest() + { + // TODO unit test for the property 'Sweet' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/BananaTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/BananaTests.cs new file mode 100644 index 000000000000..5a88e9dabbdf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/BananaTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Banana + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Banana + //private Banana instance; + + public BananaTests() + { + // TODO uncomment below to create an instance of Banana + //instance = new Banana(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Banana + /// + [Fact] + public void BananaInstanceTest() + { + // TODO uncomment below to test "IsType" Banana + //Assert.IsType(instance); + } + + /// + /// Test the property 'LengthCm' + /// + [Fact] + public void LengthCmTest() + { + // TODO unit test for the property 'LengthCm' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs new file mode 100644 index 000000000000..4ffd6c2c0c87 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing BasquePig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BasquePigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for BasquePig + //private BasquePig instance; + + public BasquePigTests() + { + // TODO uncomment below to create an instance of BasquePig + //instance = new BasquePig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of BasquePig + /// + [Fact] + public void BasquePigInstanceTest() + { + // TODO uncomment below to test "IsType" BasquePig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs new file mode 100644 index 000000000000..d0391fb47f8f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Capitalization + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CapitalizationTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Capitalization + //private Capitalization instance; + + public CapitalizationTests() + { + // TODO uncomment below to create an instance of Capitalization + //instance = new Capitalization(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Capitalization + /// + [Fact] + public void CapitalizationInstanceTest() + { + // TODO uncomment below to test "IsType" Capitalization + //Assert.IsType(instance); + } + + /// + /// Test the property 'ATT_NAME' + /// + [Fact] + public void ATT_NAMETest() + { + // TODO unit test for the property 'ATT_NAME' + } + + /// + /// Test the property 'CapitalCamel' + /// + [Fact] + public void CapitalCamelTest() + { + // TODO unit test for the property 'CapitalCamel' + } + + /// + /// Test the property 'CapitalSnake' + /// + [Fact] + public void CapitalSnakeTest() + { + // TODO unit test for the property 'CapitalSnake' + } + + /// + /// Test the property 'SCAETHFlowPoints' + /// + [Fact] + public void SCAETHFlowPointsTest() + { + // TODO unit test for the property 'SCAETHFlowPoints' + } + + /// + /// Test the property 'SmallCamel' + /// + [Fact] + public void SmallCamelTest() + { + // TODO unit test for the property 'SmallCamel' + } + + /// + /// Test the property 'SmallSnake' + /// + [Fact] + public void SmallSnakeTest() + { + // TODO unit test for the property 'SmallSnake' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CatTests.cs new file mode 100644 index 000000000000..a5d4bf43bbfd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CatTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Cat + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CatTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Cat + //private Cat instance; + + public CatTests() + { + // TODO uncomment below to create an instance of Cat + //instance = new Cat(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Cat + /// + [Fact] + public void CatInstanceTest() + { + // TODO uncomment below to test "IsType" Cat + //Assert.IsType(instance); + } + + /// + /// Test the property 'Declawed' + /// + [Fact] + public void DeclawedTest() + { + // TODO unit test for the property 'Declawed' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CategoryTests.cs new file mode 100644 index 000000000000..7fe8f333c81a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Category + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CategoryTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Category + //private Category instance; + + public CategoryTests() + { + // TODO uncomment below to create an instance of Category + //instance = new Category(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Category + /// + [Fact] + public void CategoryInstanceTest() + { + // TODO uncomment below to test "IsType" Category + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs new file mode 100644 index 000000000000..2c02364a9f76 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ChildCat + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ChildCatTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ChildCat + //private ChildCat instance; + + public ChildCatTests() + { + // TODO uncomment below to create an instance of ChildCat + //instance = new ChildCat(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ChildCat + /// + [Fact] + public void ChildCatInstanceTest() + { + // TODO uncomment below to test "IsType" ChildCat + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + /// + /// Test the property 'PetType' + /// + [Fact] + public void PetTypeTest() + { + // TODO unit test for the property 'PetType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs new file mode 100644 index 000000000000..a866bfbe242d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ClassModel + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ClassModelTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ClassModel + //private ClassModel instance; + + public ClassModelTests() + { + // TODO uncomment below to create an instance of ClassModel + //instance = new ClassModel(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ClassModel + /// + [Fact] + public void ClassModelInstanceTest() + { + // TODO uncomment below to test "IsType" ClassModel + //Assert.IsType(instance); + } + + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs new file mode 100644 index 000000000000..a7a864154acf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ComplexQuadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ComplexQuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ComplexQuadrilateral + //private ComplexQuadrilateral instance; + + public ComplexQuadrilateralTests() + { + // TODO uncomment below to create an instance of ComplexQuadrilateral + //instance = new ComplexQuadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ComplexQuadrilateral + /// + [Fact] + public void ComplexQuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" ComplexQuadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs new file mode 100644 index 000000000000..e7c505b5136d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DanishPig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DanishPigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DanishPig + //private DanishPig instance; + + public DanishPigTests() + { + // TODO uncomment below to create an instance of DanishPig + //instance = new DanishPig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DanishPig + /// + [Fact] + public void DanishPigInstanceTest() + { + // TODO uncomment below to test "IsType" DanishPig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs new file mode 100644 index 000000000000..83a4185e53d2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DateOnlyClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DateOnlyClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DateOnlyClass + //private DateOnlyClass instance; + + public DateOnlyClassTests() + { + // TODO uncomment below to create an instance of DateOnlyClass + //instance = new DateOnlyClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DateOnlyClass + /// + [Fact] + public void DateOnlyClassInstanceTest() + { + // TODO uncomment below to test "IsType" DateOnlyClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'DateOnlyProperty' + /// + [Fact] + public void DateOnlyPropertyTest() + { + // TODO unit test for the property 'DateOnlyProperty' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs new file mode 100644 index 000000000000..95e56f782da3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DeprecatedObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DeprecatedObjectTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DeprecatedObject + //private DeprecatedObject instance; + + public DeprecatedObjectTests() + { + // TODO uncomment below to create an instance of DeprecatedObject + //instance = new DeprecatedObject(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DeprecatedObject + /// + [Fact] + public void DeprecatedObjectInstanceTest() + { + // TODO uncomment below to test "IsType" DeprecatedObject + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DogTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DogTests.cs new file mode 100644 index 000000000000..b8e8bca05384 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DogTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Dog + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DogTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Dog + //private Dog instance; + + public DogTests() + { + // TODO uncomment below to create an instance of Dog + //instance = new Dog(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Dog + /// + [Fact] + public void DogInstanceTest() + { + // TODO uncomment below to test "IsType" Dog + //Assert.IsType(instance); + } + + /// + /// Test the property 'Breed' + /// + [Fact] + public void BreedTest() + { + // TODO unit test for the property 'Breed' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DrawingTests.cs new file mode 100644 index 000000000000..a2de4a1b97b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/DrawingTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Drawing + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DrawingTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Drawing + //private Drawing instance; + + public DrawingTests() + { + // TODO uncomment below to create an instance of Drawing + //instance = new Drawing(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Drawing + /// + [Fact] + public void DrawingInstanceTest() + { + // TODO uncomment below to test "IsType" Drawing + //Assert.IsType(instance); + } + + /// + /// Test the property 'MainShape' + /// + [Fact] + public void MainShapeTest() + { + // TODO unit test for the property 'MainShape' + } + + /// + /// Test the property 'NullableShape' + /// + [Fact] + public void NullableShapeTest() + { + // TODO unit test for the property 'NullableShape' + } + + /// + /// Test the property 'ShapeOrNull' + /// + [Fact] + public void ShapeOrNullTest() + { + // TODO unit test for the property 'ShapeOrNull' + } + + /// + /// Test the property 'Shapes' + /// + [Fact] + public void ShapesTest() + { + // TODO unit test for the property 'Shapes' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs new file mode 100644 index 000000000000..c6fee27690b7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumArrays + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumArraysTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumArrays + //private EnumArrays instance; + + public EnumArraysTests() + { + // TODO uncomment below to create an instance of EnumArrays + //instance = new EnumArrays(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumArrays + /// + [Fact] + public void EnumArraysInstanceTest() + { + // TODO uncomment below to test "IsType" EnumArrays + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayEnum' + /// + [Fact] + public void ArrayEnumTest() + { + // TODO unit test for the property 'ArrayEnum' + } + + /// + /// Test the property 'JustSymbol' + /// + [Fact] + public void JustSymbolTest() + { + // TODO unit test for the property 'JustSymbol' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs new file mode 100644 index 000000000000..44dbbe4d324a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumClass + //private EnumClass instance; + + public EnumClassTests() + { + // TODO uncomment below to create an instance of EnumClass + //instance = new EnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumClass + /// + [Fact] + public void EnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" EnumClass + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs new file mode 100644 index 000000000000..3781eebbfcf2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumTest + //private EnumTest instance; + + public EnumTestTests() + { + // TODO uncomment below to create an instance of EnumTest + //instance = new EnumTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumTest + /// + [Fact] + public void EnumTestInstanceTest() + { + // TODO uncomment below to test "IsType" EnumTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + + /// + /// Test the property 'EnumInteger' + /// + [Fact] + public void EnumIntegerTest() + { + // TODO unit test for the property 'EnumInteger' + } + + /// + /// Test the property 'EnumIntegerOnly' + /// + [Fact] + public void EnumIntegerOnlyTest() + { + // TODO unit test for the property 'EnumIntegerOnly' + } + + /// + /// Test the property 'EnumNumber' + /// + [Fact] + public void EnumNumberTest() + { + // TODO unit test for the property 'EnumNumber' + } + + /// + /// Test the property 'EnumString' + /// + [Fact] + public void EnumStringTest() + { + // TODO unit test for the property 'EnumString' + } + + /// + /// Test the property 'OuterEnum' + /// + [Fact] + public void OuterEnumTest() + { + // TODO unit test for the property 'OuterEnum' + } + + /// + /// Test the property 'OuterEnumDefaultValue' + /// + [Fact] + public void OuterEnumDefaultValueTest() + { + // TODO unit test for the property 'OuterEnumDefaultValue' + } + + /// + /// Test the property 'OuterEnumInteger' + /// + [Fact] + public void OuterEnumIntegerTest() + { + // TODO unit test for the property 'OuterEnumInteger' + } + + /// + /// Test the property 'OuterEnumIntegerDefaultValue' + /// + [Fact] + public void OuterEnumIntegerDefaultValueTest() + { + // TODO unit test for the property 'OuterEnumIntegerDefaultValue' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs new file mode 100644 index 000000000000..f8d3daec3fe1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EquilateralTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EquilateralTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EquilateralTriangle + //private EquilateralTriangle instance; + + public EquilateralTriangleTests() + { + // TODO uncomment below to create an instance of EquilateralTriangle + //instance = new EquilateralTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EquilateralTriangle + /// + [Fact] + public void EquilateralTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" EquilateralTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 000000000000..e2685848d5ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FileSchemaTestClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + public FileSchemaTestClassTests() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Fact] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsType" FileSchemaTestClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'File' + /// + [Fact] + public void FileTest() + { + // TODO unit test for the property 'File' + } + + /// + /// Test the property 'Files' + /// + [Fact] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 000000000000..c305c5356b05 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FileTests : IDisposable + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + public FileTests() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of File + /// + [Fact] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsType" File + //Assert.IsType(instance); + } + + /// + /// Test the property 'SourceURI' + /// + [Fact] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 000000000000..55086a7cf24b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FooTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FooTests.cs new file mode 100644 index 000000000000..871506eeaac5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FooTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Foo + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Foo + //private Foo instance; + + public FooTests() + { + // TODO uncomment below to create an instance of Foo + //instance = new Foo(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Foo + /// + [Fact] + public void FooInstanceTest() + { + // TODO uncomment below to test "IsType" Foo + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs new file mode 100644 index 000000000000..7dad1b08bc02 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FormatTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FormatTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FormatTest + //private FormatTest instance; + + public FormatTestTests() + { + // TODO uncomment below to create an instance of FormatTest + //instance = new FormatTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FormatTest + /// + [Fact] + public void FormatTestInstanceTest() + { + // TODO uncomment below to test "IsType" FormatTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'Byte' + /// + [Fact] + public void ByteTest() + { + // TODO unit test for the property 'Byte' + } + + /// + /// Test the property 'Date' + /// + [Fact] + public void DateTest() + { + // TODO unit test for the property 'Date' + } + + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + + /// + /// Test the property 'Decimal' + /// + [Fact] + public void DecimalTest() + { + // TODO unit test for the property 'Decimal' + } + + /// + /// Test the property 'Double' + /// + [Fact] + public void DoubleTest() + { + // TODO unit test for the property 'Double' + } + + /// + /// Test the property 'Float' + /// + [Fact] + public void FloatTest() + { + // TODO unit test for the property 'Float' + } + + /// + /// Test the property 'Int32' + /// + [Fact] + public void Int32Test() + { + // TODO unit test for the property 'Int32' + } + + /// + /// Test the property 'Int32Range' + /// + [Fact] + public void Int32RangeTest() + { + // TODO unit test for the property 'Int32Range' + } + + /// + /// Test the property 'Int64' + /// + [Fact] + public void Int64Test() + { + // TODO unit test for the property 'Int64' + } + + /// + /// Test the property 'Int64Negative' + /// + [Fact] + public void Int64NegativeTest() + { + // TODO unit test for the property 'Int64Negative' + } + + /// + /// Test the property 'Int64NegativeExclusive' + /// + [Fact] + public void Int64NegativeExclusiveTest() + { + // TODO unit test for the property 'Int64NegativeExclusive' + } + + /// + /// Test the property 'Int64Positive' + /// + [Fact] + public void Int64PositiveTest() + { + // TODO unit test for the property 'Int64Positive' + } + + /// + /// Test the property 'Int64PositiveExclusive' + /// + [Fact] + public void Int64PositiveExclusiveTest() + { + // TODO unit test for the property 'Int64PositiveExclusive' + } + + /// + /// Test the property 'Integer' + /// + [Fact] + public void IntegerTest() + { + // TODO unit test for the property 'Integer' + } + + /// + /// Test the property 'PatternWithBackslash' + /// + [Fact] + public void PatternWithBackslashTest() + { + // TODO unit test for the property 'PatternWithBackslash' + } + + /// + /// Test the property 'PatternWithDigits' + /// + [Fact] + public void PatternWithDigitsTest() + { + // TODO unit test for the property 'PatternWithDigits' + } + + /// + /// Test the property 'PatternWithDigitsAndDelimiter' + /// + [Fact] + public void PatternWithDigitsAndDelimiterTest() + { + // TODO unit test for the property 'PatternWithDigitsAndDelimiter' + } + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + /// + /// Test the property 'UnsignedInteger' + /// + [Fact] + public void UnsignedIntegerTest() + { + // TODO unit test for the property 'UnsignedInteger' + } + + /// + /// Test the property 'UnsignedLong' + /// + [Fact] + public void UnsignedLongTest() + { + // TODO unit test for the property 'UnsignedLong' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs new file mode 100644 index 000000000000..a33c55ae4875 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FruitReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FruitReq + //private FruitReq instance; + + public FruitReqTests() + { + // TODO uncomment below to create an instance of FruitReq + //instance = new FruitReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FruitReq + /// + [Fact] + public void FruitReqInstanceTest() + { + // TODO uncomment below to test "IsType" FruitReq + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FruitTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FruitTests.cs new file mode 100644 index 000000000000..46448efc62f4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/FruitTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Fruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Fruit + //private Fruit instance; + + public FruitTests() + { + // TODO uncomment below to create an instance of Fruit + //instance = new Fruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Fruit + /// + [Fact] + public void FruitInstanceTest() + { + // TODO uncomment below to test "IsType" Fruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs new file mode 100644 index 000000000000..7e79cd067925 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing GmFruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class GmFruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for GmFruit + //private GmFruit instance; + + public GmFruitTests() + { + // TODO uncomment below to create an instance of GmFruit + //instance = new GmFruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of GmFruit + /// + [Fact] + public void GmFruitInstanceTest() + { + // TODO uncomment below to test "IsType" GmFruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs new file mode 100644 index 000000000000..5f0e8672ed5f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing GrandparentAnimal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class GrandparentAnimalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for GrandparentAnimal + //private GrandparentAnimal instance; + + public GrandparentAnimalTests() + { + // TODO uncomment below to create an instance of GrandparentAnimal + //instance = new GrandparentAnimal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of GrandparentAnimal + /// + [Fact] + public void GrandparentAnimalInstanceTest() + { + // TODO uncomment below to test "IsType" GrandparentAnimal + //Assert.IsType(instance); + } + + /// + /// Test deserialize a ChildCat from type ParentPet + /// + [Fact] + public void ChildCatDeserializeFromParentPetTest() + { + // TODO uncomment below to test deserialize a ChildCat from type ParentPet + //Assert.IsType(JsonConvert.DeserializeObject(new ChildCat().ToJson())); + } + + /// + /// Test deserialize a ParentPet from type GrandparentAnimal + /// + [Fact] + public void ParentPetDeserializeFromGrandparentAnimalTest() + { + // TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal + //Assert.IsType(JsonConvert.DeserializeObject(new ParentPet().ToJson())); + } + + /// + /// Test the property 'PetType' + /// + [Fact] + public void PetTypeTest() + { + // TODO unit test for the property 'PetType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs new file mode 100644 index 000000000000..134a7d515ebb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing HasOnlyReadOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class HasOnlyReadOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for HasOnlyReadOnly + //private HasOnlyReadOnly instance; + + public HasOnlyReadOnlyTests() + { + // TODO uncomment below to create an instance of HasOnlyReadOnly + //instance = new HasOnlyReadOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of HasOnlyReadOnly + /// + [Fact] + public void HasOnlyReadOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" HasOnlyReadOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + /// + /// Test the property 'Foo' + /// + [Fact] + public void FooTest() + { + // TODO unit test for the property 'Foo' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs new file mode 100644 index 000000000000..18bb8672e980 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing HealthCheckResult + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class HealthCheckResultTests : IDisposable + { + // TODO uncomment below to declare an instance variable for HealthCheckResult + //private HealthCheckResult instance; + + public HealthCheckResultTests() + { + // TODO uncomment below to create an instance of HealthCheckResult + //instance = new HealthCheckResult(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of HealthCheckResult + /// + [Fact] + public void HealthCheckResultInstanceTest() + { + // TODO uncomment below to test "IsType" HealthCheckResult + //Assert.IsType(instance); + } + + /// + /// Test the property 'NullableMessage' + /// + [Fact] + public void NullableMessageTest() + { + // TODO unit test for the property 'NullableMessage' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs new file mode 100644 index 000000000000..464750233cd2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing IsoscelesTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class IsoscelesTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for IsoscelesTriangle + //private IsoscelesTriangle instance; + + public IsoscelesTriangleTests() + { + // TODO uncomment below to create an instance of IsoscelesTriangle + //instance = new IsoscelesTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of IsoscelesTriangle + /// + [Fact] + public void IsoscelesTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" IsoscelesTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ListTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ListTests.cs new file mode 100644 index 000000000000..d95303d97517 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ListTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing List + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ListTests : IDisposable + { + // TODO uncomment below to declare an instance variable for List + //private List instance; + + public ListTests() + { + // TODO uncomment below to create an instance of List + //instance = new List(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of List + /// + [Fact] + public void ListInstanceTest() + { + // TODO uncomment below to test "IsType" List + //Assert.IsType(instance); + } + + /// + /// Test the property 'Var123List' + /// + [Fact] + public void Var123ListTest() + { + // TODO unit test for the property 'Var123List' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 000000000000..31d21de5b60c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MammalTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MammalTests.cs new file mode 100644 index 000000000000..64bd9e890343 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MammalTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Mammal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MammalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Mammal + //private Mammal instance; + + public MammalTests() + { + // TODO uncomment below to create an instance of Mammal + //instance = new Mammal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Mammal + /// + [Fact] + public void MammalInstanceTest() + { + // TODO uncomment below to test "IsType" Mammal + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MapTestTests.cs new file mode 100644 index 000000000000..2dc6d8d8e04b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MapTestTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MapTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MapTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MapTest + //private MapTest instance; + + public MapTestTests() + { + // TODO uncomment below to create an instance of MapTest + //instance = new MapTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MapTest + /// + [Fact] + public void MapTestInstanceTest() + { + // TODO uncomment below to test "IsType" MapTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'DirectMap' + /// + [Fact] + public void DirectMapTest() + { + // TODO unit test for the property 'DirectMap' + } + + /// + /// Test the property 'IndirectMap' + /// + [Fact] + public void IndirectMapTest() + { + // TODO unit test for the property 'IndirectMap' + } + + /// + /// Test the property 'MapMapOfString' + /// + [Fact] + public void MapMapOfStringTest() + { + // TODO unit test for the property 'MapMapOfString' + } + + /// + /// Test the property 'MapOfEnumString' + /// + [Fact] + public void MapOfEnumStringTest() + { + // TODO unit test for the property 'MapOfEnumString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixLogTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixLogTests.cs new file mode 100644 index 000000000000..3f108758fd2e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixLogTests.cs @@ -0,0 +1,344 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixLog + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixLogTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixLog + //private MixLog instance; + + public MixLogTests() + { + // TODO uncomment below to create an instance of MixLog + //instance = new MixLog(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixLog + /// + [Fact] + public void MixLogInstanceTest() + { + // TODO uncomment below to test "IsType" MixLog + //Assert.IsType(instance); + } + + /// + /// Test the property 'Description' + /// + [Fact] + public void DescriptionTest() + { + // TODO unit test for the property 'Description' + } + + /// + /// Test the property 'FormulaVersionDate' + /// + [Fact] + public void FormulaVersionDateTest() + { + // TODO unit test for the property 'FormulaVersionDate' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'MixDate' + /// + [Fact] + public void MixDateTest() + { + // TODO unit test for the property 'MixDate' + } + + /// + /// Test the property 'TotalOverPoors' + /// + [Fact] + public void TotalOverPoorsTest() + { + // TODO unit test for the property 'TotalOverPoors' + } + + /// + /// Test the property 'TotalRecalculations' + /// + [Fact] + public void TotalRecalculationsTest() + { + // TODO unit test for the property 'TotalRecalculations' + } + + /// + /// Test the property 'TotalSkips' + /// + [Fact] + public void TotalSkipsTest() + { + // TODO unit test for the property 'TotalSkips' + } + + /// + /// Test the property 'TotalUnderPours' + /// + [Fact] + public void TotalUnderPoursTest() + { + // TODO unit test for the property 'TotalUnderPours' + } + + /// + /// Test the property 'BatchNumber' + /// + [Fact] + public void BatchNumberTest() + { + // TODO unit test for the property 'BatchNumber' + } + + /// + /// Test the property 'BrandCode' + /// + [Fact] + public void BrandCodeTest() + { + // TODO unit test for the property 'BrandCode' + } + + /// + /// Test the property 'BrandId' + /// + [Fact] + public void BrandIdTest() + { + // TODO unit test for the property 'BrandId' + } + + /// + /// Test the property 'BrandName' + /// + [Fact] + public void BrandNameTest() + { + // TODO unit test for the property 'BrandName' + } + + /// + /// Test the property 'CategoryCode' + /// + [Fact] + public void CategoryCodeTest() + { + // TODO unit test for the property 'CategoryCode' + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + + /// + /// Test the property 'ColorDescription' + /// + [Fact] + public void ColorDescriptionTest() + { + // TODO unit test for the property 'ColorDescription' + } + + /// + /// Test the property 'Comment' + /// + [Fact] + public void CommentTest() + { + // TODO unit test for the property 'Comment' + } + + /// + /// Test the property 'CommercialProductCode' + /// + [Fact] + public void CommercialProductCodeTest() + { + // TODO unit test for the property 'CommercialProductCode' + } + + /// + /// Test the property 'Country' + /// + [Fact] + public void CountryTest() + { + // TODO unit test for the property 'Country' + } + + /// + /// Test the property 'CreatedBy' + /// + [Fact] + public void CreatedByTest() + { + // TODO unit test for the property 'CreatedBy' + } + + /// + /// Test the property 'CreatedByFirstName' + /// + [Fact] + public void CreatedByFirstNameTest() + { + // TODO unit test for the property 'CreatedByFirstName' + } + + /// + /// Test the property 'CreatedByLastName' + /// + [Fact] + public void CreatedByLastNameTest() + { + // TODO unit test for the property 'CreatedByLastName' + } + + /// + /// Test the property 'DeltaECalculationRepaired' + /// + [Fact] + public void DeltaECalculationRepairedTest() + { + // TODO unit test for the property 'DeltaECalculationRepaired' + } + + /// + /// Test the property 'DeltaECalculationSprayout' + /// + [Fact] + public void DeltaECalculationSprayoutTest() + { + // TODO unit test for the property 'DeltaECalculationSprayout' + } + + /// + /// Test the property 'OwnColorVariantNumber' + /// + [Fact] + public void OwnColorVariantNumberTest() + { + // TODO unit test for the property 'OwnColorVariantNumber' + } + + /// + /// Test the property 'PrimerProductId' + /// + [Fact] + public void PrimerProductIdTest() + { + // TODO unit test for the property 'PrimerProductId' + } + + /// + /// Test the property 'ProductId' + /// + [Fact] + public void ProductIdTest() + { + // TODO unit test for the property 'ProductId' + } + + /// + /// Test the property 'ProductLineCode' + /// + [Fact] + public void ProductLineCodeTest() + { + // TODO unit test for the property 'ProductLineCode' + } + + /// + /// Test the property 'ProductName' + /// + [Fact] + public void ProductNameTest() + { + // TODO unit test for the property 'ProductName' + } + + /// + /// Test the property 'SelectedVersionIndex' + /// + [Fact] + public void SelectedVersionIndexTest() + { + // TODO unit test for the property 'SelectedVersionIndex' + } + + /// + /// Test the property 'ShopId' + /// + [Fact] + public void ShopIdTest() + { + // TODO unit test for the property 'ShopId' + } + + /// + /// Test the property 'SomeCode' + /// + [Fact] + public void SomeCodeTest() + { + // TODO unit test for the property 'SomeCode' + } + + /// + /// Test the property 'TotalPrice' + /// + [Fact] + public void TotalPriceTest() + { + // TODO unit test for the property 'TotalPrice' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs new file mode 100644 index 000000000000..4ce302d1d047 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedAnyOfContent + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedAnyOfContentTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedAnyOfContent + //private MixedAnyOfContent instance; + + public MixedAnyOfContentTests() + { + // TODO uncomment below to create an instance of MixedAnyOfContent + //instance = new MixedAnyOfContent(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedAnyOfContent + /// + [Fact] + public void MixedAnyOfContentInstanceTest() + { + // TODO uncomment below to test "IsType" MixedAnyOfContent + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs new file mode 100644 index 000000000000..53b28cc0658d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedAnyOf + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedAnyOfTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedAnyOf + //private MixedAnyOf instance; + + public MixedAnyOfTests() + { + // TODO uncomment below to create an instance of MixedAnyOf + //instance = new MixedAnyOf(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedAnyOf + /// + [Fact] + public void MixedAnyOfInstanceTest() + { + // TODO uncomment below to test "IsType" MixedAnyOf + //Assert.IsType(instance); + } + + /// + /// Test the property 'Content' + /// + [Fact] + public void ContentTest() + { + // TODO unit test for the property 'Content' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs new file mode 100644 index 000000000000..781b72025008 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedOneOfContent + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedOneOfContentTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedOneOfContent + //private MixedOneOfContent instance; + + public MixedOneOfContentTests() + { + // TODO uncomment below to create an instance of MixedOneOfContent + //instance = new MixedOneOfContent(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedOneOfContent + /// + [Fact] + public void MixedOneOfContentInstanceTest() + { + // TODO uncomment below to test "IsType" MixedOneOfContent + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs new file mode 100644 index 000000000000..ee8b73d44f24 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedOneOf + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedOneOfTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedOneOf + //private MixedOneOf instance; + + public MixedOneOfTests() + { + // TODO uncomment below to create an instance of MixedOneOf + //instance = new MixedOneOf(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedOneOf + /// + [Fact] + public void MixedOneOfInstanceTest() + { + // TODO uncomment below to test "IsType" MixedOneOf + //Assert.IsType(instance); + } + + /// + /// Test the property 'Content' + /// + [Fact] + public void ContentTest() + { + // TODO unit test for the property 'Content' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs new file mode 100644 index 000000000000..d3689c15f401 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedPropertiesAndAdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedPropertiesAndAdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedPropertiesAndAdditionalPropertiesClass + //private MixedPropertiesAndAdditionalPropertiesClass instance; + + public MixedPropertiesAndAdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of MixedPropertiesAndAdditionalPropertiesClass + //instance = new MixedPropertiesAndAdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedPropertiesAndAdditionalPropertiesClass + /// + [Fact] + public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsType" MixedPropertiesAndAdditionalPropertiesClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + + /// + /// Test the property 'Map' + /// + [Fact] + public void MapTest() + { + // TODO unit test for the property 'Map' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + + /// + /// Test the property 'UuidWithPattern' + /// + [Fact] + public void UuidWithPatternTest() + { + // TODO unit test for the property 'UuidWithPattern' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs new file mode 100644 index 000000000000..2ed728a41b84 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedSubId + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedSubIdTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedSubId + //private MixedSubId instance; + + public MixedSubIdTests() + { + // TODO uncomment below to create an instance of MixedSubId + //instance = new MixedSubId(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedSubId + /// + [Fact] + public void MixedSubIdInstanceTest() + { + // TODO uncomment below to test "IsType" MixedSubId + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs new file mode 100644 index 000000000000..3b5e94c5f8f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Model200Response + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class Model200ResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Model200Response + //private Model200Response instance; + + public Model200ResponseTests() + { + // TODO uncomment below to create an instance of Model200Response + //instance = new Model200Response(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Model200Response + /// + [Fact] + public void Model200ResponseInstanceTest() + { + // TODO uncomment below to test "IsType" Model200Response + //Assert.IsType(instance); + } + + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs new file mode 100644 index 000000000000..5a986cfdc6c2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ModelClient + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ModelClientTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ModelClient + //private ModelClient instance; + + public ModelClientTests() + { + // TODO uncomment below to create an instance of ModelClient + //instance = new ModelClient(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ModelClient + /// + [Fact] + public void ModelClientInstanceTest() + { + // TODO uncomment below to test "IsType" ModelClient + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarClient' + /// + [Fact] + public void VarClientTest() + { + // TODO unit test for the property 'VarClient' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NameTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NameTests.cs new file mode 100644 index 000000000000..3aac92ae4683 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NameTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Name + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Name + //private Name instance; + + public NameTests() + { + // TODO uncomment below to create an instance of Name + //instance = new Name(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Name + /// + [Fact] + public void NameInstanceTest() + { + // TODO uncomment below to test "IsType" Name + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarName' + /// + [Fact] + public void VarNameTest() + { + // TODO unit test for the property 'VarName' + } + + /// + /// Test the property 'Property' + /// + [Fact] + public void PropertyTest() + { + // TODO unit test for the property 'Property' + } + + /// + /// Test the property 'SnakeCase' + /// + [Fact] + public void SnakeCaseTest() + { + // TODO unit test for the property 'SnakeCase' + } + + /// + /// Test the property 'Var123Number' + /// + [Fact] + public void Var123NumberTest() + { + // TODO unit test for the property 'Var123Number' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs new file mode 100644 index 000000000000..dd3b74e33061 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NotificationtestGetElementsV1ResponseMPayload + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NotificationtestGetElementsV1ResponseMPayloadTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NotificationtestGetElementsV1ResponseMPayload + //private NotificationtestGetElementsV1ResponseMPayload instance; + + public NotificationtestGetElementsV1ResponseMPayloadTests() + { + // TODO uncomment below to create an instance of NotificationtestGetElementsV1ResponseMPayload + //instance = new NotificationtestGetElementsV1ResponseMPayload(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NotificationtestGetElementsV1ResponseMPayload + /// + [Fact] + public void NotificationtestGetElementsV1ResponseMPayloadInstanceTest() + { + // TODO uncomment below to test "IsType" NotificationtestGetElementsV1ResponseMPayload + //Assert.IsType(instance); + } + + /// + /// Test the property 'AObjVariableobject' + /// + [Fact] + public void AObjVariableobjectTest() + { + // TODO unit test for the property 'AObjVariableobject' + } + + /// + /// Test the property 'PkiNotificationtestID' + /// + [Fact] + public void PkiNotificationtestIDTest() + { + // TODO unit test for the property 'PkiNotificationtestID' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs new file mode 100644 index 000000000000..1e19aa6b8231 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableClass + //private NullableClass instance; + + public NullableClassTests() + { + // TODO uncomment below to create an instance of NullableClass + //instance = new NullableClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableClass + /// + [Fact] + public void NullableClassInstanceTest() + { + // TODO uncomment below to test "IsType" NullableClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayAndItemsNullableProp' + /// + [Fact] + public void ArrayAndItemsNullablePropTest() + { + // TODO unit test for the property 'ArrayAndItemsNullableProp' + } + + /// + /// Test the property 'ArrayItemsNullable' + /// + [Fact] + public void ArrayItemsNullableTest() + { + // TODO unit test for the property 'ArrayItemsNullable' + } + + /// + /// Test the property 'ArrayNullableProp' + /// + [Fact] + public void ArrayNullablePropTest() + { + // TODO unit test for the property 'ArrayNullableProp' + } + + /// + /// Test the property 'BooleanProp' + /// + [Fact] + public void BooleanPropTest() + { + // TODO unit test for the property 'BooleanProp' + } + + /// + /// Test the property 'DateProp' + /// + [Fact] + public void DatePropTest() + { + // TODO unit test for the property 'DateProp' + } + + /// + /// Test the property 'DatetimeProp' + /// + [Fact] + public void DatetimePropTest() + { + // TODO unit test for the property 'DatetimeProp' + } + + /// + /// Test the property 'IntegerProp' + /// + [Fact] + public void IntegerPropTest() + { + // TODO unit test for the property 'IntegerProp' + } + + /// + /// Test the property 'NumberProp' + /// + [Fact] + public void NumberPropTest() + { + // TODO unit test for the property 'NumberProp' + } + + /// + /// Test the property 'ObjectAndItemsNullableProp' + /// + [Fact] + public void ObjectAndItemsNullablePropTest() + { + // TODO unit test for the property 'ObjectAndItemsNullableProp' + } + + /// + /// Test the property 'ObjectItemsNullable' + /// + [Fact] + public void ObjectItemsNullableTest() + { + // TODO unit test for the property 'ObjectItemsNullable' + } + + /// + /// Test the property 'ObjectNullableProp' + /// + [Fact] + public void ObjectNullablePropTest() + { + // TODO unit test for the property 'ObjectNullableProp' + } + + /// + /// Test the property 'StringProp' + /// + [Fact] + public void StringPropTest() + { + // TODO unit test for the property 'StringProp' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs new file mode 100644 index 000000000000..db8c9aa09568 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableGuidClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableGuidClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableGuidClass + //private NullableGuidClass instance; + + public NullableGuidClassTests() + { + // TODO uncomment below to create an instance of NullableGuidClass + //instance = new NullableGuidClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableGuidClass + /// + [Fact] + public void NullableGuidClassInstanceTest() + { + // TODO uncomment below to test "IsType" NullableGuidClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs new file mode 100644 index 000000000000..e65ba44efa2e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableShape + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableShapeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableShape + //private NullableShape instance; + + public NullableShapeTests() + { + // TODO uncomment below to create an instance of NullableShape + //instance = new NullableShape(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableShape + /// + [Fact] + public void NullableShapeInstanceTest() + { + // TODO uncomment below to test "IsType" NullableShape + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs new file mode 100644 index 000000000000..2b88fb1a609e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NumberOnly + //private NumberOnly instance; + + public NumberOnlyTests() + { + // TODO uncomment below to create an instance of NumberOnly + //instance = new NumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NumberOnly + /// + [Fact] + public void NumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" NumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'JustNumber' + /// + [Fact] + public void JustNumberTest() + { + // TODO unit test for the property 'JustNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs new file mode 100644 index 000000000000..078655aaba70 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ObjectWithDeprecatedFields + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ObjectWithDeprecatedFieldsTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ObjectWithDeprecatedFields + //private ObjectWithDeprecatedFields instance; + + public ObjectWithDeprecatedFieldsTests() + { + // TODO uncomment below to create an instance of ObjectWithDeprecatedFields + //instance = new ObjectWithDeprecatedFields(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ObjectWithDeprecatedFields + /// + [Fact] + public void ObjectWithDeprecatedFieldsInstanceTest() + { + // TODO uncomment below to test "IsType" ObjectWithDeprecatedFields + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bars' + /// + [Fact] + public void BarsTest() + { + // TODO unit test for the property 'Bars' + } + + /// + /// Test the property 'DeprecatedRef' + /// + [Fact] + public void DeprecatedRefTest() + { + // TODO unit test for the property 'DeprecatedRef' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs new file mode 100644 index 000000000000..8ef411a15eb6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OneOfString + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OneOfStringTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OneOfString + //private OneOfString instance; + + public OneOfStringTests() + { + // TODO uncomment below to create an instance of OneOfString + //instance = new OneOfString(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OneOfString + /// + [Fact] + public void OneOfStringInstanceTest() + { + // TODO uncomment below to test "IsType" OneOfString + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OrderTests.cs new file mode 100644 index 000000000000..e7187bbdc92c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Order + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OrderTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Order + //private Order instance; + + public OrderTests() + { + // TODO uncomment below to create an instance of Order + //instance = new Order(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Order + /// + [Fact] + public void OrderInstanceTest() + { + // TODO uncomment below to test "IsType" Order + //Assert.IsType(instance); + } + + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'PetId' + /// + [Fact] + public void PetIdTest() + { + // TODO unit test for the property 'PetId' + } + + /// + /// Test the property 'Quantity' + /// + [Fact] + public void QuantityTest() + { + // TODO unit test for the property 'Quantity' + } + + /// + /// Test the property 'ShipDate' + /// + [Fact] + public void ShipDateTest() + { + // TODO unit test for the property 'ShipDate' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs new file mode 100644 index 000000000000..0bb8ce5e5d9b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterComposite + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterCompositeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterComposite + //private OuterComposite instance; + + public OuterCompositeTests() + { + // TODO uncomment below to create an instance of OuterComposite + //instance = new OuterComposite(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterComposite + /// + [Fact] + public void OuterCompositeInstanceTest() + { + // TODO uncomment below to test "IsType" OuterComposite + //Assert.IsType(instance); + } + + /// + /// Test the property 'MyBoolean' + /// + [Fact] + public void MyBooleanTest() + { + // TODO unit test for the property 'MyBoolean' + } + + /// + /// Test the property 'MyNumber' + /// + [Fact] + public void MyNumberTest() + { + // TODO unit test for the property 'MyNumber' + } + + /// + /// Test the property 'MyString' + /// + [Fact] + public void MyStringTest() + { + // TODO unit test for the property 'MyString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs new file mode 100644 index 000000000000..a1d1e1527771 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumDefaultValue + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumDefaultValueTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumDefaultValue + //private OuterEnumDefaultValue instance; + + public OuterEnumDefaultValueTests() + { + // TODO uncomment below to create an instance of OuterEnumDefaultValue + //instance = new OuterEnumDefaultValue(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumDefaultValue + /// + [Fact] + public void OuterEnumDefaultValueInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumDefaultValue + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs new file mode 100644 index 000000000000..030326d75792 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumIntegerDefaultValue + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumIntegerDefaultValueTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumIntegerDefaultValue + //private OuterEnumIntegerDefaultValue instance; + + public OuterEnumIntegerDefaultValueTests() + { + // TODO uncomment below to create an instance of OuterEnumIntegerDefaultValue + //instance = new OuterEnumIntegerDefaultValue(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumIntegerDefaultValue + /// + [Fact] + public void OuterEnumIntegerDefaultValueInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumIntegerDefaultValue + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs new file mode 100644 index 000000000000..1f3bfe459e76 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumInteger + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumIntegerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumInteger + //private OuterEnumInteger instance; + + public OuterEnumIntegerTests() + { + // TODO uncomment below to create an instance of OuterEnumInteger + //instance = new OuterEnumInteger(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumInteger + /// + [Fact] + public void OuterEnumIntegerInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumInteger + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs new file mode 100644 index 000000000000..c4cb8eeecee8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumTest + //private OuterEnumTest instance; + + public OuterEnumTestTests() + { + // TODO uncomment below to create an instance of OuterEnumTest + //instance = new OuterEnumTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumTest + /// + [Fact] + public void OuterEnumTestInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumTest + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs new file mode 100644 index 000000000000..2859494010b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnum + //private OuterEnum instance; + + public OuterEnumTests() + { + // TODO uncomment below to create an instance of OuterEnum + //instance = new OuterEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnum + /// + [Fact] + public void OuterEnumInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnum + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs new file mode 100644 index 000000000000..b0ebddd374f9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ParentPet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ParentPetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ParentPet + //private ParentPet instance; + + public ParentPetTests() + { + // TODO uncomment below to create an instance of ParentPet + //instance = new ParentPet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ParentPet + /// + [Fact] + public void ParentPetInstanceTest() + { + // TODO uncomment below to test "IsType" ParentPet + //Assert.IsType(instance); + } + + /// + /// Test deserialize a ChildCat from type ParentPet + /// + [Fact] + public void ChildCatDeserializeFromParentPetTest() + { + // TODO uncomment below to test deserialize a ChildCat from type ParentPet + //Assert.IsType(JsonConvert.DeserializeObject(new ChildCat().ToJson())); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/PetTests.cs new file mode 100644 index 000000000000..8485d1213ce6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Pet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pet + //private Pet instance; + + public PetTests() + { + // TODO uncomment below to create an instance of Pet + //instance = new Pet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pet + /// + [Fact] + public void PetInstanceTest() + { + // TODO uncomment below to test "IsType" Pet + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + /// + /// Test the property 'PhotoUrls' + /// + [Fact] + public void PhotoUrlsTest() + { + // TODO unit test for the property 'PhotoUrls' + } + + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + + /// + /// Test the property 'Tags' + /// + [Fact] + public void TagsTest() + { + // TODO unit test for the property 'Tags' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/PigTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/PigTests.cs new file mode 100644 index 000000000000..bd052bc705b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/PigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Pig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pig + //private Pig instance; + + public PigTests() + { + // TODO uncomment below to create an instance of Pig + //instance = new Pig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pig + /// + [Fact] + public void PigInstanceTest() + { + // TODO uncomment below to test "IsType" Pig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs new file mode 100644 index 000000000000..23120ba7bdfa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing PolymorphicProperty + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PolymorphicPropertyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for PolymorphicProperty + //private PolymorphicProperty instance; + + public PolymorphicPropertyTests() + { + // TODO uncomment below to create an instance of PolymorphicProperty + //instance = new PolymorphicProperty(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of PolymorphicProperty + /// + [Fact] + public void PolymorphicPropertyInstanceTest() + { + // TODO uncomment below to test "IsType" PolymorphicProperty + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs new file mode 100644 index 000000000000..2ddd31cfcbba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing QuadrilateralInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class QuadrilateralInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for QuadrilateralInterface + //private QuadrilateralInterface instance; + + public QuadrilateralInterfaceTests() + { + // TODO uncomment below to create an instance of QuadrilateralInterface + //instance = new QuadrilateralInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of QuadrilateralInterface + /// + [Fact] + public void QuadrilateralInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" QuadrilateralInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs new file mode 100644 index 000000000000..65673847d759 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Quadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class QuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Quadrilateral + //private Quadrilateral instance; + + public QuadrilateralTests() + { + // TODO uncomment below to create an instance of Quadrilateral + //instance = new Quadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Quadrilateral + /// + [Fact] + public void QuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" Quadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs new file mode 100644 index 000000000000..a4c91cf44a57 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ReadOnlyFirst + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReadOnlyFirstTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ReadOnlyFirst + //private ReadOnlyFirst instance; + + public ReadOnlyFirstTests() + { + // TODO uncomment below to create an instance of ReadOnlyFirst + //instance = new ReadOnlyFirst(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ReadOnlyFirst + /// + [Fact] + public void ReadOnlyFirstInstanceTest() + { + // TODO uncomment below to test "IsType" ReadOnlyFirst + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + /// + /// Test the property 'Baz' + /// + [Fact] + public void BazTest() + { + // TODO unit test for the property 'Baz' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..d1da68281ff0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ReturnTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ReturnTests.cs new file mode 100644 index 000000000000..bbea79ed9511 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ReturnTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Return + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReturnTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Return + //private Return instance; + + public ReturnTests() + { + // TODO uncomment below to create an instance of Return + //instance = new Return(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Return + /// + [Fact] + public void ReturnInstanceTest() + { + // TODO uncomment below to test "IsType" Return + //Assert.IsType(instance); + } + + /// + /// Test the property 'Lock' + /// + [Fact] + public void LockTest() + { + // TODO unit test for the property 'Lock' + } + + /// + /// Test the property 'Abstract' + /// + [Fact] + public void AbstractTest() + { + // TODO unit test for the property 'Abstract' + } + + /// + /// Test the property 'VarReturn' + /// + [Fact] + public void VarReturnTest() + { + // TODO unit test for the property 'VarReturn' + } + + /// + /// Test the property 'Unsafe' + /// + [Fact] + public void UnsafeTest() + { + // TODO unit test for the property 'Unsafe' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs new file mode 100644 index 000000000000..5f21a874c4f0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RolesReportsHashRole + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RolesReportsHashRoleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RolesReportsHashRole + //private RolesReportsHashRole instance; + + public RolesReportsHashRoleTests() + { + // TODO uncomment below to create an instance of RolesReportsHashRole + //instance = new RolesReportsHashRole(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RolesReportsHashRole + /// + [Fact] + public void RolesReportsHashRoleInstanceTest() + { + // TODO uncomment below to test "IsType" RolesReportsHashRole + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs new file mode 100644 index 000000000000..cddb8dc6f0b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RolesReportsHash + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RolesReportsHashTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RolesReportsHash + //private RolesReportsHash instance; + + public RolesReportsHashTests() + { + // TODO uncomment below to create an instance of RolesReportsHash + //instance = new RolesReportsHash(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RolesReportsHash + /// + [Fact] + public void RolesReportsHashInstanceTest() + { + // TODO uncomment below to test "IsType" RolesReportsHash + //Assert.IsType(instance); + } + + /// + /// Test the property 'Role' + /// + [Fact] + public void RoleTest() + { + // TODO unit test for the property 'Role' + } + + /// + /// Test the property 'RoleUuid' + /// + [Fact] + public void RoleUuidTest() + { + // TODO unit test for the property 'RoleUuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs new file mode 100644 index 000000000000..085d3e550a10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ScaleneTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ScaleneTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ScaleneTriangle + //private ScaleneTriangle instance; + + public ScaleneTriangleTests() + { + // TODO uncomment below to create an instance of ScaleneTriangle + //instance = new ScaleneTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ScaleneTriangle + /// + [Fact] + public void ScaleneTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" ScaleneTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs new file mode 100644 index 000000000000..62d6d69ff72d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ShapeInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ShapeInterface + //private ShapeInterface instance; + + public ShapeInterfaceTests() + { + // TODO uncomment below to create an instance of ShapeInterface + //instance = new ShapeInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ShapeInterface + /// + [Fact] + public void ShapeInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" ShapeInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs new file mode 100644 index 000000000000..dc6970b16f15 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ShapeOrNull + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeOrNullTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ShapeOrNull + //private ShapeOrNull instance; + + public ShapeOrNullTests() + { + // TODO uncomment below to create an instance of ShapeOrNull + //instance = new ShapeOrNull(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ShapeOrNull + /// + [Fact] + public void ShapeOrNullInstanceTest() + { + // TODO uncomment below to test "IsType" ShapeOrNull + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ShapeTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ShapeTests.cs new file mode 100644 index 000000000000..dbdf012c5ba4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ShapeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Shape + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Shape + //private Shape instance; + + public ShapeTests() + { + // TODO uncomment below to create an instance of Shape + //instance = new Shape(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Shape + /// + [Fact] + public void ShapeInstanceTest() + { + // TODO uncomment below to test "IsType" Shape + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs new file mode 100644 index 000000000000..baa6e1e9f6fd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing SimpleQuadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class SimpleQuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for SimpleQuadrilateral + //private SimpleQuadrilateral instance; + + public SimpleQuadrilateralTests() + { + // TODO uncomment below to create an instance of SimpleQuadrilateral + //instance = new SimpleQuadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of SimpleQuadrilateral + /// + [Fact] + public void SimpleQuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" SimpleQuadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs new file mode 100644 index 000000000000..23763d9c3af0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing SpecialModelName + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class SpecialModelNameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for SpecialModelName + //private SpecialModelName instance; + + public SpecialModelNameTests() + { + // TODO uncomment below to create an instance of SpecialModelName + //instance = new SpecialModelName(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of SpecialModelName + /// + [Fact] + public void SpecialModelNameInstanceTest() + { + // TODO uncomment below to test "IsType" SpecialModelName + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarSpecialModelName' + /// + [Fact] + public void VarSpecialModelNameTest() + { + // TODO unit test for the property 'VarSpecialModelName' + } + + /// + /// Test the property 'SpecialPropertyName' + /// + [Fact] + public void SpecialPropertyNameTest() + { + // TODO unit test for the property 'SpecialPropertyName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TagTests.cs new file mode 100644 index 000000000000..fe7f3d82baba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TagTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Tag + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TagTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Tag + //private Tag instance; + + public TagTests() + { + // TODO uncomment below to create an instance of Tag + //instance = new Tag(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Tag + /// + [Fact] + public void TagInstanceTest() + { + // TODO uncomment below to test "IsType" Tag + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs new file mode 100644 index 000000000000..eca020ce1fae --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestCollectionEndingWithWordListObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestCollectionEndingWithWordListObjectTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestCollectionEndingWithWordListObject + //private TestCollectionEndingWithWordListObject instance; + + public TestCollectionEndingWithWordListObjectTests() + { + // TODO uncomment below to create an instance of TestCollectionEndingWithWordListObject + //instance = new TestCollectionEndingWithWordListObject(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestCollectionEndingWithWordListObject + /// + [Fact] + public void TestCollectionEndingWithWordListObjectInstanceTest() + { + // TODO uncomment below to test "IsType" TestCollectionEndingWithWordListObject + //Assert.IsType(instance); + } + + /// + /// Test the property 'TestCollectionEndingWithWordList' + /// + [Fact] + public void TestCollectionEndingWithWordListTest() + { + // TODO unit test for the property 'TestCollectionEndingWithWordList' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs new file mode 100644 index 000000000000..e3c86aefabe3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestCollectionEndingWithWordList + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestCollectionEndingWithWordListTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestCollectionEndingWithWordList + //private TestCollectionEndingWithWordList instance; + + public TestCollectionEndingWithWordListTests() + { + // TODO uncomment below to create an instance of TestCollectionEndingWithWordList + //instance = new TestCollectionEndingWithWordList(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestCollectionEndingWithWordList + /// + [Fact] + public void TestCollectionEndingWithWordListInstanceTest() + { + // TODO uncomment below to test "IsType" TestCollectionEndingWithWordList + //Assert.IsType(instance); + } + + /// + /// Test the property 'Value' + /// + [Fact] + public void ValueTest() + { + // TODO unit test for the property 'Value' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs new file mode 100644 index 000000000000..23e08d8e4e9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestInlineFreeformAdditionalPropertiesRequest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestInlineFreeformAdditionalPropertiesRequestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestInlineFreeformAdditionalPropertiesRequest + //private TestInlineFreeformAdditionalPropertiesRequest instance; + + public TestInlineFreeformAdditionalPropertiesRequestTests() + { + // TODO uncomment below to create an instance of TestInlineFreeformAdditionalPropertiesRequest + //instance = new TestInlineFreeformAdditionalPropertiesRequest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestInlineFreeformAdditionalPropertiesRequest + /// + [Fact] + public void TestInlineFreeformAdditionalPropertiesRequestInstanceTest() + { + // TODO uncomment below to test "IsType" TestInlineFreeformAdditionalPropertiesRequest + //Assert.IsType(instance); + } + + /// + /// Test the property 'SomeProperty' + /// + [Fact] + public void SomePropertyTest() + { + // TODO unit test for the property 'SomeProperty' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs new file mode 100644 index 000000000000..1293a2b212ed --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TriangleInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TriangleInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TriangleInterface + //private TriangleInterface instance; + + public TriangleInterfaceTests() + { + // TODO uncomment below to create an instance of TriangleInterface + //instance = new TriangleInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TriangleInterface + /// + [Fact] + public void TriangleInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" TriangleInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TriangleTests.cs new file mode 100644 index 000000000000..4cb535223483 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/TriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Triangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Triangle + //private Triangle instance; + + public TriangleTests() + { + // TODO uncomment below to create an instance of Triangle + //instance = new Triangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Triangle + /// + [Fact] + public void TriangleInstanceTest() + { + // TODO uncomment below to test "IsType" Triangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/UserTests.cs new file mode 100644 index 000000000000..6415f8561f1f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing User + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class UserTests : IDisposable + { + // TODO uncomment below to declare an instance variable for User + //private User instance; + + public UserTests() + { + // TODO uncomment below to create an instance of User + //instance = new User(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of User + /// + [Fact] + public void UserInstanceTest() + { + // TODO uncomment below to test "IsType" User + //Assert.IsType(instance); + } + + /// + /// Test the property 'AnyTypeProp' + /// + [Fact] + public void AnyTypePropTest() + { + // TODO unit test for the property 'AnyTypeProp' + } + + /// + /// Test the property 'AnyTypePropNullable' + /// + [Fact] + public void AnyTypePropNullableTest() + { + // TODO unit test for the property 'AnyTypePropNullable' + } + + /// + /// Test the property 'Email' + /// + [Fact] + public void EmailTest() + { + // TODO unit test for the property 'Email' + } + + /// + /// Test the property 'FirstName' + /// + [Fact] + public void FirstNameTest() + { + // TODO unit test for the property 'FirstName' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'LastName' + /// + [Fact] + public void LastNameTest() + { + // TODO unit test for the property 'LastName' + } + + /// + /// Test the property 'ObjectWithNoDeclaredProps' + /// + [Fact] + public void ObjectWithNoDeclaredPropsTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredProps' + } + + /// + /// Test the property 'ObjectWithNoDeclaredPropsNullable' + /// + [Fact] + public void ObjectWithNoDeclaredPropsNullableTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Phone' + /// + [Fact] + public void PhoneTest() + { + // TODO unit test for the property 'Phone' + } + + /// + /// Test the property 'UserStatus' + /// + [Fact] + public void UserStatusTest() + { + // TODO unit test for the property 'UserStatus' + } + + /// + /// Test the property 'Username' + /// + [Fact] + public void UsernameTest() + { + // TODO unit test for the property 'Username' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/WhaleTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/WhaleTests.cs new file mode 100644 index 000000000000..7d05cc5e59ab --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/WhaleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Whale + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class WhaleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Whale + //private Whale instance; + + public WhaleTests() + { + // TODO uncomment below to create an instance of Whale + //instance = new Whale(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Whale + /// + [Fact] + public void WhaleInstanceTest() + { + // TODO uncomment below to test "IsType" Whale + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'HasBaleen' + /// + [Fact] + public void HasBaleenTest() + { + // TODO unit test for the property 'HasBaleen' + } + + /// + /// Test the property 'HasTeeth' + /// + [Fact] + public void HasTeethTest() + { + // TODO unit test for the property 'HasTeeth' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ZebraTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ZebraTests.cs new file mode 100644 index 000000000000..cd0d1c1c361c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ZebraTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Zebra + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZebraTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Zebra + //private Zebra instance; + + public ZebraTests() + { + // TODO uncomment below to create an instance of Zebra + //instance = new Zebra(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Zebra + /// + [Fact] + public void ZebraInstanceTest() + { + // TODO uncomment below to test "IsType" Zebra + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 000000000000..b432edb28c23 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs new file mode 100644 index 000000000000..3689a873c342 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnum + //private ZeroBasedEnum instance; + + public ZeroBasedEnumTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnum + //instance = new ZeroBasedEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnum + /// + [Fact] + public void ZeroBasedEnumInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnum + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..a4e283f2d333 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net9.0 + false + enable + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs new file mode 100644 index 000000000000..a34c828167b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -0,0 +1,405 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IAnotherFakeApi : IApi + { + /// + /// The class containing the events + /// + AnotherFakeApiEvents Events { get; } + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// client model + /// Cancellation Token to cancel the request. + /// <?> + Task Call123TestSpecialTagsOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ICall123TestSpecialTagsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class AnotherFakeApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnCall123TestSpecialTags; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorCall123TestSpecialTags; + + internal void ExecuteOnCall123TestSpecialTags(AnotherFakeApi.Call123TestSpecialTagsApiResponse apiResponse) + { + OnCall123TestSpecialTags?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCall123TestSpecialTags(Exception exception) + { + OnErrorCall123TestSpecialTags?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class AnotherFakeApi : IAnotherFakeApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public AnotherFakeApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, AnotherFakeApiEvents anotherFakeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = anotherFakeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatCall123TestSpecialTags(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCall123TestSpecialTags(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCall123TestSpecialTagsDefaultImplementation(ICall123TestSpecialTagsApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterCall123TestSpecialTags(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCall123TestSpecialTags(ref bool suppressDefaultLog, ICall123TestSpecialTagsApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCall123TestSpecialTagsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCall123TestSpecialTags(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCall123TestSpecialTags(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task Call123TestSpecialTagsOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await Call123TestSpecialTagsAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCall123TestSpecialTags(modelClient); + + FormatCall123TestSpecialTags(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/another-fake/dummy"; + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + Call123TestSpecialTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCall123TestSpecialTagsDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnCall123TestSpecialTags(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCall123TestSpecialTagsDefaultImplementation(e, "/another-fake/dummy", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorCall123TestSpecialTags(e); + throw; + } + } + + /// + /// The + /// + public partial class Call123TestSpecialTagsApiResponse : Org.OpenAPITools.Client.ApiResponse, ICall123TestSpecialTagsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public Call123TestSpecialTagsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..cced9ce3479a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,1358 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IDefaultApi : IApi + { + /// + /// The class containing the events + /// + DefaultApiEvents Events { get; } + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task FooGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetCountryAsync(string country, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetCountryOrDefaultAsync(string country, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task HelloAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Cancellation Token to cancel the request. + /// <?> + Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task RolesReportGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task TestAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task TestOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IFooGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IGetCountryApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class DefaultApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnFooGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFooGet; + + internal void ExecuteOnFooGet(DefaultApi.FooGetApiResponse apiResponse) + { + OnFooGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFooGet(Exception exception) + { + OnErrorFooGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetCountry; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetCountry; + + internal void ExecuteOnGetCountry(DefaultApi.GetCountryApiResponse apiResponse) + { + OnGetCountry?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetCountry(Exception exception) + { + OnErrorGetCountry?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnHello; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorHello; + + internal void ExecuteOnHello(DefaultApi.HelloApiResponse apiResponse) + { + OnHello?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorHello(Exception exception) + { + OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnRolesReportGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorRolesReportGet; + + internal void ExecuteOnRolesReportGet(DefaultApi.RolesReportGetApiResponse apiResponse) + { + OnRolesReportGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorRolesReportGet(Exception exception) + { + OnErrorRolesReportGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTest; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTest; + + internal void ExecuteOnTest(DefaultApi.TestApiResponse apiResponse) + { + OnTest?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTest(Exception exception) + { + OnErrorTest?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class DefaultApi : IDefaultApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public DefaultApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = defaultApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + /// + /// Processes the server response + /// + /// + private void AfterFooGetDefaultImplementation(IFooGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterFooGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterFooGet(ref bool suppressDefaultLog, IFooGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorFooGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFooGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorFooGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FooGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/foo"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FooGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFooGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnFooGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFooGetDefaultImplementation(e, "/foo", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorFooGet(e); + throw; + } + } + + /// + /// The + /// + public partial class FooGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IFooGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FooGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + /// + /// Deserializes the response if the response is 0 Default + /// + /// + public Org.OpenAPITools.Model.FooGetDefaultResponse? Default() + { + // This logic may be modified with the AsModel.mustache template + return IsDefault + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 0 Default and the deserialized response is not null + /// + /// + /// + public bool TryDefault([NotNullWhen(true)]out Org.OpenAPITools.Model.FooGetDefaultResponse? result) + { + result = null; + + try + { + result = Default(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetCountry(ref string country); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateGetCountry(string country) + { + if (country == null) + throw new ArgumentNullException(nameof(country)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetCountryDefaultImplementation(IGetCountryApiResponse apiResponseLocalVar, string country) + { + bool suppressDefaultLog = false; + AfterGetCountry(ref suppressDefaultLog, apiResponseLocalVar, country); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetCountry(ref bool suppressDefaultLog, IGetCountryApiResponse apiResponseLocalVar, string country); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetCountryDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string country) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetCountry(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, country); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetCountry(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string country); + + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetCountryOrDefaultAsync(string country, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetCountryAsync(country, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetCountryAsync(string country, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateGetCountry(country); + + FormatGetCountry(ref country); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/country"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("country", ClientUtils.ParameterToString(country))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetCountryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetCountryDefaultImplementation(apiResponseLocalVar, country); + + Events.ExecuteOnGetCountry(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetCountryDefaultImplementation(e, "/country", uriBuilderLocalVar.Path, country); + Events.ExecuteOnErrorGetCountry(e); + throw; + } + } + + /// + /// The + /// + public partial class GetCountryApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetCountryApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetCountryApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterHelloDefaultImplementation(IHelloApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterHello(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterHello(ref bool suppressDefaultLog, IHelloApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorHelloDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorHello(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorHello(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Hello Hello + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await HelloAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task HelloAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/hello"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + HelloApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); + + AfterHelloDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnHello(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorHelloDefaultImplementation(e, "/hello", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorHello(e); + throw; + } + } + + /// + /// The + /// + public partial class HelloApiResponse : Org.OpenAPITools.Client.ApiResponse, IHelloApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public HelloApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterRolesReportGetDefaultImplementation(IRolesReportGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterRolesReportGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterRolesReportGet(ref bool suppressDefaultLog, IRolesReportGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorRolesReportGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorRolesReportGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorRolesReportGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task RolesReportGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await RolesReportGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/roles/report"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + RolesReportGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); + + AfterRolesReportGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnRolesReportGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorRolesReportGetDefaultImplementation(e, "/roles/report", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorRolesReportGet(e); + throw; + } + } + + /// + /// The + /// + public partial class RolesReportGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IRolesReportGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public RolesReportGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterTestDefaultImplementation(ITestApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterTest(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterTest(ref bool suppressDefaultLog, ITestApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorTestDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTest(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorTest(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/test"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnTest(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestDefaultImplementation(e, "/test", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorTest(e); + throw; + } + } + + /// + /// The + /// + public partial class TestApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs new file mode 100644 index 000000000000..39b422f6f7f7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeApi.cs @@ -0,0 +1,5690 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IFakeApi : IApi + { + /// + /// The class containing the events + /// + FakeApiEvents Events { get; } + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task FakeHealthGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task FakeHealthGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetArrayOfEnumsAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task TestBodyWithFileSchemaOrDefaultAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithQueryParamsAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task TestBodyWithQueryParamsOrDefaultAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// client model + /// Cancellation Token to cancel the request. + /// <?> + Task TestClientModelOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEndpointParametersAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task TestEndpointParametersOrDefaultAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEnumParametersAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task TestEnumParametersOrDefaultAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestGroupParametersAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestInlineAdditionalPropertiesOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestInlineFreeformAdditionalPropertiesOrDefaultAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + Task TestJsonFormDataAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <?> + Task TestJsonFormDataOrDefaultAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestQueryParameterCollectionFormatAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string? requiredNullable = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <?> + Task TestQueryParameterCollectionFormatOrDefaultAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string? requiredNullable = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestStringMapReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced string map + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestStringMapReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IFakeHealthGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterBooleanSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterCompositeSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterNumberSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterStringSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetArrayOfEnumsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetMixedAnyOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetMixedOneOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestBodyWithFileSchemaApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestBodyWithQueryParamsApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestClientModelApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestEndpointParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface ITestEnumParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface ITestGroupParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface ITestInlineAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestInlineFreeformAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestJsonFormDataApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestQueryParameterCollectionFormatApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestStringMapReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeHealthGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeHealthGet; + + internal void ExecuteOnFakeHealthGet(FakeApi.FakeHealthGetApiResponse apiResponse) + { + OnFakeHealthGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeHealthGet(Exception exception) + { + OnErrorFakeHealthGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeOuterBooleanSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeOuterBooleanSerialize; + + internal void ExecuteOnFakeOuterBooleanSerialize(FakeApi.FakeOuterBooleanSerializeApiResponse apiResponse) + { + OnFakeOuterBooleanSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterBooleanSerialize(Exception exception) + { + OnErrorFakeOuterBooleanSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeOuterCompositeSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeOuterCompositeSerialize; + + internal void ExecuteOnFakeOuterCompositeSerialize(FakeApi.FakeOuterCompositeSerializeApiResponse apiResponse) + { + OnFakeOuterCompositeSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterCompositeSerialize(Exception exception) + { + OnErrorFakeOuterCompositeSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeOuterNumberSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeOuterNumberSerialize; + + internal void ExecuteOnFakeOuterNumberSerialize(FakeApi.FakeOuterNumberSerializeApiResponse apiResponse) + { + OnFakeOuterNumberSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterNumberSerialize(Exception exception) + { + OnErrorFakeOuterNumberSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeOuterStringSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeOuterStringSerialize; + + internal void ExecuteOnFakeOuterStringSerialize(FakeApi.FakeOuterStringSerializeApiResponse apiResponse) + { + OnFakeOuterStringSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterStringSerialize(Exception exception) + { + OnErrorFakeOuterStringSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetArrayOfEnums; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetArrayOfEnums; + + internal void ExecuteOnGetArrayOfEnums(FakeApi.GetArrayOfEnumsApiResponse apiResponse) + { + OnGetArrayOfEnums?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetArrayOfEnums(Exception exception) + { + OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetMixedAnyOf; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetMixedAnyOf; + + internal void ExecuteOnGetMixedAnyOf(FakeApi.GetMixedAnyOfApiResponse apiResponse) + { + OnGetMixedAnyOf?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetMixedAnyOf(Exception exception) + { + OnErrorGetMixedAnyOf?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetMixedOneOf; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetMixedOneOf; + + internal void ExecuteOnGetMixedOneOf(FakeApi.GetMixedOneOfApiResponse apiResponse) + { + OnGetMixedOneOf?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetMixedOneOf(Exception exception) + { + OnErrorGetMixedOneOf?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestAdditionalPropertiesReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestAdditionalPropertiesReference; + + internal void ExecuteOnTestAdditionalPropertiesReference(FakeApi.TestAdditionalPropertiesReferenceApiResponse apiResponse) + { + OnTestAdditionalPropertiesReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestAdditionalPropertiesReference(Exception exception) + { + OnErrorTestAdditionalPropertiesReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestBodyWithFileSchema; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestBodyWithFileSchema; + + internal void ExecuteOnTestBodyWithFileSchema(FakeApi.TestBodyWithFileSchemaApiResponse apiResponse) + { + OnTestBodyWithFileSchema?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestBodyWithFileSchema(Exception exception) + { + OnErrorTestBodyWithFileSchema?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestBodyWithQueryParams; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestBodyWithQueryParams; + + internal void ExecuteOnTestBodyWithQueryParams(FakeApi.TestBodyWithQueryParamsApiResponse apiResponse) + { + OnTestBodyWithQueryParams?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestBodyWithQueryParams(Exception exception) + { + OnErrorTestBodyWithQueryParams?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestClientModel; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestClientModel; + + internal void ExecuteOnTestClientModel(FakeApi.TestClientModelApiResponse apiResponse) + { + OnTestClientModel?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestClientModel(Exception exception) + { + OnErrorTestClientModel?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestEndpointParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestEndpointParameters; + + internal void ExecuteOnTestEndpointParameters(FakeApi.TestEndpointParametersApiResponse apiResponse) + { + OnTestEndpointParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestEndpointParameters(Exception exception) + { + OnErrorTestEndpointParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestEnumParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestEnumParameters; + + internal void ExecuteOnTestEnumParameters(FakeApi.TestEnumParametersApiResponse apiResponse) + { + OnTestEnumParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestEnumParameters(Exception exception) + { + OnErrorTestEnumParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestGroupParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestGroupParameters; + + internal void ExecuteOnTestGroupParameters(FakeApi.TestGroupParametersApiResponse apiResponse) + { + OnTestGroupParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestGroupParameters(Exception exception) + { + OnErrorTestGroupParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestInlineAdditionalProperties; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestInlineAdditionalProperties; + + internal void ExecuteOnTestInlineAdditionalProperties(FakeApi.TestInlineAdditionalPropertiesApiResponse apiResponse) + { + OnTestInlineAdditionalProperties?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestInlineAdditionalProperties(Exception exception) + { + OnErrorTestInlineAdditionalProperties?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestInlineFreeformAdditionalProperties; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestInlineFreeformAdditionalProperties; + + internal void ExecuteOnTestInlineFreeformAdditionalProperties(FakeApi.TestInlineFreeformAdditionalPropertiesApiResponse apiResponse) + { + OnTestInlineFreeformAdditionalProperties?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestInlineFreeformAdditionalProperties(Exception exception) + { + OnErrorTestInlineFreeformAdditionalProperties?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestJsonFormData; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestJsonFormData; + + internal void ExecuteOnTestJsonFormData(FakeApi.TestJsonFormDataApiResponse apiResponse) + { + OnTestJsonFormData?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestJsonFormData(Exception exception) + { + OnErrorTestJsonFormData?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestQueryParameterCollectionFormat; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestQueryParameterCollectionFormat; + + internal void ExecuteOnTestQueryParameterCollectionFormat(FakeApi.TestQueryParameterCollectionFormatApiResponse apiResponse) + { + OnTestQueryParameterCollectionFormat?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestQueryParameterCollectionFormat(Exception exception) + { + OnErrorTestQueryParameterCollectionFormat?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestStringMapReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestStringMapReference; + + internal void ExecuteOnTestStringMapReference(FakeApi.TestStringMapReferenceApiResponse apiResponse) + { + OnTestStringMapReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestStringMapReference(Exception exception) + { + OnErrorTestStringMapReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class FakeApi : IFakeApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public FakeApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, FakeApiEvents fakeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = fakeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + /// + /// Processes the server response + /// + /// + private void AfterFakeHealthGetDefaultImplementation(IFakeHealthGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterFakeHealthGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterFakeHealthGet(ref bool suppressDefaultLog, IFakeHealthGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorFakeHealthGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeHealthGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorFakeHealthGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Health check endpoint + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeHealthGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeHealthGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeHealthGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/health"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeHealthGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeHealthGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnFakeHealthGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeHealthGetDefaultImplementation(e, "/fake/health", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorFakeHealthGet(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeHealthGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeHealthGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeHealthGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.HealthCheckResult? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.HealthCheckResult? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterBooleanSerialize(ref Option body); + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterBooleanSerializeDefaultImplementation(IFakeOuterBooleanSerializeApiResponse apiResponseLocalVar, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterBooleanSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, IFakeOuterBooleanSerializeApiResponse apiResponseLocalVar, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterBooleanSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterBooleanSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body); + + /// + /// Test serialization of outer boolean types + /// + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterBooleanSerializeAsync(body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatFakeOuterBooleanSerialize(ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/boolean"; + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterBooleanSerializeDefaultImplementation(apiResponseLocalVar, body); + + Events.ExecuteOnFakeOuterBooleanSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterBooleanSerializeDefaultImplementation(e, "/fake/outer/boolean", uriBuilderLocalVar.Path, body); + Events.ExecuteOnErrorFakeOuterBooleanSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterBooleanSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterBooleanSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterBooleanSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public bool? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out bool? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterCompositeSerialize(Option outerComposite); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterCompositeSerialize(Option outerComposite) + { + if (outerComposite.IsSet && outerComposite.Value == null) + throw new ArgumentNullException(nameof(outerComposite)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterCompositeSerializeDefaultImplementation(IFakeOuterCompositeSerializeApiResponse apiResponseLocalVar, Option outerComposite) + { + bool suppressDefaultLog = false; + AfterFakeOuterCompositeSerialize(ref suppressDefaultLog, apiResponseLocalVar, outerComposite); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, IFakeOuterCompositeSerializeApiResponse apiResponseLocalVar, Option outerComposite); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option outerComposite) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterCompositeSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, outerComposite); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterCompositeSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option outerComposite); + + /// + /// Test serialization of object with outer number type + /// + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterCompositeSerializeAsync(outerComposite, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFakeOuterCompositeSerialize(outerComposite); + + FormatFakeOuterCompositeSerialize(outerComposite); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/composite"; + + if (outerComposite.IsSet) + httpRequestMessageLocalVar.Content = (outerComposite.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterCompositeSerializeDefaultImplementation(apiResponseLocalVar, outerComposite); + + Events.ExecuteOnFakeOuterCompositeSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterCompositeSerializeDefaultImplementation(e, "/fake/outer/composite", uriBuilderLocalVar.Path, outerComposite); + Events.ExecuteOnErrorFakeOuterCompositeSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterCompositeSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterCompositeSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterCompositeSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.OuterComposite? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.OuterComposite? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterNumberSerialize(ref Option body); + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterNumberSerializeDefaultImplementation(IFakeOuterNumberSerializeApiResponse apiResponseLocalVar, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterNumberSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, IFakeOuterNumberSerializeApiResponse apiResponseLocalVar, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterNumberSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterNumberSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body); + + /// + /// Test serialization of outer number types + /// + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterNumberSerializeAsync(body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatFakeOuterNumberSerialize(ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/number"; + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterNumberSerializeDefaultImplementation(apiResponseLocalVar, body); + + Events.ExecuteOnFakeOuterNumberSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterNumberSerializeDefaultImplementation(e, "/fake/outer/number", uriBuilderLocalVar.Path, body); + Events.ExecuteOnErrorFakeOuterNumberSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterNumberSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterNumberSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterNumberSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public decimal? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out decimal? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref Option body); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterStringSerialize(Option body) + { + if (body.IsSet && body.Value == null) + throw new ArgumentNullException(nameof(body)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterFakeOuterStringSerializeDefaultImplementation(IFakeOuterStringSerializeApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterStringSerialize(ref suppressDefaultLog, apiResponseLocalVar, requiredStringUuid, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, IFakeOuterStringSerializeApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Guid requiredStringUuid, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterStringSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requiredStringUuid, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterStringSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Guid requiredStringUuid, Option body); + + /// + /// Test serialization of outer string types + /// + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterStringSerializeAsync(requiredStringUuid, body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFakeOuterStringSerialize(body); + + FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/string"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["required_string_uuid"] = ClientUtils.ParameterToString(requiredStringUuid); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterStringSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterStringSerializeDefaultImplementation(apiResponseLocalVar, requiredStringUuid, body); + + Events.ExecuteOnFakeOuterStringSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterStringSerializeDefaultImplementation(e, "/fake/outer/string", uriBuilderLocalVar.Path, requiredStringUuid, body); + Events.ExecuteOnErrorFakeOuterStringSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterStringSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterStringSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterStringSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public string? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out string? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetArrayOfEnumsDefaultImplementation(IGetArrayOfEnumsApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetArrayOfEnums(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetArrayOfEnums(ref bool suppressDefaultLog, IGetArrayOfEnumsApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetArrayOfEnumsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetArrayOfEnums(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetArrayOfEnums(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Array of Enums + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetArrayOfEnumsAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetArrayOfEnumsAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/array-of-enums"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetArrayOfEnumsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetArrayOfEnumsDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetArrayOfEnums(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetArrayOfEnumsDefaultImplementation(e, "/fake/array-of-enums", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetArrayOfEnums(e); + throw; + } + } + + /// + /// The + /// + public partial class GetArrayOfEnumsApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetArrayOfEnumsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetArrayOfEnumsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetMixedAnyOfDefaultImplementation(IGetMixedAnyOfApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetMixedAnyOf(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetMixedAnyOf(ref bool suppressDefaultLog, IGetMixedAnyOfApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetMixedAnyOfDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetMixedAnyOf(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetMixedAnyOf(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Test mixed type anyOf deserialization + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetMixedAnyOfAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/anyOf"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetMixedAnyOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetMixedAnyOf(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetMixedAnyOfDefaultImplementation(e, "/fake/mixed/anyOf", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetMixedAnyOf(e); + throw; + } + } + + /// + /// The + /// + public partial class GetMixedAnyOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedAnyOfApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetMixedAnyOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.MixedAnyOf? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedAnyOf? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetMixedOneOfDefaultImplementation(IGetMixedOneOfApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetMixedOneOf(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetMixedOneOf(ref bool suppressDefaultLog, IGetMixedOneOfApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetMixedOneOfDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetMixedOneOf(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetMixedOneOf(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Test mixed type oneOf deserialization + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetMixedOneOfAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/oneOf"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetMixedOneOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetMixedOneOf(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetMixedOneOfDefaultImplementation(e, "/fake/mixed/oneOf", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetMixedOneOf(e); + throw; + } + } + + /// + /// The + /// + public partial class GetMixedOneOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedOneOfApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetMixedOneOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.MixedOneOf? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedOneOf? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestAdditionalPropertiesReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestAdditionalPropertiesReferenceDefaultImplementation(ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestAdditionalPropertiesReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestAdditionalPropertiesReference(ref bool suppressDefaultLog, ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestAdditionalPropertiesReference(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestAdditionalPropertiesReference(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAdditionalPropertiesReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestAdditionalPropertiesReference(requestBody); + + FormatTestAdditionalPropertiesReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/additionalProperties-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestAdditionalPropertiesReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(e, "/fake/additionalProperties-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestAdditionalPropertiesReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestAdditionalPropertiesReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestAdditionalPropertiesReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) + { + if (fileSchemaTestClass == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestBodyWithFileSchemaDefaultImplementation(ITestBodyWithFileSchemaApiResponse apiResponseLocalVar, FileSchemaTestClass fileSchemaTestClass) + { + bool suppressDefaultLog = false; + AfterTestBodyWithFileSchema(ref suppressDefaultLog, apiResponseLocalVar, fileSchemaTestClass); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestBodyWithFileSchema(ref bool suppressDefaultLog, ITestBodyWithFileSchemaApiResponse apiResponseLocalVar, FileSchemaTestClass fileSchemaTestClass); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestBodyWithFileSchemaDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, FileSchemaTestClass fileSchemaTestClass) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestBodyWithFileSchema(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, fileSchemaTestClass); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestBodyWithFileSchema(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, FileSchemaTestClass fileSchemaTestClass); + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithFileSchemaOrDefaultAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestBodyWithFileSchemaAsync(fileSchemaTestClass, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestBodyWithFileSchema(fileSchemaTestClass); + + FormatTestBodyWithFileSchema(fileSchemaTestClass); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/body-with-file-schema"; + + httpRequestMessageLocalVar.Content = (fileSchemaTestClass as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(fileSchemaTestClass, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestBodyWithFileSchemaDefaultImplementation(apiResponseLocalVar, fileSchemaTestClass); + + Events.ExecuteOnTestBodyWithFileSchema(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestBodyWithFileSchemaDefaultImplementation(e, "/fake/body-with-file-schema", uriBuilderLocalVar.Path, fileSchemaTestClass); + Events.ExecuteOnErrorTestBodyWithFileSchema(e); + throw; + } + } + + /// + /// The + /// + public partial class TestBodyWithFileSchemaApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestBodyWithFileSchemaApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestBodyWithFileSchemaApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestBodyWithQueryParams(ref string query, User user); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateTestBodyWithQueryParams(string query, User user) + { + if (query == null) + throw new ArgumentNullException(nameof(query)); + + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterTestBodyWithQueryParamsDefaultImplementation(ITestBodyWithQueryParamsApiResponse apiResponseLocalVar, string query, User user) + { + bool suppressDefaultLog = false; + AfterTestBodyWithQueryParams(ref suppressDefaultLog, apiResponseLocalVar, query, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterTestBodyWithQueryParams(ref bool suppressDefaultLog, ITestBodyWithQueryParamsApiResponse apiResponseLocalVar, string query, User user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorTestBodyWithQueryParamsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string query, User user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestBodyWithQueryParams(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, query, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestBodyWithQueryParams(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string query, User user); + + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithQueryParamsOrDefaultAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestBodyWithQueryParamsAsync(query, user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithQueryParamsAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestBodyWithQueryParams(query, user); + + FormatTestBodyWithQueryParams(ref query, user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/body-with-query-params"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["query"] = ClientUtils.ParameterToString(query); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestBodyWithQueryParamsDefaultImplementation(apiResponseLocalVar, query, user); + + Events.ExecuteOnTestBodyWithQueryParams(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestBodyWithQueryParamsDefaultImplementation(e, "/fake/body-with-query-params", uriBuilderLocalVar.Path, query, user); + Events.ExecuteOnErrorTestBodyWithQueryParams(e); + throw; + } + } + + /// + /// The + /// + public partial class TestBodyWithQueryParamsApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestBodyWithQueryParamsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestBodyWithQueryParamsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestClientModel(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestClientModel(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestClientModelDefaultImplementation(ITestClientModelApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterTestClientModel(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestClientModel(ref bool suppressDefaultLog, ITestClientModelApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestClientModelDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestClientModel(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestClientModel(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test \"client\" model To test \"client\" model + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClientModelOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestClientModelAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestClientModel(modelClient); + + FormatTestClientModel(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestClientModelApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestClientModelDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnTestClientModel(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestClientModelDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorTestClientModel(e); + throw; + } + } + + /// + /// The + /// + public partial class TestClientModelApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestClientModelApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestClientModelApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestEndpointParameters(ref decimal number, ref string patternWithoutDelimiter, ref byte[] varByte, ref double varDouble, ref Option binary, ref Option callback, ref Option date, ref Option dateTime, ref Option int32, ref Option int64, ref Option integer, ref Option password, ref Option varFloat, ref Option varString); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEndpointParameters(string patternWithoutDelimiter, byte[] varByte, Option binary, Option callback, Option password, Option varString) + { + if (patternWithoutDelimiter == null) + throw new ArgumentNullException(nameof(patternWithoutDelimiter)); + + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); + + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary)); + + if (callback.IsSet && callback.Value == null) + throw new ArgumentNullException(nameof(callback)); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString) + { + bool suppressDefaultLog = false; + AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestEndpointParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestEndpointParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEndpointParametersOrDefaultAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestEndpointParametersAsync(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEndpointParametersAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestEndpointParameters(patternWithoutDelimiter, varByte, binary, callback, password, varString); + + FormatTestEndpointParameters(ref number, ref patternWithoutDelimiter, ref varByte, ref varDouble, ref binary, ref callback, ref date, ref dateTime, ref int32, ref int64, ref integer, ref password, ref varFloat, ref varString); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("number", ClientUtils.ParameterToString(number))); + + formParameterLocalVars.Add(new KeyValuePair("pattern_without_delimiter", ClientUtils.ParameterToString(patternWithoutDelimiter))); + + formParameterLocalVars.Add(new KeyValuePair("byte", ClientUtils.ParameterToString(varByte))); + + formParameterLocalVars.Add(new KeyValuePair("double", ClientUtils.ParameterToString(varDouble))); + + if (binary.IsSet) + multipartContentLocalVar.Add(new StreamContent(binary.Value)); + + if (callback.IsSet) + formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback.Value))); + + if (date.IsSet) + formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date.Value))); + + if (dateTime.IsSet) + formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime.Value))); + + if (int32.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32.Value))); + + if (int64.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64.Value))); + + if (integer.IsSet) + formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer.Value))); + + if (password.IsSet) + formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password.Value))); + + if (varFloat.IsSet) + formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat.Value))); + + if (varString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BasicToken basicTokenLocalVar1 = (BasicToken) await BasicTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(basicTokenLocalVar1); + + basicTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestEndpointParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestEndpointParametersDefaultImplementation(apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + + Events.ExecuteOnTestEndpointParameters(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestEndpointParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + Events.ExecuteOnErrorTestEndpointParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestEndpointParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestEndpointParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestEndpointParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestEnumParameters(ref Option enumFormString, Option> enumFormStringArray, ref Option enumHeaderString, Option> enumHeaderStringArray, ref Option enumQueryDouble, ref Option enumQueryInteger, ref Option enumQueryString, Option> enumQueryStringArray); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEnumParameters(Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryString, Option> enumQueryStringArray) + { + if (enumFormString.IsSet && enumFormString.Value == null) + throw new ArgumentNullException(nameof(enumFormString)); + + if (enumFormStringArray.IsSet && enumFormStringArray.Value == null) + throw new ArgumentNullException(nameof(enumFormStringArray)); + + if (enumHeaderString.IsSet && enumHeaderString.Value == null) + throw new ArgumentNullException(nameof(enumHeaderString)); + + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); + + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); + + if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) + throw new ArgumentNullException(nameof(enumQueryStringArray)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestEnumParametersDefaultImplementation(ITestEnumParametersApiResponse apiResponseLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray) + { + bool suppressDefaultLog = false; + AfterTestEnumParameters(ref suppressDefaultLog, apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ITestEnumParametersApiResponse apiResponseLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestEnumParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestEnumParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestEnumParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray); + + /// + /// To test enum parameters To test enum parameters + /// + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEnumParametersOrDefaultAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestEnumParametersAsync(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEnumParametersAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestEnumParameters(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryString, enumQueryStringArray); + + FormatTestEnumParameters(ref enumFormString, enumFormStringArray, ref enumHeaderString, enumHeaderStringArray, ref enumQueryDouble, ref enumQueryInteger, ref enumQueryString, enumQueryStringArray); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + if (enumQueryDouble.IsSet) + parseQueryStringLocalVar["enum_query_double"] = ClientUtils.ParameterToString(enumQueryDouble.Value); + + if (enumQueryInteger.IsSet) + parseQueryStringLocalVar["enum_query_integer"] = ClientUtils.ParameterToString(enumQueryInteger.Value); + + if (enumQueryString.IsSet) + parseQueryStringLocalVar["enum_query_string"] = ClientUtils.ParameterToString(enumQueryString.Value); + + if (enumQueryStringArray.IsSet) + parseQueryStringLocalVar["enum_query_string_array"] = ClientUtils.ParameterToString(enumQueryStringArray.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + if (enumHeaderString.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString.Value)); + + if (enumHeaderStringArray.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray.Value)); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString.Value))); + + if (enumFormStringArray.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray.Value))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestEnumParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestEnumParametersDefaultImplementation(apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + + Events.ExecuteOnTestEnumParameters(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestEnumParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + Events.ExecuteOnErrorTestEnumParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestEnumParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestEnumParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestEnumParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref long requiredInt64Group, ref int requiredStringGroup, ref Option booleanGroup, ref Option int64Group, ref Option stringGroup); + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestGroupParametersDefaultImplementation(ITestGroupParametersApiResponse apiResponseLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup) + { + bool suppressDefaultLog = false; + AfterTestGroupParameters(ref suppressDefaultLog, apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ITestGroupParametersApiResponse apiResponseLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestGroupParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestGroupParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestGroupParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup); + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestGroupParametersAsync(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestGroupParametersAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredInt64Group, ref requiredStringGroup, ref booleanGroup, ref int64Group, ref stringGroup); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["required_int64_group"] = ClientUtils.ParameterToString(requiredInt64Group); + parseQueryStringLocalVar["required_string_group"] = ClientUtils.ParameterToString(requiredStringGroup); + + if (int64Group.IsSet) + parseQueryStringLocalVar["int64_group"] = ClientUtils.ParameterToString(int64Group.Value); + + if (stringGroup.IsSet) + parseQueryStringLocalVar["string_group"] = ClientUtils.ParameterToString(stringGroup.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.Headers.Add("required_boolean_group", ClientUtils.ParameterToString(requiredBooleanGroup)); + + if (booleanGroup.IsSet) + httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BearerToken bearerTokenLocalVar1 = (BearerToken) await BearerTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(bearerTokenLocalVar1); + + bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestGroupParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestGroupParametersDefaultImplementation(apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + + Events.ExecuteOnTestGroupParameters(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestGroupParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + Events.ExecuteOnErrorTestGroupParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestGroupParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestGroupParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestGroupParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestInlineAdditionalProperties(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestInlineAdditionalProperties(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestInlineAdditionalPropertiesDefaultImplementation(ITestInlineAdditionalPropertiesApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestInlineAdditionalProperties(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestInlineAdditionalProperties(ref bool suppressDefaultLog, ITestInlineAdditionalPropertiesApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestInlineAdditionalPropertiesDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestInlineAdditionalProperties(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestInlineAdditionalProperties(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test inline additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineAdditionalPropertiesOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestInlineAdditionalPropertiesAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestInlineAdditionalProperties(requestBody); + + FormatTestInlineAdditionalProperties(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/inline-additionalProperties"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestInlineAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestInlineAdditionalProperties(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestInlineAdditionalPropertiesDefaultImplementation(e, "/fake/inline-additionalProperties", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestInlineAdditionalProperties(e); + throw; + } + } + + /// + /// The + /// + public partial class TestInlineAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestInlineAdditionalPropertiesApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestInlineAdditionalPropertiesApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + if (testInlineFreeformAdditionalPropertiesRequest == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(ITestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + bool suppressDefaultLog = false; + AfterTestInlineFreeformAdditionalProperties(ref suppressDefaultLog, apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestInlineFreeformAdditionalProperties(ref bool suppressDefaultLog, ITestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestInlineFreeformAdditionalPropertiesDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestInlineFreeformAdditionalProperties(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, testInlineFreeformAdditionalPropertiesRequest); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestInlineFreeformAdditionalProperties(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// test inline free-form additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineFreeformAdditionalPropertiesOrDefaultAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + + FormatTestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/inline-freeform-additionalProperties"; + + httpRequestMessageLocalVar.Content = (testInlineFreeformAdditionalPropertiesRequest as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(testInlineFreeformAdditionalPropertiesRequest, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); + + Events.ExecuteOnTestInlineFreeformAdditionalProperties(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestInlineFreeformAdditionalPropertiesDefaultImplementation(e, "/fake/inline-freeform-additionalProperties", uriBuilderLocalVar.Path, testInlineFreeformAdditionalPropertiesRequest); + Events.ExecuteOnErrorTestInlineFreeformAdditionalProperties(e); + throw; + } + } + + /// + /// The + /// + public partial class TestInlineFreeformAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestInlineFreeformAdditionalPropertiesApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestInlineFreeformAdditionalPropertiesApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestJsonFormData(ref string param, ref string param2); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateTestJsonFormData(string param, string param2) + { + if (param == null) + throw new ArgumentNullException(nameof(param)); + + if (param2 == null) + throw new ArgumentNullException(nameof(param2)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterTestJsonFormDataDefaultImplementation(ITestJsonFormDataApiResponse apiResponseLocalVar, string param, string param2) + { + bool suppressDefaultLog = false; + AfterTestJsonFormData(ref suppressDefaultLog, apiResponseLocalVar, param, param2); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterTestJsonFormData(ref bool suppressDefaultLog, ITestJsonFormDataApiResponse apiResponseLocalVar, string param, string param2); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorTestJsonFormDataDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string param, string param2) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestJsonFormData(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, param, param2); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestJsonFormData(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string param, string param2); + + /// + /// test json serialization of form data + /// + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + public async Task TestJsonFormDataOrDefaultAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestJsonFormDataAsync(param, param2, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + public async Task TestJsonFormDataAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestJsonFormData(param, param2); + + FormatTestJsonFormData(ref param, ref param2); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/jsonFormData"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("param", ClientUtils.ParameterToString(param))); + + formParameterLocalVars.Add(new KeyValuePair("param2", ClientUtils.ParameterToString(param2))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestJsonFormDataApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestJsonFormDataDefaultImplementation(apiResponseLocalVar, param, param2); + + Events.ExecuteOnTestJsonFormData(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestJsonFormDataDefaultImplementation(e, "/fake/jsonFormData", uriBuilderLocalVar.Path, param, param2); + Events.ExecuteOnErrorTestJsonFormData(e); + throw; + } + } + + /// + /// The + /// + public partial class TestJsonFormDataApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestJsonFormDataApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestJsonFormDataApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestQueryParameterCollectionFormat(List context, List http, List ioutil, List pipe, ref string requiredNotNullable, List url, ref Option notRequiredNotNullable, ref Option notRequiredNullable, ref string? requiredNullable); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestQueryParameterCollectionFormat(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable) + { + if (context == null) + throw new ArgumentNullException(nameof(context)); + + if (http == null) + throw new ArgumentNullException(nameof(http)); + + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + + if (pipe == null) + throw new ArgumentNullException(nameof(pipe)); + + if (requiredNotNullable == null) + throw new ArgumentNullException(nameof(requiredNotNullable)); + + if (url == null) + throw new ArgumentNullException(nameof(url)); + + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ITestQueryParameterCollectionFormatApiResponse apiResponseLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string? requiredNullable) + { + bool suppressDefaultLog = false; + AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ITestQueryParameterCollectionFormatApiResponse apiResponseLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string? requiredNullable); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string? requiredNullable) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestQueryParameterCollectionFormat(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestQueryParameterCollectionFormat(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string? requiredNullable); + + /// + /// To test the collection format in query parameters + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestQueryParameterCollectionFormatOrDefaultAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string? requiredNullable = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestQueryParameterCollectionFormatAsync(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestQueryParameterCollectionFormatAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string? requiredNullable = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestQueryParameterCollectionFormat(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable); + + FormatTestQueryParameterCollectionFormat(context, http, ioutil, pipe, ref requiredNotNullable, url, ref notRequiredNotNullable, ref notRequiredNullable, ref requiredNullable); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/test-query-parameters"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["context"] = ClientUtils.ParameterToString(context); + parseQueryStringLocalVar["http"] = ClientUtils.ParameterToString(http); + parseQueryStringLocalVar["ioutil"] = ClientUtils.ParameterToString(ioutil); + parseQueryStringLocalVar["pipe"] = ClientUtils.ParameterToString(pipe); + parseQueryStringLocalVar["requiredNotNullable"] = ClientUtils.ParameterToString(requiredNotNullable); + parseQueryStringLocalVar["url"] = ClientUtils.ParameterToString(url); + parseQueryStringLocalVar["requiredNullable"] = ClientUtils.ParameterToString(requiredNullable); + + if (notRequiredNotNullable.IsSet) + parseQueryStringLocalVar["notRequiredNotNullable"] = ClientUtils.ParameterToString(notRequiredNotNullable.Value); + + if (notRequiredNullable.IsSet) + parseQueryStringLocalVar["notRequiredNullable"] = ClientUtils.ParameterToString(notRequiredNullable.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + + Events.ExecuteOnTestQueryParameterCollectionFormat(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + Events.ExecuteOnErrorTestQueryParameterCollectionFormat(e); + throw; + } + } + + /// + /// The + /// + public partial class TestQueryParameterCollectionFormatApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestQueryParameterCollectionFormatApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestQueryParameterCollectionFormatApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestStringMapReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestStringMapReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestStringMapReferenceDefaultImplementation(ITestStringMapReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestStringMapReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestStringMapReference(ref bool suppressDefaultLog, ITestStringMapReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestStringMapReferenceDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestStringMapReference(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestStringMapReference(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test referenced string map + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestStringMapReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestStringMapReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestStringMapReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestStringMapReference(requestBody); + + FormatTestStringMapReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/stringMap-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestStringMapReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestStringMapReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestStringMapReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestStringMapReferenceDefaultImplementation(e, "/fake/stringMap-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestStringMapReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestStringMapReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestStringMapReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestStringMapReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs new file mode 100644 index 000000000000..d70af83c9115 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -0,0 +1,418 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IFakeClassnameTags123Api : IApi + { + /// + /// The class containing the events + /// + FakeClassnameTags123ApiEvents Events { get; } + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// client model + /// Cancellation Token to cancel the request. + /// <?> + Task TestClassnameOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ITestClassnameApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeClassnameTags123ApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestClassname; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestClassname; + + internal void ExecuteOnTestClassname(FakeClassnameTags123Api.TestClassnameApiResponse apiResponse) + { + OnTestClassname?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestClassname(Exception exception) + { + OnErrorTestClassname?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class FakeClassnameTags123Api : IFakeClassnameTags123Api + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public FakeClassnameTags123ApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, FakeClassnameTags123ApiEvents fakeClassnameTags123ApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = fakeClassnameTags123ApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatTestClassname(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestClassname(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestClassnameDefaultImplementation(ITestClassnameApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterTestClassname(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestClassname(ref bool suppressDefaultLog, ITestClassnameApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestClassnameDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestClassname(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestClassname(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test class name in snake case To test class name in snake case + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClassnameOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestClassnameAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestClassname(modelClient); + + FormatTestClassname(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake_classname_test"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key_query", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + + apiKeyTokenLocalVar1.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestClassnameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestClassnameDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnTestClassname(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestClassnameDefaultImplementation(e, "/fake_classname_test", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorTestClassname(e); + throw; + } + } + + /// + /// The + /// + public partial class TestClassnameApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestClassnameApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestClassnameApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs new file mode 100644 index 000000000000..1d959b49106f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs @@ -0,0 +1,2830 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IPetApi : IApi + { + /// + /// The class containing the events + /// + PetApiEvents Events { get; } + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <?> + Task AddPetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + Task DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Cancellation Token to cancel the request. + /// <> + Task FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter (deprecated) + /// Cancellation Token to cancel the request. + /// <?> + Task FindPetsByStatusOrDefaultAsync(List status, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + [Obsolete] + Task FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <?> + [Obsolete] + Task FindPetsByTagsOrDefaultAsync(List tags, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <?> + Task GetPetByIdOrDefaultAsync(long petId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <?> + Task UpdatePetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image + /// + /// + /// + /// + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task UploadFileOrDefaultAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task UploadFileWithRequiredFileOrDefaultAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IAddPetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IDeletePetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface IFindPetsByStatusApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } + } + + /// + /// The + /// + public interface IFindPetsByTagsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface IGetPetByIdApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IUpdatePetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IUpdatePetWithFormApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IUploadFileApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IUploadFileWithRequiredFileApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class PetApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnAddPet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorAddPet; + + internal void ExecuteOnAddPet(PetApi.AddPetApiResponse apiResponse) + { + OnAddPet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorAddPet(Exception exception) + { + OnErrorAddPet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnDeletePet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorDeletePet; + + internal void ExecuteOnDeletePet(PetApi.DeletePetApiResponse apiResponse) + { + OnDeletePet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeletePet(Exception exception) + { + OnErrorDeletePet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFindPetsByStatus; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFindPetsByStatus; + + internal void ExecuteOnFindPetsByStatus(PetApi.FindPetsByStatusApiResponse apiResponse) + { + OnFindPetsByStatus?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFindPetsByStatus(Exception exception) + { + OnErrorFindPetsByStatus?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFindPetsByTags; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFindPetsByTags; + + internal void ExecuteOnFindPetsByTags(PetApi.FindPetsByTagsApiResponse apiResponse) + { + OnFindPetsByTags?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFindPetsByTags(Exception exception) + { + OnErrorFindPetsByTags?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetPetById; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetPetById; + + internal void ExecuteOnGetPetById(PetApi.GetPetByIdApiResponse apiResponse) + { + OnGetPetById?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetPetById(Exception exception) + { + OnErrorGetPetById?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUpdatePet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUpdatePet; + + internal void ExecuteOnUpdatePet(PetApi.UpdatePetApiResponse apiResponse) + { + OnUpdatePet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdatePet(Exception exception) + { + OnErrorUpdatePet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUpdatePetWithForm; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUpdatePetWithForm; + + internal void ExecuteOnUpdatePetWithForm(PetApi.UpdatePetWithFormApiResponse apiResponse) + { + OnUpdatePetWithForm?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdatePetWithForm(Exception exception) + { + OnErrorUpdatePetWithForm?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUploadFile; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUploadFile; + + internal void ExecuteOnUploadFile(PetApi.UploadFileApiResponse apiResponse) + { + OnUploadFile?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUploadFile(Exception exception) + { + OnErrorUploadFile?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUploadFileWithRequiredFile; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUploadFileWithRequiredFile; + + internal void ExecuteOnUploadFileWithRequiredFile(PetApi.UploadFileWithRequiredFileApiResponse apiResponse) + { + OnUploadFileWithRequiredFile?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUploadFileWithRequiredFile(Exception exception) + { + OnErrorUploadFileWithRequiredFile?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class PetApi : IPetApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public PetApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, PetApiEvents petApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = petApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatAddPet(Pet pet); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateAddPet(Pet pet) + { + if (pet == null) + throw new ArgumentNullException(nameof(pet)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterAddPetDefaultImplementation(IAddPetApiResponse apiResponseLocalVar, Pet pet) + { + bool suppressDefaultLog = false; + AfterAddPet(ref suppressDefaultLog, apiResponseLocalVar, pet); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterAddPet(ref bool suppressDefaultLog, IAddPetApiResponse apiResponseLocalVar, Pet pet); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorAddPetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet) + { + bool suppressDefaultLogLocalVar = false; + OnErrorAddPet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, pet); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorAddPet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet); + + /// + /// Add a new pet to the store + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task AddPetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await AddPetAsync(pet, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateAddPet(pet); + + FormatAddPet(pet); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("http://petstore.swagger.io/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + + httpRequestMessageLocalVar.Content = (pet as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] contentTypes = new string[] { + "application/json", + "application/xml" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + AddPetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + + AfterAddPetDefaultImplementation(apiResponseLocalVar, pet); + + Events.ExecuteOnAddPet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorAddPetDefaultImplementation(e, "/pet", uriBuilderLocalVar.Path, pet); + Events.ExecuteOnErrorAddPet(e); + throw; + } + } + + /// + /// The + /// + public partial class AddPetApiResponse : Org.OpenAPITools.Client.ApiResponse, IAddPetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public AddPetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatDeletePet(ref long petId, ref Option apiKey); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeletePet(Option apiKey) + { + if (apiKey.IsSet && apiKey.Value == null) + throw new ArgumentNullException(nameof(apiKey)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterDeletePetDefaultImplementation(IDeletePetApiResponse apiResponseLocalVar, long petId, Option apiKey) + { + bool suppressDefaultLog = false; + AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterDeletePet(ref bool suppressDefaultLog, IDeletePetApiResponse apiResponseLocalVar, long petId, Option apiKey); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorDeletePetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option apiKey) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeletePet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, apiKey); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorDeletePet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option apiKey); + + /// + /// Deletes a pet + /// + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeletePetAsync(petId, apiKey, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeletePet(apiKey); + + FormatDeletePet(ref petId, ref apiKey); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + if (apiKey.IsSet) + httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeletePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeletePetDefaultImplementation(apiResponseLocalVar, petId, apiKey); + + Events.ExecuteOnDeletePet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeletePetDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId, apiKey); + Events.ExecuteOnErrorDeletePet(e); + throw; + } + } + + /// + /// The + /// + public partial class DeletePetApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeletePetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeletePetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFindPetsByStatus(List status); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFindPetsByStatus(List status) + { + if (status == null) + throw new ArgumentNullException(nameof(status)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFindPetsByStatusDefaultImplementation(IFindPetsByStatusApiResponse apiResponseLocalVar, List status) + { + bool suppressDefaultLog = false; + AfterFindPetsByStatus(ref suppressDefaultLog, apiResponseLocalVar, status); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFindPetsByStatus(ref bool suppressDefaultLog, IFindPetsByStatusApiResponse apiResponseLocalVar, List status); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFindPetsByStatusDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List status) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFindPetsByStatus(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, status); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFindPetsByStatus(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List status); + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByStatusOrDefaultAsync(List status, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FindPetsByStatusAsync(status, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFindPetsByStatus(status); + + FormatFindPetsByStatus(status); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/findByStatus"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["status"] = ClientUtils.ParameterToString(status); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FindPetsByStatusApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFindPetsByStatusDefaultImplementation(apiResponseLocalVar, status); + + Events.ExecuteOnFindPetsByStatus(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFindPetsByStatusDefaultImplementation(e, "/pet/findByStatus", uriBuilderLocalVar.Path, status); + Events.ExecuteOnErrorFindPetsByStatus(e); + throw; + } + } + + /// + /// The + /// + public partial class FindPetsByStatusApiResponse : Org.OpenAPITools.Client.ApiResponse, IFindPetsByStatusApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FindPetsByStatusApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFindPetsByTags(List tags); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFindPetsByTags(List tags) + { + if (tags == null) + throw new ArgumentNullException(nameof(tags)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFindPetsByTagsDefaultImplementation(IFindPetsByTagsApiResponse apiResponseLocalVar, List tags) + { + bool suppressDefaultLog = false; + AfterFindPetsByTags(ref suppressDefaultLog, apiResponseLocalVar, tags); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFindPetsByTags(ref bool suppressDefaultLog, IFindPetsByTagsApiResponse apiResponseLocalVar, List tags); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFindPetsByTagsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List tags) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFindPetsByTags(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, tags); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFindPetsByTags(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List tags); + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByTagsOrDefaultAsync(List tags, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FindPetsByTagsAsync(tags, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFindPetsByTags(tags); + + FormatFindPetsByTags(tags); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/findByTags"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["tags"] = ClientUtils.ParameterToString(tags); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FindPetsByTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFindPetsByTagsDefaultImplementation(apiResponseLocalVar, tags); + + Events.ExecuteOnFindPetsByTags(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFindPetsByTagsDefaultImplementation(e, "/pet/findByTags", uriBuilderLocalVar.Path, tags); + Events.ExecuteOnErrorFindPetsByTags(e); + throw; + } + } + + /// + /// The + /// + public partial class FindPetsByTagsApiResponse : Org.OpenAPITools.Client.ApiResponse, IFindPetsByTagsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FindPetsByTagsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetPetById(ref long petId); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetPetByIdDefaultImplementation(IGetPetByIdApiResponse apiResponseLocalVar, long petId) + { + bool suppressDefaultLog = false; + AfterGetPetById(ref suppressDefaultLog, apiResponseLocalVar, petId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetPetById(ref bool suppressDefaultLog, IGetPetByIdApiResponse apiResponseLocalVar, long petId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetPetByIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetPetById(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetPetById(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId); + + /// + /// Find pet by ID Returns a single pet + /// + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + public async Task GetPetByIdOrDefaultAsync(long petId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetPetByIdAsync(petId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + public async Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetPetById(ref petId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar); + + ApiKeyToken apiKeyTokenLocalVar2 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key_query", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar2); + + apiKeyTokenLocalVar2.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetPetByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetPetByIdDefaultImplementation(apiResponseLocalVar, petId); + + Events.ExecuteOnGetPetById(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetPetByIdDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId); + Events.ExecuteOnErrorGetPetById(e); + throw; + } + } + + /// + /// The + /// + public partial class GetPetByIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetPetByIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetPetByIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Pet? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Pet? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdatePet(Pet pet); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateUpdatePet(Pet pet) + { + if (pet == null) + throw new ArgumentNullException(nameof(pet)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterUpdatePetDefaultImplementation(IUpdatePetApiResponse apiResponseLocalVar, Pet pet) + { + bool suppressDefaultLog = false; + AfterUpdatePet(ref suppressDefaultLog, apiResponseLocalVar, pet); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterUpdatePet(ref bool suppressDefaultLog, IUpdatePetApiResponse apiResponseLocalVar, Pet pet); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorUpdatePetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdatePet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, pet); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdatePet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet); + + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdatePetAsync(pet, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdatePet(pet); + + FormatUpdatePet(pet); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("http://petstore.swagger.io/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + + httpRequestMessageLocalVar.Content = (pet as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] contentTypes = new string[] { + "application/json", + "application/xml" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdatePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdatePetDefaultImplementation(apiResponseLocalVar, pet); + + Events.ExecuteOnUpdatePet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdatePetDefaultImplementation(e, "/pet", uriBuilderLocalVar.Path, pet); + Events.ExecuteOnErrorUpdatePet(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdatePetApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdatePetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdatePetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdatePetWithForm(ref long petId, ref Option name, ref Option status); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUpdatePetWithForm(Option name, Option status) + { + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name)); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUpdatePetWithFormDefaultImplementation(IUpdatePetWithFormApiResponse apiResponseLocalVar, long petId, Option name, Option status) + { + bool suppressDefaultLog = false; + AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, IUpdatePetWithFormApiResponse apiResponseLocalVar, long petId, Option name, Option status); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option name, Option status) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdatePetWithForm(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, name, status); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdatePetWithForm(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option name, Option status); + + /// + /// Updates a pet in the store with form data + /// + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdatePetWithFormAsync(petId, name, status, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdatePetWithForm(name, status); + + FormatUpdatePetWithForm(ref petId, ref name, ref status); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet) + formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name.Value))); + + if (status.IsSet) + formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdatePetWithFormApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdatePetWithFormDefaultImplementation(apiResponseLocalVar, petId, name, status); + + Events.ExecuteOnUpdatePetWithForm(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdatePetWithFormDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId, name, status); + Events.ExecuteOnErrorUpdatePetWithForm(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdatePetWithFormApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdatePetWithFormApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdatePetWithFormApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUploadFile(ref long petId, ref Option additionalMetadata, ref Option file); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUploadFile(Option additionalMetadata, Option file) + { + if (additionalMetadata.IsSet && additionalMetadata.Value == null) + throw new ArgumentNullException(nameof(additionalMetadata)); + + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUploadFileDefaultImplementation(IUploadFileApiResponse apiResponseLocalVar, long petId, Option additionalMetadata, Option file) + { + bool suppressDefaultLog = false; + AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, additionalMetadata, file); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUploadFile(ref bool suppressDefaultLog, IUploadFileApiResponse apiResponseLocalVar, long petId, Option additionalMetadata, Option file); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUploadFileDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option additionalMetadata, Option file) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUploadFile(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, additionalMetadata, file); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUploadFile(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option additionalMetadata, Option file); + + /// + /// uploads an image + /// + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileOrDefaultAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UploadFileAsync(petId, additionalMetadata, file, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUploadFile(additionalMetadata, file); + + FormatUploadFile(ref petId, ref additionalMetadata, ref file); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}/uploadImage"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); + + if (file.IsSet) + multipartContentLocalVar.Add(new StreamContent(file.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "multipart/form-data" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UploadFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUploadFileDefaultImplementation(apiResponseLocalVar, petId, additionalMetadata, file); + + Events.ExecuteOnUploadFile(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUploadFileDefaultImplementation(e, "/pet/{petId}/uploadImage", uriBuilderLocalVar.Path, petId, additionalMetadata, file); + Events.ExecuteOnErrorUploadFile(e); + throw; + } + } + + /// + /// The + /// + public partial class UploadFileApiResponse : Org.OpenAPITools.Client.ApiResponse, IUploadFileApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UploadFileApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ApiResponse? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUploadFileWithRequiredFile(ref long petId, ref System.IO.Stream requiredFile, ref Option additionalMetadata); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option additionalMetadata) + { + if (requiredFile == null) + throw new ArgumentNullException(nameof(requiredFile)); + + if (additionalMetadata.IsSet && additionalMetadata.Value == null) + throw new ArgumentNullException(nameof(additionalMetadata)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUploadFileWithRequiredFileDefaultImplementation(IUploadFileWithRequiredFileApiResponse apiResponseLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata) + { + bool suppressDefaultLog = false; + AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, petId, requiredFile, additionalMetadata); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, IUploadFileWithRequiredFileApiResponse apiResponseLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUploadFileWithRequiredFile(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, requiredFile, additionalMetadata); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUploadFileWithRequiredFile(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata); + + /// + /// uploads an image (required) + /// + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileWithRequiredFileOrDefaultAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UploadFileWithRequiredFileAsync(petId, requiredFile, additionalMetadata, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUploadFileWithRequiredFile(requiredFile, additionalMetadata); + + FormatUploadFileWithRequiredFile(ref petId, ref requiredFile, ref additionalMetadata); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/{petId}/uploadImageWithRequiredFile"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); multipartContentLocalVar.Add(new StreamContent(requiredFile)); + + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "multipart/form-data" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUploadFileWithRequiredFileDefaultImplementation(apiResponseLocalVar, petId, requiredFile, additionalMetadata); + + Events.ExecuteOnUploadFileWithRequiredFile(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUploadFileWithRequiredFileDefaultImplementation(e, "/fake/{petId}/uploadImageWithRequiredFile", uriBuilderLocalVar.Path, petId, requiredFile, additionalMetadata); + Events.ExecuteOnErrorUploadFileWithRequiredFile(e); + throw; + } + } + + /// + /// The + /// + public partial class UploadFileWithRequiredFileApiResponse : Org.OpenAPITools.Client.ApiResponse, IUploadFileWithRequiredFileApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UploadFileWithRequiredFileApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ApiResponse? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs new file mode 100644 index 000000000000..1677ff9901e2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,1203 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IStoreApi : IApi + { + /// + /// The class containing the events + /// + StoreApiEvents Events { get; } + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <?> + Task DeleteOrderOrDefaultAsync(string orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetInventoryOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <?> + Task GetOrderByIdOrDefaultAsync(long orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <?> + Task PlaceOrderOrDefaultAsync(Order order, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IDeleteOrderApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IGetInventoryApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetOrderByIdApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IPlaceOrderApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class StoreApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnDeleteOrder; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorDeleteOrder; + + internal void ExecuteOnDeleteOrder(StoreApi.DeleteOrderApiResponse apiResponse) + { + OnDeleteOrder?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeleteOrder(Exception exception) + { + OnErrorDeleteOrder?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetInventory; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetInventory; + + internal void ExecuteOnGetInventory(StoreApi.GetInventoryApiResponse apiResponse) + { + OnGetInventory?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetInventory(Exception exception) + { + OnErrorGetInventory?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetOrderById; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetOrderById; + + internal void ExecuteOnGetOrderById(StoreApi.GetOrderByIdApiResponse apiResponse) + { + OnGetOrderById?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetOrderById(Exception exception) + { + OnErrorGetOrderById?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnPlaceOrder; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorPlaceOrder; + + internal void ExecuteOnPlaceOrder(StoreApi.PlaceOrderApiResponse apiResponse) + { + OnPlaceOrder?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorPlaceOrder(Exception exception) + { + OnErrorPlaceOrder?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class StoreApi : IStoreApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public StoreApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, StoreApiEvents storeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = storeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatDeleteOrder(ref string orderId); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeleteOrder(string orderId) + { + if (orderId == null) + throw new ArgumentNullException(nameof(orderId)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterDeleteOrderDefaultImplementation(IDeleteOrderApiResponse apiResponseLocalVar, string orderId) + { + bool suppressDefaultLog = false; + AfterDeleteOrder(ref suppressDefaultLog, apiResponseLocalVar, orderId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterDeleteOrder(ref bool suppressDefaultLog, IDeleteOrderApiResponse apiResponseLocalVar, string orderId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorDeleteOrderDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string orderId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeleteOrder(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, orderId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorDeleteOrder(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string orderId); + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteOrderOrDefaultAsync(string orderId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeleteOrderAsync(orderId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeleteOrder(orderId); + + FormatDeleteOrder(ref orderId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order/{order_id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeleteOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeleteOrderDefaultImplementation(apiResponseLocalVar, orderId); + + Events.ExecuteOnDeleteOrder(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeleteOrderDefaultImplementation(e, "/store/order/{order_id}", uriBuilderLocalVar.Path, orderId); + Events.ExecuteOnErrorDeleteOrder(e); + throw; + } + } + + /// + /// The + /// + public partial class DeleteOrderApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeleteOrderApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteOrderApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetInventoryDefaultImplementation(IGetInventoryApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetInventory(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetInventory(ref bool suppressDefaultLog, IGetInventoryApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetInventoryDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetInventory(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetInventory(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetInventoryOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetInventoryAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/inventory"; + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetInventoryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetInventoryDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetInventory(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetInventoryDefaultImplementation(e, "/store/inventory", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetInventory(e); + throw; + } + } + + /// + /// The + /// + public partial class GetInventoryApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetInventoryApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetInventoryApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Dictionary? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Dictionary? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetOrderById(ref long orderId); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetOrderByIdDefaultImplementation(IGetOrderByIdApiResponse apiResponseLocalVar, long orderId) + { + bool suppressDefaultLog = false; + AfterGetOrderById(ref suppressDefaultLog, apiResponseLocalVar, orderId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetOrderById(ref bool suppressDefaultLog, IGetOrderByIdApiResponse apiResponseLocalVar, long orderId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetOrderByIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long orderId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetOrderById(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, orderId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetOrderById(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long orderId); + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + public async Task GetOrderByIdOrDefaultAsync(long orderId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetOrderByIdAsync(orderId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + public async Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetOrderById(ref orderId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order/{order_id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetOrderByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetOrderByIdDefaultImplementation(apiResponseLocalVar, orderId); + + Events.ExecuteOnGetOrderById(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetOrderByIdDefaultImplementation(e, "/store/order/{order_id}", uriBuilderLocalVar.Path, orderId); + Events.ExecuteOnErrorGetOrderById(e); + throw; + } + } + + /// + /// The + /// + public partial class GetOrderByIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetOrderByIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetOrderByIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Order? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatPlaceOrder(Order order); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidatePlaceOrder(Order order) + { + if (order == null) + throw new ArgumentNullException(nameof(order)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterPlaceOrderDefaultImplementation(IPlaceOrderApiResponse apiResponseLocalVar, Order order) + { + bool suppressDefaultLog = false; + AfterPlaceOrder(ref suppressDefaultLog, apiResponseLocalVar, order); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterPlaceOrder(ref bool suppressDefaultLog, IPlaceOrderApiResponse apiResponseLocalVar, Order order); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorPlaceOrderDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Order order) + { + bool suppressDefaultLogLocalVar = false; + OnErrorPlaceOrder(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, order); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorPlaceOrder(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Order order); + + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + public async Task PlaceOrderOrDefaultAsync(Order order, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await PlaceOrderAsync(order, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + public async Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidatePlaceOrder(order); + + FormatPlaceOrder(order); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order"; + + httpRequestMessageLocalVar.Content = (order as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(order, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + PlaceOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); + + AfterPlaceOrderDefaultImplementation(apiResponseLocalVar, order); + + Events.ExecuteOnPlaceOrder(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorPlaceOrderDefaultImplementation(e, "/store/order", uriBuilderLocalVar.Path, order); + Events.ExecuteOnErrorPlaceOrder(e); + throw; + } + } + + /// + /// The + /// + public partial class PlaceOrderApiResponse : Org.OpenAPITools.Client.ApiResponse, IPlaceOrderApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public PlaceOrderApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Order? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs new file mode 100644 index 000000000000..0352814ae67d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/UserApi.cs @@ -0,0 +1,2264 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IUserApi : IApi + { + /// + /// The class containing the events + /// + UserApiEvents Events { get; } + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Created user object + /// Cancellation Token to cancel the request. + /// <?> + Task CreateUserOrDefaultAsync(User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <?> + Task CreateUsersWithArrayInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <?> + Task CreateUsersWithListInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <?> + Task DeleteUserOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get user by user name + /// + /// + /// + /// + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <?> + Task GetUserByNameOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + Task LoginUserAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <?> + Task LoginUserOrDefaultAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task LogoutUserOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task UpdateUserAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <?> + Task UpdateUserOrDefaultAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ICreateUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface ICreateUsersWithArrayInputApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface ICreateUsersWithListInputApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IDeleteUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IGetUserByNameApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk, ICustomHttpStatusCode599 + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 598 CustomHttpStatusCode598 + /// + /// + bool IsCustomHttpStatusCode598 { get; } + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 + /// + /// + bool IsCustomHttpStatusCode599 { get; } + } + + /// + /// The + /// + public interface ILoginUserApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface ILogoutUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IUpdateUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class UserApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnCreateUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorCreateUser; + + internal void ExecuteOnCreateUser(UserApi.CreateUserApiResponse apiResponse) + { + OnCreateUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUser(Exception exception) + { + OnErrorCreateUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnCreateUsersWithArrayInput; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorCreateUsersWithArrayInput; + + internal void ExecuteOnCreateUsersWithArrayInput(UserApi.CreateUsersWithArrayInputApiResponse apiResponse) + { + OnCreateUsersWithArrayInput?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUsersWithArrayInput(Exception exception) + { + OnErrorCreateUsersWithArrayInput?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnCreateUsersWithListInput; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorCreateUsersWithListInput; + + internal void ExecuteOnCreateUsersWithListInput(UserApi.CreateUsersWithListInputApiResponse apiResponse) + { + OnCreateUsersWithListInput?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUsersWithListInput(Exception exception) + { + OnErrorCreateUsersWithListInput?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnDeleteUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorDeleteUser; + + internal void ExecuteOnDeleteUser(UserApi.DeleteUserApiResponse apiResponse) + { + OnDeleteUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeleteUser(Exception exception) + { + OnErrorDeleteUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetUserByName; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetUserByName; + + internal void ExecuteOnGetUserByName(UserApi.GetUserByNameApiResponse apiResponse) + { + OnGetUserByName?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetUserByName(Exception exception) + { + OnErrorGetUserByName?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnLoginUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorLoginUser; + + internal void ExecuteOnLoginUser(UserApi.LoginUserApiResponse apiResponse) + { + OnLoginUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorLoginUser(Exception exception) + { + OnErrorLoginUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnLogoutUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorLogoutUser; + + internal void ExecuteOnLogoutUser(UserApi.LogoutUserApiResponse apiResponse) + { + OnLogoutUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorLogoutUser(Exception exception) + { + OnErrorLogoutUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUpdateUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUpdateUser; + + internal void ExecuteOnUpdateUser(UserApi.UpdateUserApiResponse apiResponse) + { + OnUpdateUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdateUser(Exception exception) + { + OnErrorUpdateUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class UserApi : IUserApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public UserApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// The token cookie container + /// + public Org.OpenAPITools.Client.CookieContainer CookieContainer { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, UserApiEvents userApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider, + Org.OpenAPITools.Client.CookieContainer cookieContainer) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = userApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + CookieContainer = cookieContainer; + } + + partial void FormatCreateUser(User user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUser(User user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUserDefaultImplementation(ICreateUserApiResponse apiResponseLocalVar, User user) + { + bool suppressDefaultLog = false; + AfterCreateUser(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUser(ref bool suppressDefaultLog, ICreateUserApiResponse apiResponseLocalVar, User user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user); + + /// + /// Create user This can only be done by the logged in user. + /// + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUserOrDefaultAsync(User user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUserAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUser(user); + + FormatCreateUser(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUserDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUserDefaultImplementation(e, "/user", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUser(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatCreateUsersWithArrayInput(List user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUsersWithArrayInput(List user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUsersWithArrayInputDefaultImplementation(ICreateUsersWithArrayInputApiResponse apiResponseLocalVar, List user) + { + bool suppressDefaultLog = false; + AfterCreateUsersWithArrayInput(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUsersWithArrayInput(ref bool suppressDefaultLog, ICreateUsersWithArrayInputApiResponse apiResponseLocalVar, List user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUsersWithArrayInputDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUsersWithArrayInput(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUsersWithArrayInput(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user); + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithArrayInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUsersWithArrayInputAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUsersWithArrayInput(user); + + FormatCreateUsersWithArrayInput(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/createWithArray"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUsersWithArrayInputDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUsersWithArrayInput(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUsersWithArrayInputDefaultImplementation(e, "/user/createWithArray", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUsersWithArrayInput(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUsersWithArrayInputApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUsersWithArrayInputApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUsersWithArrayInputApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatCreateUsersWithListInput(List user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUsersWithListInput(List user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUsersWithListInputDefaultImplementation(ICreateUsersWithListInputApiResponse apiResponseLocalVar, List user) + { + bool suppressDefaultLog = false; + AfterCreateUsersWithListInput(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUsersWithListInput(ref bool suppressDefaultLog, ICreateUsersWithListInputApiResponse apiResponseLocalVar, List user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUsersWithListInputDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUsersWithListInput(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUsersWithListInput(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user); + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithListInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUsersWithListInputAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUsersWithListInput(user); + + FormatCreateUsersWithListInput(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/createWithList"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUsersWithListInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUsersWithListInputDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUsersWithListInput(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUsersWithListInputDefaultImplementation(e, "/user/createWithList", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUsersWithListInput(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUsersWithListInputApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUsersWithListInputApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUsersWithListInputApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatDeleteUser(ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeleteUser(string username) + { + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterDeleteUserDefaultImplementation(IDeleteUserApiResponse apiResponseLocalVar, string username) + { + bool suppressDefaultLog = false; + AfterDeleteUser(ref suppressDefaultLog, apiResponseLocalVar, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterDeleteUser(ref bool suppressDefaultLog, IDeleteUserApiResponse apiResponseLocalVar, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorDeleteUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeleteUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorDeleteUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username); + + /// + /// Delete user This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteUserOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeleteUserAsync(username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeleteUser(username); + + FormatDeleteUser(ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeleteUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeleteUserDefaultImplementation(apiResponseLocalVar, username); + + Events.ExecuteOnDeleteUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeleteUserDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, username); + Events.ExecuteOnErrorDeleteUser(e); + throw; + } + } + + /// + /// The + /// + public partial class DeleteUserApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeleteUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetUserByName(ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateGetUserByName(string username) + { + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetUserByNameDefaultImplementation(IGetUserByNameApiResponse apiResponseLocalVar, string username) + { + bool suppressDefaultLog = false; + AfterGetUserByName(ref suppressDefaultLog, apiResponseLocalVar, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetUserByName(ref bool suppressDefaultLog, IGetUserByNameApiResponse apiResponseLocalVar, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetUserByNameDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetUserByName(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetUserByName(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username); + + /// + /// Get user by user name + /// + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetUserByNameOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetUserByNameAsync(username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateGetUserByName(username); + + FormatGetUserByName(ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetUserByNameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetUserByNameDefaultImplementation(apiResponseLocalVar, username); + + Events.ExecuteOnGetUserByName(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetUserByNameDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, username); + Events.ExecuteOnErrorGetUserByName(e); + throw; + } + } + + /// + /// The + /// + public partial class GetUserByNameApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetUserByNameApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetUserByNameApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.User? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Returns true if the response is 598 CustomHttpStatusCode598 + /// + /// + public bool IsCustomHttpStatusCode598 => 598 == (int)StatusCode; + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 + /// + /// + public bool IsCustomHttpStatusCode599 => 599 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 599 CustomHttpStatusCode599 + /// + /// + public Org.OpenAPITools.Model.User? CustomHttpStatusCode599() + { + // This logic may be modified with the AsModel.mustache template + return IsCustomHttpStatusCode599 + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 and the deserialized response is not null + /// + /// + /// + public bool TryCustomHttpStatusCode599([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) + { + result = null; + + try + { + result = CustomHttpStatusCode599(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)599); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatLoginUser(ref string password, ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateLoginUser(string password, string username) + { + if (password == null) + throw new ArgumentNullException(nameof(password)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterLoginUserDefaultImplementation(ILoginUserApiResponse apiResponseLocalVar, string password, string username) + { + bool suppressDefaultLog = false; + AfterLoginUser(ref suppressDefaultLog, apiResponseLocalVar, password, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterLoginUser(ref bool suppressDefaultLog, ILoginUserApiResponse apiResponseLocalVar, string password, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorLoginUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string password, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorLoginUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, password, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorLoginUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string password, string username); + + /// + /// Logs user into the system + /// + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + public async Task LoginUserOrDefaultAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await LoginUserAsync(password, username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + public async Task LoginUserAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateLoginUser(password, username); + + FormatLoginUser(ref password, ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/login"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["password"] = ClientUtils.ParameterToString(password); + parseQueryStringLocalVar["username"] = ClientUtils.ParameterToString(username); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + LoginUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); + + AfterLoginUserDefaultImplementation(apiResponseLocalVar, password, username); + + Events.ExecuteOnLoginUser(apiResponseLocalVar); + + if (httpResponseMessageLocalVar.StatusCode == (HttpStatusCode) 200 && httpResponseMessageLocalVar.Headers.TryGetValues("Set-Cookie", out var cookieHeadersLocalVar)) + { + foreach(string cookieHeader in cookieHeadersLocalVar) + { + IList setCookieHeaderValuesLocalVar = Microsoft.Net.Http.Headers.SetCookieHeaderValue.ParseList(cookieHeadersLocalVar.ToArray()); + + foreach(Microsoft.Net.Http.Headers.SetCookieHeaderValue setCookieHeaderValueLocalVar in setCookieHeaderValuesLocalVar) + { + Cookie cookieLocalVar = new Cookie(setCookieHeaderValueLocalVar.Name.ToString(), setCookieHeaderValueLocalVar.Value.ToString()) + { + HttpOnly = setCookieHeaderValueLocalVar.HttpOnly + }; + + if (setCookieHeaderValueLocalVar.Expires.HasValue) + cookieLocalVar.Expires = setCookieHeaderValueLocalVar.Expires.Value.UtcDateTime; + + if (setCookieHeaderValueLocalVar.Path.HasValue) + cookieLocalVar.Path = setCookieHeaderValueLocalVar.Path.Value; + + if (setCookieHeaderValueLocalVar.Domain.HasValue) + cookieLocalVar.Domain = setCookieHeaderValueLocalVar.Domain.Value; + + CookieContainer.Value.Add(new Uri($"{uriBuilderLocalVar.Scheme}://{uriBuilderLocalVar.Host}"), cookieLocalVar); + } + } + } + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorLoginUserDefaultImplementation(e, "/user/login", uriBuilderLocalVar.Path, password, username); + Events.ExecuteOnErrorLoginUser(e); + throw; + } + } + + /// + /// The + /// + public partial class LoginUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ILoginUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public LoginUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public string? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out string? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterLogoutUserDefaultImplementation(ILogoutUserApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterLogoutUser(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterLogoutUser(ref bool suppressDefaultLog, ILogoutUserApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorLogoutUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorLogoutUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorLogoutUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Logs out current logged in user session + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task LogoutUserOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await LogoutUserAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + LogoutUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); + + AfterLogoutUserDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnLogoutUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorLogoutUserDefaultImplementation(e, "/user/logout", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorLogoutUser(e); + throw; + } + } + + /// + /// The + /// + public partial class LogoutUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ILogoutUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public LogoutUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdateUser(User user, ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUpdateUser(User user, string username) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterUpdateUserDefaultImplementation(IUpdateUserApiResponse apiResponseLocalVar, User user, string username) + { + bool suppressDefaultLog = false; + AfterUpdateUser(ref suppressDefaultLog, apiResponseLocalVar, user, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterUpdateUser(ref bool suppressDefaultLog, IUpdateUserApiResponse apiResponseLocalVar, User user, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorUpdateUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdateUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdateUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user, string username); + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateUserOrDefaultAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdateUserAsync(user, username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateUserAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdateUser(user, username); + + FormatUpdateUser(user, ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdateUserDefaultImplementation(apiResponseLocalVar, user, username); + + Events.ExecuteOnUpdateUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdateUserDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, user, username); + Events.ExecuteOnErrorUpdateUser(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdateUserApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdateUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdateUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..76274524017f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,52 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string? ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs new file mode 100644 index 000000000000..d0b10f69b91e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -0,0 +1,54 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an apiKey. + /// + public class ApiKeyToken : TokenBase + { + private string _raw; + + /// + /// The header that this token will be used with. + /// + public ClientUtils.ApiKeyHeader Header { get; } + + /// + /// Constructs an ApiKeyToken object. + /// + /// + /// + /// + /// + public ApiKeyToken(string value, ClientUtils.ApiKeyHeader header, string prefix = "Bearer ", TimeSpan? timeout = null) : base(timeout) + { + Header = header; + _raw = $"{ prefix }{ value }"; + } + + /// + /// Places the token in the header. + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request) + { + request.Headers.Add(ClientUtils.ApiKeyHeaderToString(Header), _raw); + } + + /// + /// Places the token in the query. + /// + /// + /// + /// + public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage request, UriBuilder uriBuilder, System.Collections.Specialized.NameValueCollection parseQueryString) + { + parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..88b4a497394b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,212 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string? ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri? RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string? ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri? RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface ICustomHttpStatusCode599 : IApiResponse + { + /// + /// Deserializes the response if the response is CustomHttpStatusCode599 + /// + /// + TType CustomHttpStatusCode599(); + + /// + /// Returns true if the response is CustomHttpStatusCode599 and the deserialized response is not null + /// + /// + /// + bool TryCustomHttpStatusCode599([NotNullWhen(true)]out TType? result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk([NotNullWhen(true)]out TType? result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IDefault : IApiResponse + { + /// + /// Deserializes the response if the response is Default + /// + /// + TType Default(); + + /// + /// Returns true if the response is Default and the deserialized response is not null + /// + /// + /// + bool TryDefault([NotNullWhen(true)]out TType? result); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs new file mode 100644 index 000000000000..01e79ed16ed2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BasicToken.cs @@ -0,0 +1,44 @@ +// + +#nullable enable + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from a username and password. + /// + public class BasicToken : TokenBase + { + private string _username; + + private string _password; + + /// + /// Constructs a BasicToken object. + /// + /// + /// + /// + public BasicToken(string username, string password, TimeSpan? timeout = null) : base(timeout) + { + _username = username; + + _password = password; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs new file mode 100644 index 000000000000..b2d4591d46b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/BearerToken.cs @@ -0,0 +1,39 @@ +// + +#nullable enable + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from a token from a bearer token. + /// + public class BearerToken : TokenBase + { + private string _raw; + + /// + /// Constructs a BearerToken object. + /// + /// + /// + public BearerToken(string value, TimeSpan? timeout = null) : base(timeout) + { + _raw = value; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..ec53dbda4326 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,428 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using KellermanSoftware.CompareNetObjects; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// An instance of CompareLogic. + /// + public static CompareLogic compareLogic; + + /// + /// Static constructor to initialise compareLogic. + /// + static ClientUtils() + { + ComparisonConfig comparisonConfig = new(); + comparisonConfig.UseHashCodeIdentifier = true; + compareLogic = new(comparisonConfig); + } + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// An enum of headers + /// + public enum ApiKeyHeader + { + /// + /// The api-key header + /// + Api_key, + /// + /// The api_key_query header + /// + Api_key_query + } + + /// + /// Converte an ApiKeyHeader to a string + /// + /// + /// + /// + public static string ApiKeyHeaderToString(ApiKeyHeader value) + { + return value switch + { + ApiKeyHeader.Api_key => "api-key", + ApiKeyHeader.Api_key_query => "api_key_query", + _ => throw new System.ComponentModel.InvalidEnumArgumentException(nameof(value), (int)value, typeof(ApiKeyHeader)), + }; + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum) + return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum); + if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum) + return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum); + if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum) + return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); + if (obj is EnumClass enumClass) + return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); + if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) + return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); + if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) + return EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTestEnumIntegerOnlyEnum).ToString(); + if (obj is EnumTest.EnumNumberEnum enumTestEnumNumberEnum) + return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); + if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) + return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); + if (obj is MapTest.InnerEnum mapTestInnerEnum) + return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); + if (obj is Order.StatusEnum orderStatusEnum) + return Order.StatusEnumToJsonValue(orderStatusEnum); + if (obj is OuterEnum outerEnum) + return OuterEnumValueConverter.ToJsonValue(outerEnum); + if (obj is OuterEnumDefaultValue outerEnumDefaultValue) + return OuterEnumDefaultValueValueConverter.ToJsonValue(outerEnumDefaultValue); + if (obj is OuterEnumInteger outerEnumInteger) + return OuterEnumIntegerValueConverter.ToJsonValue(outerEnumInteger).ToString(); + if (obj is OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) + return OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(outerEnumIntegerDefaultValue).ToString(); + if (obj is OuterEnumTest outerEnumTest) + return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); + if (obj is Pet.StatusEnum petStatusEnum) + return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is Zebra.TypeEnum zebraTypeEnum) + return Zebra.TypeEnumToJsonValue(zebraTypeEnum); + if (obj is ZeroBasedEnum zeroBasedEnum) + return ZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnum); + if (obj is ZeroBasedEnumClass.ZeroBasedEnumEnum zeroBasedEnumClassZeroBasedEnumEnum) + return ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClassZeroBasedEnumEnum); + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string? SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// 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) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string? SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://petstore.swagger.io:80/v2"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = "/v2"; + + /// + /// The host of the API + /// + public const string HOST = "petstore.swagger.io"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..85093b0c1fee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,20 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..c9dc766e4639 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..5e42c9efb856 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..de6a37a17df7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,75 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..02b767330d0a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..f711f9f3c7ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..8be0791ee4fb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new ActivityJsonConverter()); + _jsonOptions.Converters.Add(new ActivityOutputElementRepresentationJsonConverter()); + _jsonOptions.Converters.Add(new AdditionalPropertiesClassJsonConverter()); + _jsonOptions.Converters.Add(new AnimalJsonConverter()); + _jsonOptions.Converters.Add(new ApiResponseJsonConverter()); + _jsonOptions.Converters.Add(new AppleJsonConverter()); + _jsonOptions.Converters.Add(new AppleReqJsonConverter()); + _jsonOptions.Converters.Add(new ArrayOfArrayOfNumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ArrayOfNumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ArrayTestJsonConverter()); + _jsonOptions.Converters.Add(new BananaJsonConverter()); + _jsonOptions.Converters.Add(new BananaReqJsonConverter()); + _jsonOptions.Converters.Add(new BasquePigJsonConverter()); + _jsonOptions.Converters.Add(new CapitalizationJsonConverter()); + _jsonOptions.Converters.Add(new CatJsonConverter()); + _jsonOptions.Converters.Add(new CategoryJsonConverter()); + _jsonOptions.Converters.Add(new ChildCatJsonConverter()); + _jsonOptions.Converters.Add(new ClassModelJsonConverter()); + _jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new DanishPigJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyClassJsonConverter()); + _jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter()); + _jsonOptions.Converters.Add(new DogJsonConverter()); + _jsonOptions.Converters.Add(new DrawingJsonConverter()); + _jsonOptions.Converters.Add(new EnumArraysJsonConverter()); + _jsonOptions.Converters.Add(new EnumClassJsonConverter()); + _jsonOptions.Converters.Add(new EnumClassNullableJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestJsonConverter()); + _jsonOptions.Converters.Add(new EquilateralTriangleJsonConverter()); + _jsonOptions.Converters.Add(new FileJsonConverter()); + _jsonOptions.Converters.Add(new FileSchemaTestClassJsonConverter()); + _jsonOptions.Converters.Add(new FooJsonConverter()); + _jsonOptions.Converters.Add(new FooGetDefaultResponseJsonConverter()); + _jsonOptions.Converters.Add(new FormatTestJsonConverter()); + _jsonOptions.Converters.Add(new FruitJsonConverter()); + _jsonOptions.Converters.Add(new FruitReqJsonConverter()); + _jsonOptions.Converters.Add(new GmFruitJsonConverter()); + _jsonOptions.Converters.Add(new GrandparentAnimalJsonConverter()); + _jsonOptions.Converters.Add(new HasOnlyReadOnlyJsonConverter()); + _jsonOptions.Converters.Add(new HealthCheckResultJsonConverter()); + _jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter()); + _jsonOptions.Converters.Add(new ListJsonConverter()); + _jsonOptions.Converters.Add(new LiteralStringClassJsonConverter()); + _jsonOptions.Converters.Add(new MammalJsonConverter()); + _jsonOptions.Converters.Add(new MapTestJsonConverter()); + _jsonOptions.Converters.Add(new MixLogJsonConverter()); + _jsonOptions.Converters.Add(new MixedAnyOfJsonConverter()); + _jsonOptions.Converters.Add(new MixedAnyOfContentJsonConverter()); + _jsonOptions.Converters.Add(new MixedOneOfJsonConverter()); + _jsonOptions.Converters.Add(new MixedOneOfContentJsonConverter()); + _jsonOptions.Converters.Add(new MixedPropertiesAndAdditionalPropertiesClassJsonConverter()); + _jsonOptions.Converters.Add(new MixedSubIdJsonConverter()); + _jsonOptions.Converters.Add(new Model200ResponseJsonConverter()); + _jsonOptions.Converters.Add(new ModelClientJsonConverter()); + _jsonOptions.Converters.Add(new NameJsonConverter()); + _jsonOptions.Converters.Add(new NotificationtestGetElementsV1ResponseMPayloadJsonConverter()); + _jsonOptions.Converters.Add(new NullableClassJsonConverter()); + _jsonOptions.Converters.Add(new NullableGuidClassJsonConverter()); + _jsonOptions.Converters.Add(new NullableShapeJsonConverter()); + _jsonOptions.Converters.Add(new NumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ObjectWithDeprecatedFieldsJsonConverter()); + _jsonOptions.Converters.Add(new OneOfStringJsonConverter()); + _jsonOptions.Converters.Add(new OrderJsonConverter()); + _jsonOptions.Converters.Add(new OuterCompositeJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumDefaultValueJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumDefaultValueNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerDefaultValueJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerDefaultValueNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumTestJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumTestNullableJsonConverter()); + _jsonOptions.Converters.Add(new ParentPetJsonConverter()); + _jsonOptions.Converters.Add(new PetJsonConverter()); + _jsonOptions.Converters.Add(new PigJsonConverter()); + _jsonOptions.Converters.Add(new PolymorphicPropertyJsonConverter()); + _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); + _jsonOptions.Converters.Add(new ReturnJsonConverter()); + _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); + _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); + _jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter()); + _jsonOptions.Converters.Add(new ShapeJsonConverter()); + _jsonOptions.Converters.Add(new ShapeInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new ShapeOrNullJsonConverter()); + _jsonOptions.Converters.Add(new SimpleQuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new SpecialModelNameJsonConverter()); + _jsonOptions.Converters.Add(new TagJsonConverter()); + _jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter()); + _jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter()); + _jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter()); + _jsonOptions.Converters.Add(new TriangleJsonConverter()); + _jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new UserJsonConverter()); + _jsonOptions.Converters.Add(new WhaleJsonConverter()); + _jsonOptions.Converters.Add(new ZebraJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action? client = null, Action? builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs new file mode 100644 index 000000000000..e566414eb6ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -0,0 +1,679 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Cryptography; +using System.Text; +using System.Web; + +namespace Org.OpenAPITools.Client +{ + /// + /// Class for HttpSigning auth related parameter and methods + /// + public class HttpSigningConfiguration + { + /// + /// Create an instance + /// + public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString? keyPassPhrase, List httpSigningHeader, HashAlgorithmName hashAlgorithm, string signingAlgorithm, int signatureValidityPeriod) + { + KeyId = keyId; + KeyFilePath = keyFilePath; + KeyPassPhrase = keyPassPhrase; + HttpSigningHeader = httpSigningHeader; + HashAlgorithm = hashAlgorithm; + SigningAlgorithm = signingAlgorithm; + SignatureValidityPeriod = signatureValidityPeriod; + } + + /// + ///Gets the Api keyId + /// + public string KeyId { get; set; } + + /// + /// Gets the Key file path + /// + public string KeyFilePath { get; set; } + + /// + /// Gets the key pass phrase for password protected key + /// + public SecureString? KeyPassPhrase { get; set; } + + /// + /// Gets the HTTP signing header + /// + public List HttpSigningHeader { get; set; } + + /// + /// Gets the hash algorithm sha256 or sha512 + /// + public HashAlgorithmName HashAlgorithm { get; set; } = HashAlgorithmName.SHA256; + + /// + /// Gets the signing algorithm + /// + public string SigningAlgorithm { get; set; } + + /// + /// Gets the Signature validity period in seconds + /// + public int SignatureValidityPeriod { get; set; } + + private enum PrivateKeyType + { + None = 0, + RSA = 1, + ECDSA = 2, + } + + /// + /// Gets the Headers for HttpSigning + /// + /// + /// + /// + internal Dictionary GetHttpSignedHeader(global::System.Net.Http.HttpRequestMessage request, string requestBody, System.Threading.CancellationToken cancellationToken = default) + { + if (request.RequestUri == null) + throw new NullReferenceException("The request URI was null"); + + const string HEADER_REQUEST_TARGET = "(request-target)"; + + // The time when the HTTP signature expires. The API server should reject HTTP requests that have expired. + const string HEADER_EXPIRES = "(expires)"; + + //The 'Date' header. + const string HEADER_DATE = "Date"; + + //The 'Host' header. + const string HEADER_HOST = "Host"; + + //The time when the HTTP signature was generated. + const string HEADER_CREATED = "(created)"; + + //When the 'Digest' header is included in the HTTP signature, the client automatically + //computes the digest of the HTTP request body, per RFC 3230. + const string HEADER_DIGEST = "Digest"; + + //The 'Authorization' header is automatically generated by the client. It includes + //the list of signed headers and a base64-encoded signature. + const string HEADER_AUTHORIZATION = "Authorization"; + + //Hash table to store singed headers + var HttpSignedRequestHeader = new Dictionary(); + + var httpSignatureHeader = new Dictionary(); + + if (HttpSigningHeader.Count == 0) + HttpSigningHeader.Add("(created)"); + + var dateTime = DateTime.Now; + string digest = String.Empty; + + if (HashAlgorithm == HashAlgorithmName.SHA256) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + digest = string.Format("SHA-256={0}", Convert.ToBase64String(bodyDigest)); + } + else if (HashAlgorithm == HashAlgorithmName.SHA512) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + digest = string.Format("SHA-512={0}", Convert.ToBase64String(bodyDigest)); + } + else + throw new Exception(string.Format("{0} not supported", HashAlgorithm)); + + foreach (var header in HttpSigningHeader) + if (header.Equals(HEADER_REQUEST_TARGET)) + httpSignatureHeader.Add(header.ToLower(), request.RequestUri.ToString()); + else if (header.Equals(HEADER_EXPIRES)) + { + var expireDateTime = dateTime.AddSeconds(SignatureValidityPeriod); + httpSignatureHeader.Add(header.ToLower(), GetUnixTime(expireDateTime).ToString()); + } + else if (header.Equals(HEADER_DATE)) + { + var utcDateTime = dateTime.ToString("r").ToString(); + httpSignatureHeader.Add(header.ToLower(), utcDateTime); + HttpSignedRequestHeader.Add(HEADER_DATE, utcDateTime); + } + else if (header.Equals(HEADER_HOST)) + { + httpSignatureHeader.Add(header.ToLower(), request.RequestUri.ToString()); + HttpSignedRequestHeader.Add(HEADER_HOST, request.RequestUri.ToString()); + } + else if (header.Equals(HEADER_CREATED)) + httpSignatureHeader.Add(header.ToLower(), GetUnixTime(dateTime).ToString()); + else if (header.Equals(HEADER_DIGEST)) + { + HttpSignedRequestHeader.Add(HEADER_DIGEST, digest); + httpSignatureHeader.Add(header.ToLower(), digest); + } + else + { + bool isHeaderFound = false; + foreach (var item in request.Headers) + { + if (string.Equals(item.Key, header, StringComparison.OrdinalIgnoreCase)) + { + httpSignatureHeader.Add(header.ToLower(), item.Value.ToString()); + isHeaderFound = true; + break; + } + } + + if (!isHeaderFound) + throw new Exception(string.Format("Cannot sign HTTP request.Request does not contain the {0} header.",header)); + } + + var headersKeysString = String.Join(" ", httpSignatureHeader.Keys); + var headerValuesList = new List(); + + foreach (var keyVal in httpSignatureHeader) + headerValuesList.Add(string.Format("{0}: {1}", keyVal.Key, keyVal.Value)); + + //Concatenate headers value separated by new line + var headerValuesString = string.Join("\n", headerValuesList); + var signatureStringHash = GetStringHash(HashAlgorithm, headerValuesString); + string? headerSignatureStr = null; + var keyType = GetKeyType(KeyFilePath); + + if (keyType == PrivateKeyType.RSA) + headerSignatureStr = GetRSASignature(signatureStringHash); + + else if (keyType == PrivateKeyType.ECDSA) + headerSignatureStr = GetECDSASignature(signatureStringHash); + + var cryptographicScheme = "hs2019"; + var authorizationHeaderValue = string.Format("Signature keyId=\"{0}\",algorithm=\"{1}\"", + KeyId, cryptographicScheme); + + if (httpSignatureHeader.ContainsKey(HEADER_CREATED)) + authorizationHeaderValue += string.Format(",created={0}", httpSignatureHeader[HEADER_CREATED]); + + if (httpSignatureHeader.ContainsKey(HEADER_EXPIRES)) + authorizationHeaderValue += string.Format(",expires={0}", httpSignatureHeader[HEADER_EXPIRES]); + + authorizationHeaderValue += string.Format(",headers=\"{0}\",signature=\"{1}\"", headersKeysString, headerSignatureStr); + + HttpSignedRequestHeader.Add(HEADER_AUTHORIZATION, authorizationHeaderValue); + + return HttpSignedRequestHeader; + } + + private byte[] GetStringHash(HashAlgorithmName hashAlgorithmName, string stringToBeHashed) + { + HashAlgorithm? hashAlgorithm = null; + + if (hashAlgorithmName == HashAlgorithmName.SHA1) + hashAlgorithm = SHA1.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA256) + hashAlgorithm = SHA256.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA512) + hashAlgorithm = SHA512.Create(); + + if (hashAlgorithmName == HashAlgorithmName.MD5) + hashAlgorithm = MD5.Create(); + + if (hashAlgorithm == null) + throw new NullReferenceException($"{ nameof(hashAlgorithm) } was null."); + + byte[] bytes = Encoding.UTF8.GetBytes(stringToBeHashed); + byte[] stringHash = hashAlgorithm.ComputeHash(bytes); + return stringHash; + } + + private int GetUnixTime(DateTime date2) + { + DateTime date1 = new DateTime(1970, 01, 01); + TimeSpan timeSpan = date2 - date1; + return (int)timeSpan.TotalSeconds; + } + + private string GetRSASignature(byte[] stringToSign) + { + if (KeyPassPhrase == null) + throw new NullReferenceException($"{ nameof(KeyPassPhrase) } was null."); + + RSA? rsa = GetRSAProviderFromPemFile(KeyFilePath, KeyPassPhrase); + + if (rsa == null) + return string.Empty; + else if (SigningAlgorithm == "RSASSA-PSS") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pss); + return Convert.ToBase64String(signedbytes); + } + else if (SigningAlgorithm == "PKCS1-v15") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pkcs1); + return Convert.ToBase64String(signedbytes); + } + + return string.Empty; + } + + /// + /// Gets the ECDSA signature + /// + /// + /// + private string GetECDSASignature(byte[] dataToSign) + { + if (!File.Exists(KeyFilePath)) + throw new Exception("key file path does not exist."); + + var ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + var ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var keyStr = File.ReadAllText(KeyFilePath); + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + + string ptrToStringUni = Marshal.PtrToStringUni(unmanagedString) ?? throw new NullReferenceException(); + + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(ptrToStringUni), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var signedBytes = ecdsa.SignHash(dataToSign); + var derBytes = ConvertToECDSAANS1Format(signedBytes); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; + } + + private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) + { + var derBytes = new List(); + byte derLength = 68; //default length for ECDSA code signing bit 0x44 + byte rbytesLength = 32; //R length 0x20 + byte sbytesLength = 32; //S length 0x20 + var rBytes = new List(); + var sBytes = new List(); + for (int i = 0; i < 32; i++) + rBytes.Add(signedBytes[i]); + + for (int i = 32; i < 64; i++) + sBytes.Add(signedBytes[i]); + + if (rBytes[0] > 0x7F) + { + derLength++; + rbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(rBytes); + rBytes.Clear(); + rBytes.Add(0x00); + rBytes.AddRange(tempBytes); + } + + if (sBytes[0] > 0x7F) + { + derLength++; + sbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(sBytes); + sBytes.Clear(); + sBytes.Add(0x00); + sBytes.AddRange(tempBytes); + + } + + derBytes.Add(48); //start of the sequence 0x30 + derBytes.Add(derLength); //total length r length, type and r bytes + + derBytes.Add(2); //tag for integer + derBytes.Add(rbytesLength); //length of r + derBytes.AddRange(rBytes); + + derBytes.Add(2); //tag for integer + derBytes.Add(sbytesLength); //length of s + derBytes.AddRange(sBytes); + return derBytes.ToArray(); + } + + private RSACryptoServiceProvider? GetRSAProviderFromPemFile(String pemfile, SecureString? keyPassPhrase = null) + { + const String pempubheader = "-----BEGIN PUBLIC KEY-----"; + const String pempubfooter = "-----END PUBLIC KEY-----"; + bool isPrivateKeyFile = true; + byte[]? pemkey = null; + + if (!File.Exists(pemfile)) + throw new Exception("private key file does not exist."); + + string pemstr = File.ReadAllText(pemfile).Trim(); + + if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) + isPrivateKeyFile = false; + + if (isPrivateKeyFile) + { + pemkey = ConvertPrivateKeyToBytes(pemstr, keyPassPhrase); + + if (pemkey == null) + return null; + + return DecodeRSAPrivateKey(pemkey); + } + return null; + } + + private byte[]? ConvertPrivateKeyToBytes(String instr, SecureString? keyPassPhrase = null) + { + const String pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; + const String pemprivfooter = "-----END RSA PRIVATE KEY-----"; + String pemstr = instr.Trim(); + byte[] binkey; + + if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) + return null; + + StringBuilder sb = new StringBuilder(pemstr); + sb.Replace(pemprivheader, ""); + sb.Replace(pemprivfooter, ""); + String pvkstr = sb.ToString().Trim(); + + try + { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key + binkey = Convert.FromBase64String(pvkstr); + return binkey; + } + catch (global::System.FormatException) + { + StringReader str = new StringReader(pvkstr); + + //-------- read PEM encryption info. lines and extract salt ----- + if (!str.ReadLine()!.StartsWith("Proc-Type: 4,ENCRYPTED")) // TODO: what do we do here if ReadLine is null? + return null; + + String saltline = str.ReadLine()!; // TODO: what do we do here if ReadLine is null? + if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) + return null; + + String saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); + byte[] salt = new byte[saltstr.Length / 2]; + for (int i = 0; i < salt.Length; i++) + salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); + + if (!(str.ReadLine() == "")) + return null; + + //------ remaining b64 data is encrypted RSA key ---- + String encryptedstr = str.ReadToEnd(); + + try + { //should have b64 encrypted RSA key now + binkey = Convert.FromBase64String(encryptedstr); + } + catch (global::System.FormatException) + { //data is not in base64 format + return null; + } + + // TODO: what do we do here if keyPassPhrase is null? + byte[] deskey = GetEncryptedKey(salt, keyPassPhrase!, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes + if (deskey == null) + return null; + + //------ Decrypt the encrypted 3des-encrypted RSA private key ------ + byte[]? rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV + + return rsakey; + } + } + + private RSACryptoServiceProvider? DecodeRSAPrivateKey(byte[] privkey) + { + byte[] MODULUS, E, D, P, Q, DP, DQ, IQ; + + // --------- Set up stream to decode the asn.1 encoded RSA private key ------ + MemoryStream mem = new MemoryStream(privkey); + BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading + byte bt = 0; + ushort twobytes = 0; + int elems = 0; + try + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + binr.ReadByte(); //advance 1 byte + else if (twobytes == 0x8230) + binr.ReadInt16(); //advance 2 bytes + else + return null; + + twobytes = binr.ReadUInt16(); + if (twobytes != 0x0102) //version number + return null; + + bt = binr.ReadByte(); + if (bt != 0x00) + return null; + + //------ all private key components are Integer sequences ---- + elems = GetIntegerSize(binr); + MODULUS = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + E = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + D = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + P = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + Q = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + IQ = binr.ReadBytes(elems); + + // ------- create RSACryptoServiceProvider instance and initialize with public key ----- + RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); + RSAParameters RSAparams = new RSAParameters(); + RSAparams.Modulus = MODULUS; + RSAparams.Exponent = E; + RSAparams.D = D; + RSAparams.P = P; + RSAparams.Q = Q; + RSAparams.DP = DP; + RSAparams.DQ = DQ; + RSAparams.InverseQ = IQ; + RSA.ImportParameters(RSAparams); + return RSA; + } + catch (Exception) + { + return null; + } + finally + { + binr.Close(); + } + } + + private int GetIntegerSize(BinaryReader binr) + { + byte bt = 0; + byte lowbyte = 0x00; + byte highbyte = 0x00; + int count = 0; + bt = binr.ReadByte(); + if (bt != 0x02) //expect integer + return 0; + + bt = binr.ReadByte(); + + if (bt == 0x81) + count = binr.ReadByte(); // data size in next byte + else if (bt == 0x82) + { + highbyte = binr.ReadByte(); // data size in next 2 bytes + lowbyte = binr.ReadByte(); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; + count = BitConverter.ToInt32(modint, 0); + } + else + count = bt; // we already have the data size + + while (binr.ReadByte() == 0x00) + //remove high order zeros in data + count -= 1; + + binr.BaseStream.Seek(-1, SeekOrigin.Current); + + //last ReadByte wasn't a removed zero, so back up a byte + return count; + } + + private byte[] GetEncryptedKey(byte[] salt, SecureString secpswd, int count, int miter) + { + IntPtr unmanagedPswd = IntPtr.Zero; + int HASHLENGTH = 16; //MD5 bytes + byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store concatenated Mi hashed results + + byte[] psbytes = new byte[secpswd.Length]; + unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); + Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); + Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); + + // --- concatenate salt and pswd bytes into fixed data array --- + byte[] data00 = new byte[psbytes.Length + salt.Length]; + Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes + Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes + + // ---- do multi-hashing and concatenate results D1, D2 ... into keymaterial bytes ---- + MD5 md5 = MD5.Create(); + byte[]? result = null; + byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget + + for (int j = 0; j < miter; j++) + { + // ---- Now hash consecutively for count times ------ + if (j == 0) + result = data00; //initialize + else + { + Array.Copy(result!, hashtarget, result!.Length); // TODO: what do we do if result is null here? + Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); + result = hashtarget; + } + + for (int i = 0; i < count; i++) + result = md5.ComputeHash(result); + + Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //concatenate to keymaterial + } + byte[] deskey = new byte[24]; + Array.Copy(keymaterial, deskey, deskey.Length); + + Array.Clear(psbytes, 0, psbytes.Length); + Array.Clear(data00, 0, data00.Length); + Array.Clear(result!, 0, result!.Length); // TODO: what do we do if result is null here? + Array.Clear(hashtarget, 0, hashtarget.Length); + Array.Clear(keymaterial, 0, keymaterial.Length); + return deskey; + } + + private byte[]? DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) + { + MemoryStream memst = new MemoryStream(); + TripleDES alg = TripleDES.Create(); + alg.Key = desKey; + alg.IV = IV; + try + { + CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); + cs.Write(cipherData, 0, cipherData.Length); + cs.Close(); + } + catch (Exception) + { + return null; + } + byte[] decryptedData = memst.ToArray(); + return decryptedData; + } + + /// + /// Detect the key type from the pem file. + /// + /// key file path in pem format + /// + private PrivateKeyType GetKeyType(string keyFilePath) + { + if (!File.Exists(keyFilePath)) + throw new Exception("Key file path does not exist."); + + var ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY"; + var ecPrivateKeyFooter = "END EC PRIVATE KEY"; + var rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY"; + var rsaPrivateFooter = "END RSA PRIVATE KEY"; + //var pkcs8Header = "BEGIN PRIVATE KEY"; + //var pkcs8Footer = "END PRIVATE KEY"; + var keyType = PrivateKeyType.None; + var key = File.ReadAllLines(keyFilePath); + + if (key[0].ToString().Contains(rsaPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(rsaPrivateFooter)) + keyType = PrivateKeyType.RSA; + else if (key[0].ToString().Contains(ecPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + keyType = PrivateKeyType.ECDSA; + + else if (key[0].ToString().Contains(ecPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + { + /* this type of key can hold many type different types of private key, but here due lack of pem header + Considering this as EC key + */ + //TODO :- update the key based on oid + keyType = PrivateKeyType.ECDSA; + } + else + throw new Exception("Either the key is invalid or key is not supported"); + + return keyType; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs new file mode 100644 index 000000000000..5d5338cb9e61 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -0,0 +1,43 @@ +// + +#nullable enable + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an HttpSigningConfiguration + /// + public class HttpSignatureToken : TokenBase + { + private HttpSigningConfiguration _configuration; + + /// + /// Constructs an HttpSignatureToken object. + /// + /// + /// + public HttpSignatureToken(HttpSigningConfiguration configuration, TimeSpan? timeout = null) : base(timeout) + { + _configuration = configuration; + } + + /// + /// Places the token in the header. + /// + /// + /// + /// + public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string requestBody, CancellationToken cancellationToken = default) + { + var signedHeaders = _configuration.GetHttpSignedHeader(request, requestBody, cancellationToken); + + foreach (var signedHeader in signedHeaders) + request.Headers.Add(signedHeader.Key, signedHeader.Value); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..0184d9ad9446 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,27 @@ +// + +#nullable enable + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs new file mode 100644 index 000000000000..3544d55c373c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -0,0 +1,39 @@ +// + +#nullable enable + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed with OAuth. + /// + public class OAuthToken : TokenBase + { + private string _raw; + + /// + /// Consturcts an OAuthToken object. + /// + /// + /// + public OAuthToken(string value, TimeSpan? timeout = null) : base(timeout) + { + _raw = value; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..e6fd1c26872d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/Option.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..d5510735d390 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + if (container is TokenContainer apiKeyTokenContainer) + { + string[] headers = apiKeyTokenContainer.Tokens.Select(t => ClientUtils.ApiKeyHeaderToString(t.Header)).Distinct().ToArray(); + + foreach (string header in headers) + { + BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(header, Channel.CreateBounded(options)); + } + } + else + { + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + } + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..3f713a2ef4bb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,71 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..7b0f23d28a4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,37 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..b873d5323e7a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,44 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..8c3aac614025 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,43 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..6a48eba93cd6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..bde566d77c34 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs new file mode 100644 index 000000000000..87bc3578658c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Activity.cs @@ -0,0 +1,180 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// test map of maps + /// + public partial class Activity : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// activityOutputs + [JsonConstructor] + public Activity(Option>?> activityOutputs = default) + { + ActivityOutputsOption = activityOutputs; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ActivityOutputs + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> ActivityOutputsOption { get; private set; } + + /// + /// Gets or Sets ActivityOutputs + /// + [JsonPropertyName("activity_outputs")] + public Dictionary>? ActivityOutputs { get { return this.ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Activity {\n"); + sb.Append(" ActivityOutputs: ").Append(ActivityOutputs).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActivityJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>?> activityOutputs = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "activity_outputs": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (activityOutputs.IsSet && activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); + + return new Activity(activityOutputs); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, activity, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) + { + if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + + if (activity.ActivityOutputsOption.IsSet) + { + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs new file mode 100644 index 000000000000..546931023bb4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -0,0 +1,209 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ActivityOutputElementRepresentation + /// + public partial class ActivityOutputElementRepresentation : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// prop1 + /// prop2 + [JsonConstructor] + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) + { + Prop1Option = prop1; + Prop2Option = prop2; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Prop1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Prop1Option { get; private set; } + + /// + /// Gets or Sets Prop1 + /// + [JsonPropertyName("prop1")] + public string? Prop1 { get { return this.Prop1Option; } set { this.Prop1Option = new(value); } } + + /// + /// Used to track the state of Prop2 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Prop2Option { get; private set; } + + /// + /// Gets or Sets Prop2 + /// + [JsonPropertyName("prop2")] + public Object? Prop2 { get { return this.Prop2Option; } set { this.Prop2Option = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ActivityOutputElementRepresentation {\n"); + sb.Append(" Prop1: ").Append(Prop1).Append("\n"); + sb.Append(" Prop2: ").Append(Prop2).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActivityOutputElementRepresentationJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option prop1 = default; + Option prop2 = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "prop1": + prop1 = new Option(utf8JsonReader.GetString()!); + break; + case "prop2": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (prop1.IsSet && prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); + + if (prop2.IsSet && prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); + + return new ActivityOutputElementRepresentation(prop1, prop2); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, activityOutputElementRepresentation, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) + { + if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop1Option.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); + + if (activityOutputElementRepresentation.Prop2Option.IsSet) + { + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs new file mode 100644 index 000000000000..20b8444349b0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -0,0 +1,402 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// AdditionalPropertiesClass + /// + public partial class AdditionalPropertiesClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// anytype1 + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + /// mapOfMapProperty + /// mapProperty + /// mapWithUndeclaredPropertiesAnytype1 + /// mapWithUndeclaredPropertiesAnytype2 + /// mapWithUndeclaredPropertiesAnytype3 + /// mapWithUndeclaredPropertiesString + [JsonConstructor] + public AdditionalPropertiesClass(Option anytype1 = default, Option emptyMap = default, Option>?> mapOfMapProperty = default, Option?> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option?> mapWithUndeclaredPropertiesAnytype3 = default, Option?> mapWithUndeclaredPropertiesString = default) + { + Anytype1Option = anytype1; + EmptyMapOption = emptyMap; + MapOfMapPropertyOption = mapOfMapProperty; + MapPropertyOption = mapProperty; + MapWithUndeclaredPropertiesAnytype1Option = mapWithUndeclaredPropertiesAnytype1; + MapWithUndeclaredPropertiesAnytype2Option = mapWithUndeclaredPropertiesAnytype2; + MapWithUndeclaredPropertiesAnytype3Option = mapWithUndeclaredPropertiesAnytype3; + MapWithUndeclaredPropertiesStringOption = mapWithUndeclaredPropertiesString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Anytype1Option { get; private set; } + + /// + /// Gets or Sets Anytype1 + /// + [JsonPropertyName("anytype_1")] + public Object? Anytype1 { get { return this.Anytype1Option; } set { this.Anytype1Option = new(value); } } + + /// + /// Used to track the state of EmptyMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EmptyMapOption { get; private set; } + + /// + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + /// + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + [JsonPropertyName("empty_map")] + public Object? EmptyMap { get { return this.EmptyMapOption; } set { this.EmptyMapOption = new(value); } } + + /// + /// Used to track the state of MapOfMapProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> MapOfMapPropertyOption { get; private set; } + + /// + /// Gets or Sets MapOfMapProperty + /// + [JsonPropertyName("map_of_map_property")] + public Dictionary>? MapOfMapProperty { get { return this.MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } + + /// + /// Used to track the state of MapProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapPropertyOption { get; private set; } + + /// + /// Gets or Sets MapProperty + /// + [JsonPropertyName("map_property")] + public Dictionary? MapProperty { get { return this.MapPropertyOption; } set { this.MapPropertyOption = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_1")] + public Object? MapWithUndeclaredPropertiesAnytype1 { get { return this.MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_2")] + public Object? MapWithUndeclaredPropertiesAnytype2 { get { return this.MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_3")] + public Dictionary? MapWithUndeclaredPropertiesAnytype3 { get { return this.MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesString + /// + [JsonPropertyName("map_with_undeclared_properties_string")] + public Dictionary? MapWithUndeclaredPropertiesString { get { return this.MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AdditionalPropertiesClass {\n"); + sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); + sb.Append(" EmptyMap: ").Append(EmptyMap).Append("\n"); + sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); + sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype1: ").Append(MapWithUndeclaredPropertiesAnytype1).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AdditionalPropertiesClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option anytype1 = default; + Option emptyMap = default; + Option>?> mapOfMapProperty = default; + Option?> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option?> mapWithUndeclaredPropertiesAnytype3 = default; + Option?> mapWithUndeclaredPropertiesString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "anytype_1": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "empty_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_of_map_property": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_property": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_with_undeclared_properties_anytype_1": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_with_undeclared_properties_anytype_2": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_with_undeclared_properties_anytype_3": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_with_undeclared_properties_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (emptyMap.IsSet && emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapOfMapProperty.IsSet && mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapProperty.IsSet && mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype1.IsSet && mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype2.IsSet && mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype3.IsSet && mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); + + return new AdditionalPropertiesClass(anytype1, emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, additionalPropertiesClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.Anytype1Option.IsSet) + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); + if (additionalPropertiesClass.EmptyMapOption.IsSet) + { + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) + { + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapPropertyOption.IsSet) + { + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs new file mode 100644 index 000000000000..648b8fde8871 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Animal.cs @@ -0,0 +1,223 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Animal + /// + public partial class Animal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// color (default to "red") + [JsonConstructor] + public Animal(Option color = default) + { + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public string ClassName { get; } = "Animal"; + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Animal {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AnimalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option color = default; + + string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "className"); + + if (discriminator != null && discriminator.Equals("Cat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + if (discriminator != null && discriminator.Equals("Dog")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Animal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); + + return new Animal(color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) + { + if (animal is Cat cat){ + JsonSerializer.Serialize(writer, cat, jsonSerializerOptions); + return; + } + + if (animal is Dog dog){ + JsonSerializer.Serialize(writer, dog, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, animal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) + { + if (animal.ColorOption.IsSet && animal.Color == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + + writer.WriteString("className", animal.ClassName); + + if (animal.ColorOption.IsSet) + writer.WriteString("color", animal.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs new file mode 100644 index 000000000000..cd20dcc6f2a2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -0,0 +1,232 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ApiResponse + /// + public partial class ApiResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// code + /// message + /// type + [JsonConstructor] + public ApiResponse(Option code = default, Option message = default, Option type = default) + { + CodeOption = code; + MessageOption = message; + TypeOption = type; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Code + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CodeOption { get; private set; } + + /// + /// Gets or Sets Code + /// + [JsonPropertyName("code")] + public int? Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } } + + /// + /// Used to track the state of Message + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MessageOption { get; private set; } + + /// + /// Gets or Sets Message + /// + [JsonPropertyName("message")] + public string? Message { get { return this.MessageOption; } set { this.MessageOption = new(value); } } + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TypeOption { get; private set; } + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public string? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ApiResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option code = default; + Option message = default; + Option type = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "code": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + code = new Option(utf8JsonReader.GetInt32()); + break; + case "message": + message = new Option(utf8JsonReader.GetString()!); + break; + case "type": + type = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (code.IsSet && code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); + + if (message.IsSet && message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); + + return new ApiResponse(code, message, type); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apiResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + + if (apiResponse.CodeOption.IsSet) + writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); + + if (apiResponse.MessageOption.IsSet) + writer.WriteString("message", apiResponse.Message); + + if (apiResponse.TypeOption.IsSet) + writer.WriteString("type", apiResponse.Type); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs new file mode 100644 index 000000000000..601dae95aa1a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Apple.cs @@ -0,0 +1,264 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Apple + /// + public partial class Apple : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// colorCode + /// cultivar + /// origin + [JsonConstructor] + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) + { + ColorCodeOption = colorCode; + CultivarOption = cultivar; + OriginOption = origin; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ColorCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorCodeOption { get; private set; } + + /// + /// Gets or Sets ColorCode + /// + [JsonPropertyName("color_code")] + public string? ColorCode { get { return this.ColorCodeOption; } set { this.ColorCodeOption = new(value); } } + + /// + /// Used to track the state of Cultivar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CultivarOption { get; private set; } + + /// + /// Gets or Sets Cultivar + /// + [JsonPropertyName("cultivar")] + public string? Cultivar { get { return this.CultivarOption; } set { this.CultivarOption = new(value); } } + + /// + /// Used to track the state of Origin + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OriginOption { get; private set; } + + /// + /// Gets or Sets Origin + /// + [JsonPropertyName("origin")] + public string? Origin { get { return this.OriginOption; } set { this.OriginOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Apple {\n"); + sb.Append(" ColorCode: ").Append(ColorCode).Append("\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); + sb.Append(" Origin: ").Append(Origin).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.ColorCodeOption.Value != null) { + // ColorCode (string) pattern + Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); + + if (this.ColorCodeOption.Value != null &&!regexColorCode.Match(this.ColorCodeOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); + } + } + + if (this.CultivarOption.Value != null) { + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + + if (this.CultivarOption.Value != null &&!regexCultivar.Match(this.CultivarOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } + } + + if (this.OriginOption.Value != null) { + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.OriginOption.Value != null &&!regexOrigin.Match(this.OriginOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } + } + + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option colorCode = default; + Option cultivar = default; + Option origin = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color_code": + colorCode = new Option(utf8JsonReader.GetString()!); + break; + case "cultivar": + cultivar = new Option(utf8JsonReader.GetString()!); + break; + case "origin": + origin = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (colorCode.IsSet && colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); + + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); + + if (origin.IsSet && origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); + + return new Apple(colorCode, cultivar, origin); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apple, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.CultivarOption.IsSet && apple.Cultivar == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.OriginOption.IsSet && apple.Origin == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + + if (apple.ColorCodeOption.IsSet) + writer.WriteString("color_code", apple.ColorCode); + + if (apple.CultivarOption.IsSet) + writer.WriteString("cultivar", apple.Cultivar); + + if (apple.OriginOption.IsSet) + writer.WriteString("origin", apple.Origin); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs new file mode 100644 index 000000000000..e4d0962e9ef4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/AppleReq.cs @@ -0,0 +1,191 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// AppleReq + /// + public partial class AppleReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// cultivar + /// mealy + [JsonConstructor] + public AppleReq(string cultivar, Option mealy = default) + { + Cultivar = cultivar; + MealyOption = mealy; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Cultivar + /// + [JsonPropertyName("cultivar")] + public string Cultivar { get; set; } + + /// + /// Used to track the state of Mealy + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MealyOption { get; private set; } + + /// + /// Gets or Sets Mealy + /// + [JsonPropertyName("mealy")] + public bool? Mealy { get { return this.MealyOption; } set { this.MealyOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AppleReq {\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); + sb.Append(" Mealy: ").Append(Mealy).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option cultivar = default; + Option mealy = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "cultivar": + cultivar = new Option(utf8JsonReader.GetString()!); + break; + case "mealy": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mealy = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!cultivar.IsSet) + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); + + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); + + if (mealy.IsSet && mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + return new AppleReq(cultivar.Value!, mealy); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, appleReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) + { + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + + writer.WriteString("cultivar", appleReq.Cultivar); + + if (appleReq.MealyOption.IsSet) + writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs new file mode 100644 index 000000000000..9b23c0166650 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -0,0 +1,180 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfArrayOfNumberOnly + /// + public partial class ArrayOfArrayOfNumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayArrayNumber + [JsonConstructor] + public ArrayOfArrayOfNumberOnly(Option>?> arrayArrayNumber = default) + { + ArrayArrayNumberOption = arrayArrayNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayArrayNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> ArrayArrayNumberOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayNumber + /// + [JsonPropertyName("ArrayArrayNumber")] + public List>? ArrayArrayNumber { get { return this.ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayOfArrayOfNumberOnly {\n"); + sb.Append(" ArrayArrayNumber: ").Append(ArrayArrayNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayOfArrayOfNumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>?> arrayArrayNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ArrayArrayNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); + + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayOfArrayOfNumberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) + { + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs new file mode 100644 index 000000000000..cfe30e6ce660 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -0,0 +1,180 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfNumberOnly + /// + public partial class ArrayOfNumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayNumber + [JsonConstructor] + public ArrayOfNumberOnly(Option?> arrayNumber = default) + { + ArrayNumberOption = arrayNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayNumberOption { get; private set; } + + /// + /// Gets or Sets ArrayNumber + /// + [JsonPropertyName("ArrayNumber")] + public List? ArrayNumber { get { return this.ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayOfNumberOnly {\n"); + sb.Append(" ArrayNumber: ").Append(ArrayNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayOfNumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> arrayNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ArrayNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (arrayNumber.IsSet && arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); + + return new ArrayOfNumberOnly(arrayNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayOfNumberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) + { + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs new file mode 100644 index 000000000000..0899aecaee69 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -0,0 +1,244 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayTest + /// + public partial class ArrayTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayArrayOfInteger + /// arrayArrayOfModel + /// arrayOfString + [JsonConstructor] + public ArrayTest(Option>?> arrayArrayOfInteger = default, Option>?> arrayArrayOfModel = default, Option?> arrayOfString = default) + { + ArrayArrayOfIntegerOption = arrayArrayOfInteger; + ArrayArrayOfModelOption = arrayArrayOfModel; + ArrayOfStringOption = arrayOfString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayArrayOfInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> ArrayArrayOfIntegerOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayOfInteger + /// + [JsonPropertyName("array_array_of_integer")] + public List>? ArrayArrayOfInteger { get { return this.ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } + + /// + /// Used to track the state of ArrayArrayOfModel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> ArrayArrayOfModelOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayOfModel + /// + [JsonPropertyName("array_array_of_model")] + public List>? ArrayArrayOfModel { get { return this.ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } + + /// + /// Used to track the state of ArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets ArrayOfString + /// + [JsonPropertyName("array_of_string")] + public List? ArrayOfString { get { return this.ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayTest {\n"); + sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n"); + sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append("\n"); + sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>?> arrayArrayOfInteger = default; + Option>?> arrayArrayOfModel = default; + Option?> arrayOfString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_array_of_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "array_array_of_model": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (arrayArrayOfInteger.IsSet && arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); + + if (arrayArrayOfModel.IsSet && arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); + + if (arrayOfString.IsSet && arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); + + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) + { + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + } + if (arrayTest.ArrayArrayOfModelOption.IsSet) + { + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + } + if (arrayTest.ArrayOfStringOption.IsSet) + { + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs new file mode 100644 index 000000000000..308d4078b7f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Banana.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Banana + /// + public partial class Banana : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lengthCm + [JsonConstructor] + public Banana(Option lengthCm = default) + { + LengthCmOption = lengthCm; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of LengthCm + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option LengthCmOption { get; private set; } + + /// + /// Gets or Sets LengthCm + /// + [JsonPropertyName("lengthCm")] + public decimal? LengthCm { get { return this.LengthCmOption; } set { this.LengthCmOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Banana {\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option lengthCm = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lengthCm": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + lengthCm = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); + + return new Banana(lengthCm); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, banana, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + if (banana.LengthCmOption.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs new file mode 100644 index 000000000000..46e11565b533 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BananaReq.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// BananaReq + /// + public partial class BananaReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lengthCm + /// sweet + [JsonConstructor] + public BananaReq(decimal lengthCm, Option sweet = default) + { + LengthCm = lengthCm; + SweetOption = sweet; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets LengthCm + /// + [JsonPropertyName("lengthCm")] + public decimal LengthCm { get; set; } + + /// + /// Used to track the state of Sweet + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SweetOption { get; private set; } + + /// + /// Gets or Sets Sweet + /// + [JsonPropertyName("sweet")] + public bool? Sweet { get { return this.SweetOption; } set { this.SweetOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BananaReq {\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); + sb.Append(" Sweet: ").Append(Sweet).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option lengthCm = default; + Option sweet = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lengthCm": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + lengthCm = new Option(utf8JsonReader.GetDecimal()); + break; + case "sweet": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + sweet = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!lengthCm.IsSet) + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); + + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); + + if (sweet.IsSet && sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + return new BananaReq(lengthCm.Value!.Value!, sweet); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, bananaReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + + if (bananaReq.SweetOption.IsSet) + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs new file mode 100644 index 000000000000..7eaeac5cde68 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/BasquePig.cs @@ -0,0 +1,171 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// BasquePig + /// + public partial class BasquePig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + [JsonConstructor] + public BasquePig(string className) + { + ClassName = className; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BasquePig {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BasquePigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + return new BasquePig(className.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, basquePig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) + { + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + + writer.WriteString("className", basquePig.ClassName); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs new file mode 100644 index 000000000000..133845a991f0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Capitalization.cs @@ -0,0 +1,322 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Capitalization + /// + public partial class Capitalization : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Name of the pet + /// capitalCamel + /// capitalSnake + /// sCAETHFlowPoints + /// smallCamel + /// smallSnake + [JsonConstructor] + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) + { + ATT_NAMEOption = aTTNAME; + CapitalCamelOption = capitalCamel; + CapitalSnakeOption = capitalSnake; + SCAETHFlowPointsOption = sCAETHFlowPoints; + SmallCamelOption = smallCamel; + SmallSnakeOption = smallSnake; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ATT_NAME + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ATT_NAMEOption { get; private set; } + + /// + /// Name of the pet + /// + /// Name of the pet + [JsonPropertyName("ATT_NAME")] + public string? ATT_NAME { get { return this.ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } + + /// + /// Used to track the state of CapitalCamel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CapitalCamelOption { get; private set; } + + /// + /// Gets or Sets CapitalCamel + /// + [JsonPropertyName("CapitalCamel")] + public string? CapitalCamel { get { return this.CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } + + /// + /// Used to track the state of CapitalSnake + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CapitalSnakeOption { get; private set; } + + /// + /// Gets or Sets CapitalSnake + /// + [JsonPropertyName("Capital_Snake")] + public string? CapitalSnake { get { return this.CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } + + /// + /// Used to track the state of SCAETHFlowPoints + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SCAETHFlowPointsOption { get; private set; } + + /// + /// Gets or Sets SCAETHFlowPoints + /// + [JsonPropertyName("SCA_ETH_Flow_Points")] + public string? SCAETHFlowPoints { get { return this.SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } + + /// + /// Used to track the state of SmallCamel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SmallCamelOption { get; private set; } + + /// + /// Gets or Sets SmallCamel + /// + [JsonPropertyName("smallCamel")] + public string? SmallCamel { get { return this.SmallCamelOption; } set { this.SmallCamelOption = new(value); } } + + /// + /// Used to track the state of SmallSnake + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SmallSnakeOption { get; private set; } + + /// + /// Gets or Sets SmallSnake + /// + [JsonPropertyName("small_Snake")] + public string? SmallSnake { get { return this.SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Capitalization {\n"); + sb.Append(" ATT_NAME: ").Append(ATT_NAME).Append("\n"); + sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n"); + sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n"); + sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n"); + sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n"); + sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class CapitalizationJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ATT_NAME": + aTTNAME = new Option(utf8JsonReader.GetString()!); + break; + case "CapitalCamel": + capitalCamel = new Option(utf8JsonReader.GetString()!); + break; + case "Capital_Snake": + capitalSnake = new Option(utf8JsonReader.GetString()!); + break; + case "SCA_ETH_Flow_Points": + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); + break; + case "smallCamel": + smallCamel = new Option(utf8JsonReader.GetString()!); + break; + case "small_Snake": + smallSnake = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (aTTNAME.IsSet && aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); + + if (capitalCamel.IsSet && capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); + + if (capitalSnake.IsSet && capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); + + if (sCAETHFlowPoints.IsSet && sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); + + if (smallCamel.IsSet && smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); + + if (smallSnake.IsSet && smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); + + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, capitalization, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) + { + if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + + if (capitalization.ATT_NAMEOption.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); + + if (capitalization.CapitalCamelOption.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); + + if (capitalization.CapitalSnakeOption.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); + + if (capitalization.SCAETHFlowPointsOption.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); + + if (capitalization.SmallCamelOption.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel); + + if (capitalization.SmallSnakeOption.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs new file mode 100644 index 000000000000..f6a4492730f4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Cat.cs @@ -0,0 +1,191 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Cat + /// + public partial class Cat : Animal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// color (default to "red") + /// declawed + [JsonConstructor] + public Cat(Option color = default, Option declawed = default) : base(color) + { + DeclawedOption = declawed; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string ClassName { get; } = "Cat"; + + /// + /// Used to track the state of Declawed + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeclawedOption { get; private set; } + + /// + /// Gets or Sets Declawed + /// + [JsonPropertyName("declawed")] + public bool? Declawed { get { return this.DeclawedOption; } set { this.DeclawedOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Cat {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class CatJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option color = default; + Option declawed = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + case "declawed": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + declawed = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Cat.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); + + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + + return new Cat(color, declawed); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, cat, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) + { + if (cat.ColorOption.IsSet && cat.Color == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + + writer.WriteString("className", cat.ClassName); + + if (cat.ColorOption.IsSet) + writer.WriteString("color", cat.Color); + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs new file mode 100644 index 000000000000..96854b6b0e4f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Category.cs @@ -0,0 +1,198 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Category + /// + public partial class Category : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + /// name (default to "default-name") + [JsonConstructor] + public Category(Option id = default, string name = @"default-name") + { + IdOption = id; + Name = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Category {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class CategoryJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!name.IsSet) + throw new ArgumentException("Property is required for class Category.", nameof(name)); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + return new Category(id, name.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, category, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) + { + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + + if (category.IdOption.IsSet) + writer.WriteNumber("id", category.IdOption.Value!.Value); + + writer.WriteString("name", category.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs new file mode 100644 index 000000000000..35e299d05c18 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ChildCat.cs @@ -0,0 +1,233 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ChildCat + /// + public partial class ChildCat : ParentPet, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public ChildCat(Option name = default) : base() + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines PetType + /// + public enum PetTypeEnum + { + /// + /// Enum ChildCat for value: ChildCat + /// + ChildCat = 1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static PetTypeEnum PetTypeEnumFromString(string value) + { + if (value.Equals("ChildCat")) + return PetTypeEnum.ChildCat; + + throw new NotImplementedException($"Could not convert value to type PetTypeEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static PetTypeEnum? PetTypeEnumFromStringOrDefault(string value) + { + if (value.Equals("ChildCat")) + return PetTypeEnum.ChildCat; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string PetTypeEnumToJsonValue(PetTypeEnum value) + { + if (value == PetTypeEnum.ChildCat) + return "ChildCat"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new PetTypeEnum PetType { get; } = (PetTypeEnum)Enum.Parse(typeof(PetTypeEnum), "ChildCat"); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ChildCat {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class ChildCatJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + Option petType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + case "pet_type": + string? petTypeRawValue = utf8JsonReader.GetString(); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ChildCat.", nameof(petType)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); + + return new ChildCat(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, childCat, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) + { + if (childCat.NameOption.IsSet && childCat.Name == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + + if (childCat.NameOption.IsSet) + writer.WriteString("name", childCat.Name); + + writer.WriteString("pet_type", ChildCat.PetTypeEnumToJsonValue(childCat.PetType)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs new file mode 100644 index 000000000000..5a199576ee29 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ClassModel.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model with \"_class\" property + /// + public partial class ClassModel : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// class + [JsonConstructor] + public ClassModel(Option @class = default) + { + ClassOption = @class; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Class + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ClassOption { get; private set; } + + /// + /// Gets or Sets Class + /// + [JsonPropertyName("_class")] + public string? Class { get { return this.ClassOption; } set { this.ClassOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ClassModel {\n"); + sb.Append(" Class: ").Append(Class).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ClassModelJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClass = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "_class": + varClass = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); + + return new ClassModel(varClass); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, classModel, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) + { + if (classModel.ClassOption.IsSet && classModel.Class == null) + throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + + if (classModel.ClassOption.IsSet) + writer.WriteString("_class", classModel.Class); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs new file mode 100644 index 000000000000..018f49af861f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -0,0 +1,195 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ComplexQuadrilateral + /// + public partial class ComplexQuadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + /// shapeType + [JsonConstructor] + public ComplexQuadrilateral(string quadrilateralType, string shapeType) + { + QuadrilateralType = quadrilateralType; + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ComplexQuadrilateral {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ComplexQuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()!); + break; + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, complexQuadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs new file mode 100644 index 000000000000..c0042b4d8843 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DanishPig.cs @@ -0,0 +1,171 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DanishPig + /// + public partial class DanishPig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + [JsonConstructor] + public DanishPig(string className) + { + ClassName = className; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DanishPig {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DanishPigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + return new DanishPig(className.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, danishPig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) + { + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + + writer.WriteString("className", danishPig.ClassName); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs new file mode 100644 index 000000000000..a84805aa8011 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -0,0 +1,180 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DateOnlyClass + /// + public partial class DateOnlyClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// dateOnlyProperty + [JsonConstructor] + public DateOnlyClass(Option dateOnlyProperty = default) + { + DateOnlyPropertyOption = dateOnlyProperty; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of DateOnlyProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateOnlyPropertyOption { get; private set; } + + /// + /// Gets or Sets DateOnlyProperty + /// + /* Fri Jul 21 00:00:00 UTC 2017 */ + [JsonPropertyName("dateOnlyProperty")] + public DateOnly? DateOnlyProperty { get { return this.DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DateOnlyClass {\n"); + sb.Append(" DateOnlyProperty: ").Append(DateOnlyProperty).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DateOnlyClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateOnlyProperty + /// + public static string DateOnlyPropertyFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option dateOnlyProperty = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "dateOnlyProperty": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); + + return new DateOnlyClass(dateOnlyProperty); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, dateOnlyClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) + { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs new file mode 100644 index 000000000000..68e0836b632f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DeprecatedObject + /// + public partial class DeprecatedObject : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public DeprecatedObject(Option name = default) + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeprecatedObject {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DeprecatedObjectJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); + + return new DeprecatedObject(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, deprecatedObject, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) + { + if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + + if (deprecatedObject.NameOption.IsSet) + writer.WriteString("name", deprecatedObject.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs new file mode 100644 index 000000000000..f09923475b0d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Dog.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Dog + /// + public partial class Dog : Animal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// breed + /// color (default to "red") + [JsonConstructor] + public Dog(Option breed = default, Option color = default) : base(color) + { + BreedOption = breed; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string ClassName { get; } = "Dog"; + + /// + /// Used to track the state of Breed + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BreedOption { get; private set; } + + /// + /// Gets or Sets Breed + /// + [JsonPropertyName("breed")] + public string? Breed { get { return this.BreedOption; } set { this.BreedOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Dog {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class DogJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option breed = default; + Option color = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()!); + break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Dog.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + + if (breed.IsSet && breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); + + return new Dog(breed, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, dog, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) + { + if (dog.BreedOption.IsSet && dog.Breed == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.ColorOption.IsSet && dog.Color == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + + writer.WriteString("className", dog.ClassName); + + if (dog.BreedOption.IsSet) + writer.WriteString("breed", dog.Breed); + + if (dog.ColorOption.IsSet) + writer.WriteString("color", dog.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs new file mode 100644 index 000000000000..837b5ef56bf3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Drawing.cs @@ -0,0 +1,270 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Drawing + /// + public partial class Drawing : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// mainShape + /// nullableShape + /// shapeOrNull + /// shapes + [JsonConstructor] + public Drawing(Option mainShape = default, Option nullableShape = default, Option shapeOrNull = default, Option?> shapes = default) + { + MainShapeOption = mainShape; + NullableShapeOption = nullableShape; + ShapeOrNullOption = shapeOrNull; + ShapesOption = shapes; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of MainShape + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MainShapeOption { get; private set; } + + /// + /// Gets or Sets MainShape + /// + [JsonPropertyName("mainShape")] + public Shape? MainShape { get { return this.MainShapeOption; } set { this.MainShapeOption = new(value); } } + + /// + /// Used to track the state of NullableShape + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NullableShapeOption { get; private set; } + + /// + /// Gets or Sets NullableShape + /// + [JsonPropertyName("nullableShape")] + public NullableShape? NullableShape { get { return this.NullableShapeOption; } set { this.NullableShapeOption = new(value); } } + + /// + /// Used to track the state of ShapeOrNull + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShapeOrNullOption { get; private set; } + + /// + /// Gets or Sets ShapeOrNull + /// + [JsonPropertyName("shapeOrNull")] + public ShapeOrNull? ShapeOrNull { get { return this.ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } + + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ShapesOption { get; private set; } + + /// + /// Gets or Sets Shapes + /// + [JsonPropertyName("shapes")] + public List? Shapes { get { return this.ShapesOption; } set { this.ShapesOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Drawing {\n"); + sb.Append(" MainShape: ").Append(MainShape).Append("\n"); + sb.Append(" NullableShape: ").Append(NullableShape).Append("\n"); + sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n"); + sb.Append(" Shapes: ").Append(Shapes).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DrawingJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option mainShape = default; + Option nullableShape = default; + Option shapeOrNull = default; + Option?> shapes = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "mainShape": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "nullableShape": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "shapeOrNull": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "shapes": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (mainShape.IsSet && mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); + + if (shapes.IsSet && shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); + + return new Drawing(mainShape, nullableShape, shapeOrNull, shapes); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, drawing, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) + { + if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.ShapesOption.IsSet && drawing.Shapes == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + + if (drawing.MainShapeOption.IsSet) + { + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + } + if (drawing.NullableShapeOption.IsSet) + if (drawing.NullableShapeOption.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNullOption.IsSet) + if (drawing.ShapeOrNullOption.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); + if (drawing.ShapesOption.IsSet) + { + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs new file mode 100644 index 000000000000..83efec82813d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -0,0 +1,339 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumArrays + /// + public partial class EnumArrays : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayEnum + /// justSymbol + [JsonConstructor] + public EnumArrays(Option?> arrayEnum = default, Option justSymbol = default) + { + ArrayEnumOption = arrayEnum; + JustSymbolOption = justSymbol; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines ArrayEnum + /// + public enum ArrayEnumEnum + { + /// + /// Enum Fish for value: fish + /// + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + Crab = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static ArrayEnumEnum ArrayEnumEnumFromString(string value) + { + if (value.Equals("fish")) + return ArrayEnumEnum.Fish; + + if (value.Equals("crab")) + return ArrayEnumEnum.Crab; + + throw new NotImplementedException($"Could not convert value to type ArrayEnumEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static ArrayEnumEnum? ArrayEnumEnumFromStringOrDefault(string value) + { + if (value.Equals("fish")) + return ArrayEnumEnum.Fish; + + if (value.Equals("crab")) + return ArrayEnumEnum.Crab; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum? value) + { + if (value == ArrayEnumEnum.Fish) + return "fish"; + + if (value == ArrayEnumEnum.Crab) + return "crab"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Defines JustSymbol + /// + public enum JustSymbolEnum + { + /// + /// Enum GreaterThanOrEqualTo for value: >= + /// + GreaterThanOrEqualTo = 1, + + /// + /// Enum Dollar for value: $ + /// + Dollar = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static JustSymbolEnum JustSymbolEnumFromString(string value) + { + if (value.Equals(">=")) + return JustSymbolEnum.GreaterThanOrEqualTo; + + if (value.Equals("$")) + return JustSymbolEnum.Dollar; + + throw new NotImplementedException($"Could not convert value to type JustSymbolEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static JustSymbolEnum? JustSymbolEnumFromStringOrDefault(string value) + { + if (value.Equals(">=")) + return JustSymbolEnum.GreaterThanOrEqualTo; + + if (value.Equals("$")) + return JustSymbolEnum.Dollar; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) + { + if (value == JustSymbolEnum.GreaterThanOrEqualTo) + return ">="; + + if (value == JustSymbolEnum.Dollar) + return "$"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of JustSymbol + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option JustSymbolOption { get; private set; } + + /// + /// Gets or Sets JustSymbol + /// + [JsonPropertyName("just_symbol")] + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } + + /// + /// Used to track the state of ArrayEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayEnumOption { get; private set; } + + /// + /// Gets or Sets ArrayEnum + /// + [JsonPropertyName("array_enum")] + public List? ArrayEnum { get { return this.ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EnumArrays {\n"); + sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EnumArraysJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> arrayEnum = default; + Option justSymbol = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_enum": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "just_symbol": + string? justSymbolRawValue = utf8JsonReader.GetString(); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); + break; + default: + break; + } + } + } + + if (arrayEnum.IsSet && arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); + + if (justSymbol.IsSet && justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); + + return new EnumArrays(arrayEnum, justSymbol); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, enumArrays, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) + { + if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + + if (enumArrays.ArrayEnumOption.IsSet) + { + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + } + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); + writer.WriteString("just_symbol", justSymbolRawValue); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumClass.cs new file mode 100644 index 000000000000..03b2780c4842 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumClass.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines EnumClass + /// + public enum EnumClass + { + /// + /// Enum Abc for value: _abc + /// + Abc = 1, + + /// + /// Enum Efg for value: -efg + /// + Efg = 2, + + /// + /// Enum Xyz for value: (xyz) + /// + Xyz = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class EnumClassValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EnumClass FromString(string value) + { + if (value.Equals("_abc")) + return EnumClass.Abc; + + if (value.Equals("-efg")) + return EnumClass.Efg; + + if (value.Equals("(xyz)")) + return EnumClass.Xyz; + + throw new NotImplementedException($"Could not convert value to type EnumClass: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EnumClass? FromStringOrDefault(string value) + { + if (value.Equals("_abc")) + return EnumClass.Abc; + + if (value.Equals("-efg")) + return EnumClass.Efg; + + if (value.Equals("(xyz)")) + return EnumClass.Xyz; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EnumClass value) + { + if (value == EnumClass.Abc) + return "_abc"; + + if (value == EnumClass.Efg) + return "-efg"; + + if (value == EnumClass.Xyz) + return "(xyz)"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EnumClassJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EnumClass Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + EnumClass? result = rawValue == null + ? null + : EnumClassValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EnumClass to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumClass enumClass, JsonSerializerOptions options) + { + writer.WriteStringValue(enumClass.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EnumClassNullableJsonConverter : JsonConverter + { + /// + /// Returns a EnumClass from the Json object + /// + /// + /// + /// + /// + public override EnumClass? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + EnumClass? result = rawValue == null + ? null + : EnumClassValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumClass? enumClass, JsonSerializerOptions options) + { + writer.WriteStringValue(enumClass?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs new file mode 100644 index 000000000000..204a7a95d7e3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EnumTest.cs @@ -0,0 +1,883 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumTest + /// + public partial class EnumTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// enumStringRequired + /// enumInteger + /// enumIntegerOnly + /// enumNumber + /// enumString + /// outerEnum + /// outerEnumDefaultValue + /// outerEnumInteger + /// outerEnumIntegerDefaultValue + [JsonConstructor] + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnum = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default) + { + EnumStringRequired = enumStringRequired; + EnumIntegerOption = enumInteger; + EnumIntegerOnlyOption = enumIntegerOnly; + EnumNumberOption = enumNumber; + EnumStringOption = enumString; + OuterEnumOption = outerEnum; + OuterEnumDefaultValueOption = outerEnumDefaultValue; + OuterEnumIntegerOption = outerEnumInteger; + OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } + + /// + /// Defines EnumInteger + /// + public enum EnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumIntegerEnum EnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return EnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return EnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type EnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumIntegerEnum? EnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return EnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return EnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of EnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumIntegerOption { get; private set; } + + /// + /// Gets or Sets EnumInteger + /// + [JsonPropertyName("enum_integer")] + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } + + /// + /// Defines EnumIntegerOnly + /// + public enum EnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumIntegerOnlyEnum EnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type EnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumIntegerOnlyEnum? EnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of EnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets EnumIntegerOnly + /// + [JsonPropertyName("enum_integer_only")] + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } + + /// + /// Defines EnumNumber + /// + public enum EnumNumberEnum + { + /// + /// Enum NUMBER_1_DOT_1 for value: 1.1 + /// + NUMBER_1_DOT_1 = 1, + + /// + /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 + /// + NUMBER_MINUS_1_DOT_2 = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumNumberEnum EnumNumberEnumFromString(string value) + { + if (value.Equals("1.1")) + return EnumNumberEnum.NUMBER_1_DOT_1; + + if (value.Equals("-1.2")) + return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; + + throw new NotImplementedException($"Could not convert value to type EnumNumberEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumNumberEnum? EnumNumberEnumFromStringOrDefault(string value) + { + if (value.Equals("1.1")) + return EnumNumberEnum.NUMBER_1_DOT_1; + + if (value.Equals("-1.2")) + return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) + { + if (value == EnumNumberEnum.NUMBER_1_DOT_1) + return 1.1; + + if (value == EnumNumberEnum.NUMBER_MINUS_1_DOT_2) + return -1.2; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of EnumNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumNumberOption { get; private set; } + + /// + /// Gets or Sets EnumNumber + /// + [JsonPropertyName("enum_number")] + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } + + /// + /// Defines EnumString + /// + public enum EnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringEnum EnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringEnum.Lower; + + if (value.Equals("")) + return EnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringEnum? EnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringEnum.Lower; + + if (value.Equals("")) + return EnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringEnumToJsonValue(EnumStringEnum? value) + { + if (value == EnumStringEnum.UPPER) + return "UPPER"; + + if (value == EnumStringEnum.Lower) + return "lower"; + + if (value == EnumStringEnum.Empty) + return ""; + + if (value == EnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of EnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumStringOption { get; private set; } + + /// + /// Gets or Sets EnumString + /// + [JsonPropertyName("enum_string")] + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } + + /// + /// Used to track the state of OuterEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumOption { get; private set; } + + /// + /// Gets or Sets OuterEnum + /// + [JsonPropertyName("outerEnum")] + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } + + /// + /// Used to track the state of OuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets OuterEnumDefaultValue + /// + [JsonPropertyName("outerEnumDefaultValue")] + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } + + /// + /// Used to track the state of OuterEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets OuterEnumInteger + /// + [JsonPropertyName("outerEnumInteger")] + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } + + /// + /// Used to track the state of OuterEnumIntegerDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumIntegerDefaultValueOption { get; private set; } + + /// + /// Gets or Sets OuterEnumIntegerDefaultValue + /// + [JsonPropertyName("outerEnumIntegerDefaultValue")] + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); + sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); + sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); + sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); + sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); + sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); + sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); + sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EnumTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnum = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "enum_string_required": + string? enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; + case "enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "enum_number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + break; + case "enum_string": + string? enumStringRawValue = utf8JsonReader.GetString(); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); + break; + case "outerEnum": + string? outerEnumRawValue = utf8JsonReader.GetString(); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + break; + case "outerEnumDefaultValue": + string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); + break; + case "outerEnumInteger": + string? outerEnumIntegerRawValue = utf8JsonReader.GetString(); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); + break; + case "outerEnumIntegerDefaultValue": + string? outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); + break; + default: + break; + } + } + } + + if (!enumStringRequired.IsSet) + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); + + if (enumStringRequired.IsSet && enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); + + if (enumInteger.IsSet && enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); + + if (enumIntegerOnly.IsSet && enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); + + if (enumNumber.IsSet && enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + + if (enumString.IsSet && enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); + + if (outerEnumDefaultValue.IsSet && outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); + + if (outerEnumInteger.IsSet && outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); + + if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + + return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnum, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, enumTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) + { + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); + writer.WriteString("enum_string_required", enumStringRequiredRawValue); + if (enumTest.EnumIntegerOption.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); + + if (enumTest.EnumIntegerOnlyOption.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); + + if (enumTest.EnumNumberOption.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); + + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); + writer.WriteString("enum_string", enumStringRawValue); + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption!.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); + writer.WriteString("outerEnum", outerEnumRawValue); + } + else + writer.WriteNull("outerEnum"); + if (enumTest.OuterEnumDefaultValueOption.IsSet) + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumIntegerOption.IsSet) + { + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) + { + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs new file mode 100644 index 000000000000..12983d68a09f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -0,0 +1,195 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EquilateralTriangle + /// + public partial class EquilateralTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public EquilateralTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EquilateralTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EquilateralTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, equilateralTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + + writer.WriteString("triangleType", equilateralTriangle.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 000000000000..dab2e4e27b36 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/File.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + public partial class File : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization + [JsonConstructor] + public File(Option sourceURI = default) + { + SourceURIOption = sourceURI; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of SourceURI + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SourceURIOption { get; private set; } + + /// + /// Test capitalization + /// + /// Test capitalization + [JsonPropertyName("sourceURI")] + public string? SourceURI { get { return this.SourceURIOption; } set { this.SourceURIOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FileJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option sourceURI = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "sourceURI": + sourceURI = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (sourceURI.IsSet && sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); + + return new File(sourceURI); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, file, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) + { + if (file.SourceURIOption.IsSet && file.SourceURI == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + + if (file.SourceURIOption.IsSet) + writer.WriteString("sourceURI", file.SourceURI); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 000000000000..7b9bfd4fbeb6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,212 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + public partial class FileSchemaTestClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// file + /// files + [JsonConstructor] + public FileSchemaTestClass(Option file = default, Option?> files = default) + { + FileOption = file; + FilesOption = files; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of File + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FileOption { get; private set; } + + /// + /// Gets or Sets File + /// + [JsonPropertyName("file")] + public File? File { get { return this.FileOption; } set { this.FileOption = new(value); } } + + /// + /// Used to track the state of Files + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> FilesOption { get; private set; } + + /// + /// Gets or Sets Files + /// + [JsonPropertyName("files")] + public List? Files { get { return this.FilesOption; } set { this.FilesOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FileSchemaTestClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option file = default; + Option?> files = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "file": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "files": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); + + if (files.IsSet && files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); + + return new FileSchemaTestClass(file, files); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fileSchemaTestClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) + { + if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FileOption.IsSet) + { + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + } + if (fileSchemaTestClass.FilesOption.IsSet) + { + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs new file mode 100644 index 000000000000..b8128f4c3e45 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Foo.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Foo + /// + public partial class Foo : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar (default to "bar") + [JsonConstructor] + public Foo(Option bar = default) + { + BarOption = bar; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; private set; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string? Bar { get { return this.BarOption; } set { this.BarOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Foo {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FooJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); + + return new Foo(bar); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, foo, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) + { + if (foo.BarOption.IsSet && foo.Bar == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + + if (foo.BarOption.IsSet) + writer.WriteString("bar", foo.Bar); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 000000000000..3c5e2512bb04 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,180 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + public partial class FooGetDefaultResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// string + [JsonConstructor] + public FooGetDefaultResponse(Option @string = default) + { + StringOption = @string; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public Foo? String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FooGetDefaultResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); + + return new FooGetDefaultResponse(varString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fooGetDefaultResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + + if (fooGetDefaultResponse.StringOption.IsSet) + { + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.String, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs new file mode 100644 index 000000000000..5244065820ea --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FormatTest.cs @@ -0,0 +1,971 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FormatTest + /// + public partial class FormatTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// byte + /// date + /// number + /// password + /// binary + /// dateTime + /// decimal + /// double + /// float + /// int32 + /// int32Range + /// int64 + /// int64Negative + /// int64NegativeExclusive + /// int64Positive + /// int64PositiveExclusive + /// integer + /// None + /// A string that is a 10 digit number. Can have leading zeros. + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// string + /// unsignedInteger + /// unsignedLong + /// uuid + [JsonConstructor] + public FormatTest(byte[] @byte, DateOnly date, decimal number, string password, Option binary = default, Option dateTime = default, Option @decimal = default, Option @double = default, Option @float = default, Option int32 = default, Option int32Range = default, Option int64 = default, Option int64Negative = default, Option int64NegativeExclusive = default, Option int64Positive = default, Option int64PositiveExclusive = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option @string = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) + { + Byte = @byte; + Date = date; + Number = number; + Password = password; + BinaryOption = binary; + DateTimeOption = dateTime; + DecimalOption = @decimal; + DoubleOption = @double; + FloatOption = @float; + Int32Option = int32; + Int32RangeOption = int32Range; + Int64Option = int64; + Int64NegativeOption = int64Negative; + Int64NegativeExclusiveOption = int64NegativeExclusive; + Int64PositiveOption = int64Positive; + Int64PositiveExclusiveOption = int64PositiveExclusive; + IntegerOption = integer; + PatternWithBackslashOption = patternWithBackslash; + PatternWithDigitsOption = patternWithDigits; + PatternWithDigitsAndDelimiterOption = patternWithDigitsAndDelimiter; + StringOption = @string; + UnsignedIntegerOption = unsignedInteger; + UnsignedLongOption = unsignedLong; + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Byte + /// + [JsonPropertyName("byte")] + public byte[] Byte { get; set; } + + /// + /// Gets or Sets Date + /// + /* Sun Feb 02 00:00:00 UTC 2020 */ + [JsonPropertyName("date")] + public DateOnly Date { get; set; } + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } + + /// + /// Used to track the state of Binary + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BinaryOption { get; private set; } + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream? Binary { get { return this.BinaryOption; } set { this.BinaryOption = new(value); } } + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateTimeOption { get; private set; } + + /// + /// Gets or Sets DateTime + /// + /* 2007-12-03T10:15:30+01:00 */ + [JsonPropertyName("dateTime")] + public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new(value); } } + + /// + /// Used to track the state of Decimal + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DecimalOption { get; private set; } + + /// + /// Gets or Sets Decimal + /// + [JsonPropertyName("decimal")] + public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new(value); } } + + /// + /// Used to track the state of Double + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DoubleOption { get; private set; } + + /// + /// Gets or Sets Double + /// + [JsonPropertyName("double")] + public double? Double { get { return this.DoubleOption; } set { this.DoubleOption = new(value); } } + + /// + /// Used to track the state of Float + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FloatOption { get; private set; } + + /// + /// Gets or Sets Float + /// + [JsonPropertyName("float")] + public float? Float { get { return this.FloatOption; } set { this.FloatOption = new(value); } } + + /// + /// Used to track the state of Int32 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int32Option { get; private set; } + + /// + /// Gets or Sets Int32 + /// + [JsonPropertyName("int32")] + public int? Int32 { get { return this.Int32Option; } set { this.Int32Option = new(value); } } + + /// + /// Used to track the state of Int32Range + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int32RangeOption { get; private set; } + + /// + /// Gets or Sets Int32Range + /// + [JsonPropertyName("int32Range")] + public int? Int32Range { get { return this.Int32RangeOption; } set { this.Int32RangeOption = new(value); } } + + /// + /// Used to track the state of Int64 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64Option { get; private set; } + + /// + /// Gets or Sets Int64 + /// + [JsonPropertyName("int64")] + public long? Int64 { get { return this.Int64Option; } set { this.Int64Option = new(value); } } + + /// + /// Used to track the state of Int64Negative + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64NegativeOption { get; private set; } + + /// + /// Gets or Sets Int64Negative + /// + [JsonPropertyName("int64Negative")] + public long? Int64Negative { get { return this.Int64NegativeOption; } set { this.Int64NegativeOption = new(value); } } + + /// + /// Used to track the state of Int64NegativeExclusive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64NegativeExclusiveOption { get; private set; } + + /// + /// Gets or Sets Int64NegativeExclusive + /// + [JsonPropertyName("int64NegativeExclusive")] + public long? Int64NegativeExclusive { get { return this.Int64NegativeExclusiveOption; } set { this.Int64NegativeExclusiveOption = new(value); } } + + /// + /// Used to track the state of Int64Positive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64PositiveOption { get; private set; } + + /// + /// Gets or Sets Int64Positive + /// + [JsonPropertyName("int64Positive")] + public long? Int64Positive { get { return this.Int64PositiveOption; } set { this.Int64PositiveOption = new(value); } } + + /// + /// Used to track the state of Int64PositiveExclusive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64PositiveExclusiveOption { get; private set; } + + /// + /// Gets or Sets Int64PositiveExclusive + /// + [JsonPropertyName("int64PositiveExclusive")] + public long? Int64PositiveExclusive { get { return this.Int64PositiveExclusiveOption; } set { this.Int64PositiveExclusiveOption = new(value); } } + + /// + /// Used to track the state of Integer + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntegerOption { get; private set; } + + /// + /// Gets or Sets Integer + /// + [JsonPropertyName("integer")] + public int? Integer { get { return this.IntegerOption; } set { this.IntegerOption = new(value); } } + + /// + /// Used to track the state of PatternWithBackslash + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithBackslashOption { get; private set; } + + /// + /// None + /// + /// None + [JsonPropertyName("pattern_with_backslash")] + public string? PatternWithBackslash { get { return this.PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } + + /// + /// Used to track the state of PatternWithDigits + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithDigitsOption { get; private set; } + + /// + /// A string that is a 10 digit number. Can have leading zeros. + /// + /// A string that is a 10 digit number. Can have leading zeros. + [JsonPropertyName("pattern_with_digits")] + public string? PatternWithDigits { get { return this.PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } + + /// + /// Used to track the state of PatternWithDigitsAndDelimiter + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithDigitsAndDelimiterOption { get; private set; } + + /// + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + [JsonPropertyName("pattern_with_digits_and_delimiter")] + public string? PatternWithDigitsAndDelimiter { get { return this.PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public string? String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Used to track the state of UnsignedInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsignedIntegerOption { get; private set; } + + /// + /// Gets or Sets UnsignedInteger + /// + [JsonPropertyName("unsigned_integer")] + public uint? UnsignedInteger { get { return this.UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } + + /// + /// Used to track the state of UnsignedLong + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsignedLongOption { get; private set; } + + /// + /// Gets or Sets UnsignedLong + /// + [JsonPropertyName("unsigned_long")] + public ulong? UnsignedLong { get { return this.UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FormatTest {\n"); + sb.Append(" Byte: ").Append(Byte).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Decimal: ").Append(Decimal).Append("\n"); + sb.Append(" Double: ").Append(Double).Append("\n"); + sb.Append(" Float: ").Append(Float).Append("\n"); + sb.Append(" Int32: ").Append(Int32).Append("\n"); + sb.Append(" Int32Range: ").Append(Int32Range).Append("\n"); + sb.Append(" Int64: ").Append(Int64).Append("\n"); + sb.Append(" Int64Negative: ").Append(Int64Negative).Append("\n"); + sb.Append(" Int64NegativeExclusive: ").Append(Int64NegativeExclusive).Append("\n"); + sb.Append(" Int64Positive: ").Append(Int64Positive).Append("\n"); + sb.Append(" Int64PositiveExclusive: ").Append(Int64PositiveExclusive).Append("\n"); + sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); + sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); + sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" UnsignedInteger: ").Append(UnsignedInteger).Append("\n"); + sb.Append(" UnsignedLong: ").Append(UnsignedLong).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + // Double (double) maximum + if (this.DoubleOption.IsSet && this.DoubleOption.Value > (double)123.4) + { + yield return new ValidationResult("Invalid value for Double, must be a value less than or equal to 123.4.", new [] { "Double" }); + } + + // Double (double) minimum + if (this.DoubleOption.IsSet && this.DoubleOption.Value < (double)67.8) + { + yield return new ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); + } + + // Float (float) maximum + if (this.FloatOption.IsSet && this.FloatOption.Value > (float)987.6) + { + yield return new ValidationResult("Invalid value for Float, must be a value less than or equal to 987.6.", new [] { "Float" }); + } + + // Float (float) minimum + if (this.FloatOption.IsSet && this.FloatOption.Value < (float)54.3) + { + yield return new ValidationResult("Invalid value for Float, must be a value greater than or equal to 54.3.", new [] { "Float" }); + } + + // Int32 (int) maximum + if (this.Int32Option.IsSet && this.Int32Option.Value > (int)200) + { + yield return new ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); + } + + // Int32 (int) minimum + if (this.Int32Option.IsSet && this.Int32Option.Value < (int)20) + { + yield return new ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); + } + + // Int32Range (int) maximum + if (this.Int32RangeOption.IsSet && this.Int32RangeOption.Value > (int)2147483647) + { + yield return new ValidationResult("Invalid value for Int32Range, must be a value less than or equal to 2147483647.", new [] { "Int32Range" }); + } + + // Int32Range (int) minimum + if (this.Int32RangeOption.IsSet && this.Int32RangeOption.Value < (int)-2147483648) + { + yield return new ValidationResult("Invalid value for Int32Range, must be a value greater than or equal to -2147483648.", new [] { "Int32Range" }); + } + + // Int64Negative (long) maximum + if (this.Int64NegativeOption.IsSet && this.Int64NegativeOption.Value > (long)-2147483649) + { + yield return new ValidationResult("Invalid value for Int64Negative, must be a value less than or equal to -2147483649.", new [] { "Int64Negative" }); + } + + // Int64NegativeExclusive (long) maximum + if (this.Int64NegativeExclusiveOption.IsSet && this.Int64NegativeExclusiveOption.Value <= (long)-2147483648) + { + yield return new ValidationResult("Invalid value for Int64NegativeExclusive, must be a value less than -2147483648.", new [] { "Int64NegativeExclusive" }); + } + + // Int64Positive (long) minimum + if (this.Int64PositiveOption.IsSet && this.Int64PositiveOption.Value < (long)2147483648) + { + yield return new ValidationResult("Invalid value for Int64Positive, must be a value greater than or equal to 2147483648.", new [] { "Int64Positive" }); + } + + // Int64PositiveExclusive (long) minimum + if (this.Int64PositiveExclusiveOption.IsSet && this.Int64PositiveExclusiveOption.Value < (long)2147483647) + { + yield return new ValidationResult("Invalid value for Int64PositiveExclusive, must be a value greater than 2147483647.", new [] { "Int64PositiveExclusive" }); + } + + // Integer (int) maximum + if (this.IntegerOption.IsSet && this.IntegerOption.Value > (int)100) + { + yield return new ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); + } + + // Integer (int) minimum + if (this.IntegerOption.IsSet && this.IntegerOption.Value < (int)10) + { + yield return new ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); + } + + if (this.PatternWithBackslashOption.Value != null) { + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + + if (this.PatternWithBackslashOption.Value != null &&!regexPatternWithBackslash.Match(this.PatternWithBackslashOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } + } + + if (this.PatternWithDigitsOption.Value != null) { + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + + if (this.PatternWithDigitsOption.Value != null &&!regexPatternWithDigits.Match(this.PatternWithDigitsOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } + } + + if (this.PatternWithDigitsAndDelimiterOption.Value != null) { + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.PatternWithDigitsAndDelimiterOption.Value != null &&!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiterOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } + } + + if (this.StringOption.Value != null) { + // String (string) pattern + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.StringOption.Value != null &&!regexString.Match(this.StringOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); + } + } + + // UnsignedInteger (uint) maximum + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value > (uint)200) + { + yield return new ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); + } + + // UnsignedInteger (uint) minimum + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value < (uint)20) + { + yield return new ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); + } + + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FormatTestJsonConverter : JsonConverter + { + /// + /// The format to use to serialize Date + /// + public static string DateFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize DateTime + /// + public static string DateTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int32Range = default; + Option int64 = default; + Option int64Negative = default; + Option int64NegativeExclusive = default; + Option int64Positive = default; + Option int64PositiveExclusive = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "byte": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "date": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + number = new Option(utf8JsonReader.GetDecimal()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()!); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "dateTime": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "decimal": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "double": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varDouble = new Option(utf8JsonReader.GetDouble()); + break; + case "float": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varFloat = new Option((float)utf8JsonReader.GetDouble()); + break; + case "int32": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int32 = new Option(utf8JsonReader.GetInt32()); + break; + case "int32Range": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int32Range = new Option(utf8JsonReader.GetInt32()); + break; + case "int64": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64 = new Option(utf8JsonReader.GetInt64()); + break; + case "int64Negative": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64Negative = new Option(utf8JsonReader.GetInt32()); + break; + case "int64NegativeExclusive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + break; + case "int64Positive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64Positive = new Option(utf8JsonReader.GetInt32()); + break; + case "int64PositiveExclusive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + break; + case "integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + integer = new Option(utf8JsonReader.GetInt32()); + break; + case "pattern_with_backslash": + patternWithBackslash = new Option(utf8JsonReader.GetString()!); + break; + case "pattern_with_digits": + patternWithDigits = new Option(utf8JsonReader.GetString()!); + break; + case "pattern_with_digits_and_delimiter": + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); + break; + case "string": + varString = new Option(utf8JsonReader.GetString()!); + break; + case "unsigned_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + break; + case "unsigned_long": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + unsignedLong = new Option(utf8JsonReader.GetUInt64()); + break; + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!varByte.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); + + if (!date.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); + + if (!number.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); + + if (!password.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); + + if (varByte.IsSet && varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); + + if (date.IsSet && date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); + + if (number.IsSet && number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); + + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); + + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); + + if (varDecimal.IsSet && varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + + if (varDouble.IsSet && varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + + if (varFloat.IsSet && varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + + if (int32.IsSet && int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + + if (int32Range.IsSet && int32Range.Value == null) + throw new ArgumentNullException(nameof(int32Range), "Property is not nullable for class FormatTest."); + + if (int64.IsSet && int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + + if (int64Negative.IsSet && int64Negative.Value == null) + throw new ArgumentNullException(nameof(int64Negative), "Property is not nullable for class FormatTest."); + + if (int64NegativeExclusive.IsSet && int64NegativeExclusive.Value == null) + throw new ArgumentNullException(nameof(int64NegativeExclusive), "Property is not nullable for class FormatTest."); + + if (int64Positive.IsSet && int64Positive.Value == null) + throw new ArgumentNullException(nameof(int64Positive), "Property is not nullable for class FormatTest."); + + if (int64PositiveExclusive.IsSet && int64PositiveExclusive.Value == null) + throw new ArgumentNullException(nameof(int64PositiveExclusive), "Property is not nullable for class FormatTest."); + + if (integer.IsSet && integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + + if (patternWithBackslash.IsSet && patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); + + if (patternWithDigits.IsSet && patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); + + if (patternWithDigitsAndDelimiter.IsSet && patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + + if (unsignedInteger.IsSet && unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + + if (unsignedLong.IsSet && unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + + return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int32Range, int64, int64Negative, int64NegativeExclusive, int64Positive, int64PositiveExclusive, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, formatTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) + { + if (formatTest.Byte == null) + throw new ArgumentNullException(nameof(formatTest.Byte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.StringOption.IsSet && formatTest.String == null) + throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + + writer.WritePropertyName("byte"); + JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + + writer.WriteNumber("number", formatTest.Number); + + writer.WriteString("password", formatTest.Password); + + if (formatTest.BinaryOption.IsSet) + { + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + } + if (formatTest.DateTimeOption.IsSet) + writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); + + if (formatTest.DecimalOption.IsSet) + { + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.Decimal, jsonSerializerOptions); + } + if (formatTest.DoubleOption.IsSet) + writer.WriteNumber("double", formatTest.DoubleOption.Value!.Value); + + if (formatTest.FloatOption.IsSet) + writer.WriteNumber("float", formatTest.FloatOption.Value!.Value); + + if (formatTest.Int32Option.IsSet) + writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); + + if (formatTest.Int32RangeOption.IsSet) + writer.WriteNumber("int32Range", formatTest.Int32RangeOption.Value!.Value); + + if (formatTest.Int64Option.IsSet) + writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); + + if (formatTest.Int64NegativeOption.IsSet) + writer.WriteNumber("int64Negative", formatTest.Int64NegativeOption.Value!.Value); + + if (formatTest.Int64NegativeExclusiveOption.IsSet) + writer.WriteNumber("int64NegativeExclusive", formatTest.Int64NegativeExclusiveOption.Value!.Value); + + if (formatTest.Int64PositiveOption.IsSet) + writer.WriteNumber("int64Positive", formatTest.Int64PositiveOption.Value!.Value); + + if (formatTest.Int64PositiveExclusiveOption.IsSet) + writer.WriteNumber("int64PositiveExclusive", formatTest.Int64PositiveExclusiveOption.Value!.Value); + + if (formatTest.IntegerOption.IsSet) + writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); + + if (formatTest.PatternWithBackslashOption.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); + + if (formatTest.PatternWithDigitsOption.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); + + if (formatTest.StringOption.IsSet) + writer.WriteString("string", formatTest.String); + + if (formatTest.UnsignedIntegerOption.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); + + if (formatTest.UnsignedLongOption.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); + + if (formatTest.UuidOption.IsSet) + writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs new file mode 100644 index 000000000000..eb12679ed27d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Fruit.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Fruit + /// + public partial class Fruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Apple apple, Option color = default) + { + Apple = apple; + ColorOption = color; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Banana banana, Option color = default) + { + Banana = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Apple + /// + public Apple? Apple { get; set; } + + /// + /// Gets or Sets Banana + /// + public Banana? Banana { get; set; } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Fruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple? apple = default; + Banana? banana = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + if (apple != null) + return new Fruit(apple, color); + + if (banana != null) + return new Fruit(banana, color); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FruitReq.cs new file mode 100644 index 000000000000..357be4388447 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/FruitReq.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FruitReq + /// + public partial class FruitReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public FruitReq(AppleReq appleReq) + { + AppleReq = appleReq; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FruitReq(BananaReq bananaReq) + { + BananaReq = bananaReq; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets AppleReq + /// + public AppleReq? AppleReq { get; set; } + + /// + /// Gets or Sets BananaReq + /// + public BananaReq? BananaReq { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FruitReq {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + AppleReq? appleReq = default; + BananaReq? bananaReq = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderAppleReq = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderAppleReq, jsonSerializerOptions, out appleReq); + + Utf8JsonReader utf8JsonReaderBananaReq = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBananaReq, jsonSerializerOptions, out bananaReq); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (appleReq != null) + return new FruitReq(appleReq); + + if (bananaReq != null) + return new FruitReq(bananaReq); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fruitReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs new file mode 100644 index 000000000000..9be524db707f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GmFruit.cs @@ -0,0 +1,237 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// GmFruit + /// + public partial class GmFruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// color + public GmFruit(Option apple, Option banana, Option color = default) + { + AppleOption = apple; + BananaOption = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AppleOption { get; private set; } + + /// + /// Gets or Sets Apple + /// + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BananaOption { get; private set; } + + /// + /// Gets or Sets Banana + /// + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GmFruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class GmFruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple? apple = default; + Banana? banana = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); + + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null) + { + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(writer, gmFruit.AppleOption.Value, jsonSerializerOptions); + } + + if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null) + { + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(writer, gmFruit.BananaOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, gmFruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) + { + if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + + if (gmFruit.ColorOption.IsSet) + writer.WriteString("color", gmFruit.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GrandparentAnimal.cs new file mode 100644 index 000000000000..4cefd4ca6216 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -0,0 +1,194 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// GrandparentAnimal + /// + public partial class GrandparentAnimal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructor] + public GrandparentAnimal() + { + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public string PetType { get; } = "GrandparentAnimal"; + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GrandparentAnimal {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class GrandparentAnimalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option petType = default; + + string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type"); + + if (discriminator != null && discriminator.Equals("ChildCat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + if (discriminator != null && discriminator.Equals("ParentPet")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pet_type": + petType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + return new GrandparentAnimal(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) + { + if (grandparentAnimal is ChildCat childCat){ + JsonSerializer.Serialize(writer, childCat, jsonSerializerOptions); + return; + } + + if (grandparentAnimal is ParentPet parentPet){ + JsonSerializer.Serialize(writer, parentPet, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, grandparentAnimal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("pet_type", grandparentAnimal.PetType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs new file mode 100644 index 000000000000..50826dd0da5d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -0,0 +1,246 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// HasOnlyReadOnly + /// + public partial class HasOnlyReadOnly : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar + /// foo + [JsonConstructor] + internal HasOnlyReadOnly(Option bar = default, Option foo = default) + { + BarOption = bar; + FooOption = foo; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string? Bar { get { return this.BarOption; } } + + /// + /// Used to track the state of Foo + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FooOption { get; } + + /// + /// Gets or Sets Foo + /// + [JsonPropertyName("foo")] + public string? Foo { get { return this.FooOption; } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HasOnlyReadOnly {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Foo: ").Append(Foo).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as HasOnlyReadOnly).AreEqual; + } + + /// + /// Returns true if HasOnlyReadOnly instances are equal + /// + /// Instance of HasOnlyReadOnly to be compared + /// Boolean + public bool Equals(HasOnlyReadOnly? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + if (Foo != null) + hashCode = (hashCode * 59) + Foo.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class HasOnlyReadOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + Option foo = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()!); + break; + case "foo": + foo = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); + + if (foo.IsSet && foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); + + return new HasOnlyReadOnly(bar, foo); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, hasOnlyReadOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.BarOption.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar); + + if (hasOnlyReadOnly.FooOption.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HealthCheckResult.cs new file mode 100644 index 000000000000..2a3a8e527f6e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -0,0 +1,173 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + /// + public partial class HealthCheckResult : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// nullableMessage + [JsonConstructor] + public HealthCheckResult(Option nullableMessage = default) + { + NullableMessageOption = nullableMessage; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of NullableMessage + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NullableMessageOption { get; private set; } + + /// + /// Gets or Sets NullableMessage + /// + [JsonPropertyName("NullableMessage")] + public string? NullableMessage { get { return this.NullableMessageOption; } set { this.NullableMessageOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HealthCheckResult {\n"); + sb.Append(" NullableMessage: ").Append(NullableMessage).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class HealthCheckResultJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option nullableMessage = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "NullableMessage": + nullableMessage = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + return new HealthCheckResult(nullableMessage); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, healthCheckResult, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) + { + if (healthCheckResult.NullableMessageOption.IsSet) + if (healthCheckResult.NullableMessageOption.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + else + writer.WriteNull("NullableMessage"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs new file mode 100644 index 000000000000..8aca45893e65 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// IsoscelesTriangle + /// + public partial class IsoscelesTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public IsoscelesTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IsoscelesTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class IsoscelesTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, isoscelesTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs new file mode 100644 index 000000000000..ddf0d615fd3c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/List.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// List + /// + public partial class List : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// var123List + [JsonConstructor] + public List(Option var123List = default) + { + Var123ListOption = var123List; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Var123List + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Var123ListOption { get; private set; } + + /// + /// Gets or Sets Var123List + /// + [JsonPropertyName("123-list")] + public string? Var123List { get { return this.Var123ListOption; } set { this.Var123ListOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class List {\n"); + sb.Append(" Var123List: ").Append(Var123List).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ListJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option var123List = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "123-list": + var123List = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (var123List.IsSet && var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); + + return new List(var123List); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, list, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) + { + if (list.Var123ListOption.IsSet && list.Var123List == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + + if (list.Var123ListOption.IsSet) + writer.WriteString("123-list", list.Var123List); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 000000000000..5993dd82adc8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -0,0 +1,205 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + public partial class LiteralStringClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username") + /// unescapedLiteralString (default to "C:\Users\username") + [JsonConstructor] + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) + { + EscapedLiteralStringOption = escapedLiteralString; + UnescapedLiteralStringOption = unescapedLiteralString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of EscapedLiteralString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EscapedLiteralStringOption { get; private set; } + + /// + /// Gets or Sets EscapedLiteralString + /// + [JsonPropertyName("escapedLiteralString")] + public string? EscapedLiteralString { get { return this.EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } + + /// + /// Used to track the state of UnescapedLiteralString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnescapedLiteralStringOption { get; private set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [JsonPropertyName("unescapedLiteralString")] + public string? UnescapedLiteralString { get { return this.UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class LiteralStringClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option escapedLiteralString = default; + Option unescapedLiteralString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "escapedLiteralString": + escapedLiteralString = new Option(utf8JsonReader.GetString()!); + break; + case "unescapedLiteralString": + unescapedLiteralString = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (escapedLiteralString.IsSet && escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, literalStringClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.EscapedLiteralStringOption.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Mammal.cs new file mode 100644 index 000000000000..132f1e462ce0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Mammal.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mammal + /// + public partial class Mammal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Whale whale) + { + Whale = whale; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Zebra zebra) + { + Zebra = zebra; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Pig pig) + { + Pig = pig; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Whale + /// + public Whale? Whale { get; set; } + + /// + /// Gets or Sets Zebra + /// + public Zebra? Zebra { get; set; } + + /// + /// Gets or Sets Pig + /// + public Pig? Pig { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Mammal {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MammalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + Pig? pig = null; + Whale? whale = null; + Zebra? zebra = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("className") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("Pig") ?? false) + { + Utf8JsonReader utf8JsonReaderPig = utf8JsonReader; + pig = JsonSerializer.Deserialize(ref utf8JsonReaderPig, jsonSerializerOptions); + } + if (discriminator?.Equals("whale") ?? false) + { + Utf8JsonReader utf8JsonReaderWhale = utf8JsonReader; + whale = JsonSerializer.Deserialize(ref utf8JsonReaderWhale, jsonSerializerOptions); + } + if (discriminator?.Equals("zebra") ?? false) + { + Utf8JsonReader utf8JsonReaderZebra = utf8JsonReader; + zebra = JsonSerializer.Deserialize(ref utf8JsonReaderZebra, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); + + if (pig != null) + return new Mammal(pig); + + if (whale != null) + return new Mammal(whale); + + if (zebra != null) + return new Mammal(zebra); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (mammal.Whale != null) + { + WhaleJsonConverter whaleJsonConverter = (WhaleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Whale.GetType())); + whaleJsonConverter.WriteProperties(writer, mammal.Whale, jsonSerializerOptions); + } + + if (mammal.Zebra != null) + { + ZebraJsonConverter zebraJsonConverter = (ZebraJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Zebra.GetType())); + zebraJsonConverter.WriteProperties(writer, mammal.Zebra, jsonSerializerOptions); + } + + if (mammal.Pig != null) + { + PigJsonConverter pigJsonConverter = (PigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Pig.GetType())); + pigJsonConverter.WriteProperties(writer, mammal.Pig, jsonSerializerOptions); + } + + WriteProperties(writer, mammal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs new file mode 100644 index 000000000000..bba52b3ffbce --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MapTest.cs @@ -0,0 +1,342 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MapTest + /// + public partial class MapTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// directMap + /// indirectMap + /// mapMapOfString + /// mapOfEnumString + [JsonConstructor] + public MapTest(Option?> directMap = default, Option?> indirectMap = default, Option>?> mapMapOfString = default, Option?> mapOfEnumString = default) + { + DirectMapOption = directMap; + IndirectMapOption = indirectMap; + MapMapOfStringOption = mapMapOfString; + MapOfEnumStringOption = mapOfEnumString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines Inner + /// + public enum InnerEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static InnerEnum InnerEnumFromString(string value) + { + if (value.Equals("UPPER")) + return InnerEnum.UPPER; + + if (value.Equals("lower")) + return InnerEnum.Lower; + + throw new NotImplementedException($"Could not convert value to type InnerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static InnerEnum? InnerEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return InnerEnum.UPPER; + + if (value.Equals("lower")) + return InnerEnum.Lower; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string InnerEnumToJsonValue(InnerEnum? value) + { + if (value == InnerEnum.UPPER) + return "UPPER"; + + if (value == InnerEnum.Lower) + return "lower"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of DirectMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> DirectMapOption { get; private set; } + + /// + /// Gets or Sets DirectMap + /// + [JsonPropertyName("direct_map")] + public Dictionary? DirectMap { get { return this.DirectMapOption; } set { this.DirectMapOption = new(value); } } + + /// + /// Used to track the state of IndirectMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> IndirectMapOption { get; private set; } + + /// + /// Gets or Sets IndirectMap + /// + [JsonPropertyName("indirect_map")] + public Dictionary? IndirectMap { get { return this.IndirectMapOption; } set { this.IndirectMapOption = new(value); } } + + /// + /// Used to track the state of MapMapOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> MapMapOfStringOption { get; private set; } + + /// + /// Gets or Sets MapMapOfString + /// + [JsonPropertyName("map_map_of_string")] + public Dictionary>? MapMapOfString { get { return this.MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } + + /// + /// Used to track the state of MapOfEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapOfEnumStringOption { get; private set; } + + /// + /// Gets or Sets MapOfEnumString + /// + [JsonPropertyName("map_of_enum_string")] + public Dictionary? MapOfEnumString { get { return this.MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MapTest {\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); + sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); + sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MapTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> directMap = default; + Option?> indirectMap = default; + Option>?> mapMapOfString = default; + Option?> mapOfEnumString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "direct_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "indirect_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_map_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_of_enum_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (directMap.IsSet && directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); + + if (indirectMap.IsSet && indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); + + if (mapMapOfString.IsSet && mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); + + if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); + + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mapTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) + { + if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + + if (mapTest.DirectMapOption.IsSet) + { + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + } + if (mapTest.IndirectMapOption.IsSet) + { + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + } + if (mapTest.MapMapOfStringOption.IsSet) + { + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + } + if (mapTest.MapOfEnumStringOption.IsSet) + { + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixLog.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixLog.cs new file mode 100644 index 000000000000..564d9aa1a810 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixLog.cs @@ -0,0 +1,1029 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixLog + /// + public partial class MixLog : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// description + /// formulaVersionDate + /// id + /// mixDate + /// totalOverPoors + /// totalRecalculations + /// totalSkips + /// totalUnderPours + /// batchNumber + /// BrandCode is only required for non-color mixes + /// BrandId is only required for color mixes + /// BrandName is only required for color mixes + /// CategoryCode is not used anymore + /// Color is only required for color mixes + /// colorDescription + /// comment + /// commercialProductCode + /// country + /// createdBy + /// createdByFirstName + /// createdByLastName + /// deltaECalculationRepaired + /// deltaECalculationSprayout + /// ownColorVariantNumber + /// primerProductId + /// ProductId is only required for color mixes + /// ProductLineCode is only required for color mixes + /// ProductName is only required for color mixes + /// selectedVersionIndex + /// shopId + /// SomeCode is only required for color mixes + /// totalPrice + [JsonConstructor] + public MixLog(string description, DateTime formulaVersionDate, Guid id, DateTime mixDate, int totalOverPoors, int totalRecalculations, int totalSkips, int totalUnderPours, Option batchNumber = default, Option brandCode = default, Option brandId = default, Option brandName = default, Option categoryCode = default, Option color = default, Option colorDescription = default, Option comment = default, Option commercialProductCode = default, Option country = default, Option createdBy = default, Option createdByFirstName = default, Option createdByLastName = default, Option deltaECalculationRepaired = default, Option deltaECalculationSprayout = default, Option ownColorVariantNumber = default, Option primerProductId = default, Option productId = default, Option productLineCode = default, Option productName = default, Option selectedVersionIndex = default, Option shopId = default, Option someCode = default, Option totalPrice = default) + { + Description = description; + FormulaVersionDate = formulaVersionDate; + Id = id; + MixDate = mixDate; + TotalOverPoors = totalOverPoors; + TotalRecalculations = totalRecalculations; + TotalSkips = totalSkips; + TotalUnderPours = totalUnderPours; + BatchNumberOption = batchNumber; + BrandCodeOption = brandCode; + BrandIdOption = brandId; + BrandNameOption = brandName; + CategoryCodeOption = categoryCode; + ColorOption = color; + ColorDescriptionOption = colorDescription; + CommentOption = comment; + CommercialProductCodeOption = commercialProductCode; + CountryOption = country; + CreatedByOption = createdBy; + CreatedByFirstNameOption = createdByFirstName; + CreatedByLastNameOption = createdByLastName; + DeltaECalculationRepairedOption = deltaECalculationRepaired; + DeltaECalculationSprayoutOption = deltaECalculationSprayout; + OwnColorVariantNumberOption = ownColorVariantNumber; + PrimerProductIdOption = primerProductId; + ProductIdOption = productId; + ProductLineCodeOption = productLineCode; + ProductNameOption = productName; + SelectedVersionIndexOption = selectedVersionIndex; + ShopIdOption = shopId; + SomeCodeOption = someCode; + TotalPriceOption = totalPrice; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Description + /// + [JsonPropertyName("description")] + public string Description { get; set; } + + /// + /// Gets or Sets FormulaVersionDate + /// + [JsonPropertyName("formulaVersionDate")] + public DateTime FormulaVersionDate { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Guid Id { get; set; } + + /// + /// Gets or Sets MixDate + /// + [JsonPropertyName("mixDate")] + public DateTime MixDate { get; set; } + + /// + /// Gets or Sets TotalOverPoors + /// + [JsonPropertyName("totalOverPoors")] + public int TotalOverPoors { get; set; } + + /// + /// Gets or Sets TotalRecalculations + /// + [JsonPropertyName("totalRecalculations")] + public int TotalRecalculations { get; set; } + + /// + /// Gets or Sets TotalSkips + /// + [JsonPropertyName("totalSkips")] + public int TotalSkips { get; set; } + + /// + /// Gets or Sets TotalUnderPours + /// + [JsonPropertyName("totalUnderPours")] + public int TotalUnderPours { get; set; } + + /// + /// Used to track the state of BatchNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BatchNumberOption { get; private set; } + + /// + /// Gets or Sets BatchNumber + /// + [JsonPropertyName("batchNumber")] + public string? BatchNumber { get { return this.BatchNumberOption; } set { this.BatchNumberOption = new(value); } } + + /// + /// Used to track the state of BrandCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandCodeOption { get; private set; } + + /// + /// BrandCode is only required for non-color mixes + /// + /// BrandCode is only required for non-color mixes + [JsonPropertyName("brandCode")] + public string? BrandCode { get { return this.BrandCodeOption; } set { this.BrandCodeOption = new(value); } } + + /// + /// Used to track the state of BrandId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandIdOption { get; private set; } + + /// + /// BrandId is only required for color mixes + /// + /// BrandId is only required for color mixes + [JsonPropertyName("brandId")] + public string? BrandId { get { return this.BrandIdOption; } set { this.BrandIdOption = new(value); } } + + /// + /// Used to track the state of BrandName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandNameOption { get; private set; } + + /// + /// BrandName is only required for color mixes + /// + /// BrandName is only required for color mixes + [JsonPropertyName("brandName")] + public string? BrandName { get { return this.BrandNameOption; } set { this.BrandNameOption = new(value); } } + + /// + /// Used to track the state of CategoryCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CategoryCodeOption { get; private set; } + + /// + /// CategoryCode is not used anymore + /// + /// CategoryCode is not used anymore + [JsonPropertyName("categoryCode")] + public string? CategoryCode { get { return this.CategoryCodeOption; } set { this.CategoryCodeOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Color is only required for color mixes + /// + /// Color is only required for color mixes + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Used to track the state of ColorDescription + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorDescriptionOption { get; private set; } + + /// + /// Gets or Sets ColorDescription + /// + [JsonPropertyName("colorDescription")] + public string? ColorDescription { get { return this.ColorDescriptionOption; } set { this.ColorDescriptionOption = new(value); } } + + /// + /// Used to track the state of Comment + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CommentOption { get; private set; } + + /// + /// Gets or Sets Comment + /// + [JsonPropertyName("comment")] + public string? Comment { get { return this.CommentOption; } set { this.CommentOption = new(value); } } + + /// + /// Used to track the state of CommercialProductCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CommercialProductCodeOption { get; private set; } + + /// + /// Gets or Sets CommercialProductCode + /// + [JsonPropertyName("commercialProductCode")] + public string? CommercialProductCode { get { return this.CommercialProductCodeOption; } set { this.CommercialProductCodeOption = new(value); } } + + /// + /// Used to track the state of Country + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CountryOption { get; private set; } + + /// + /// Gets or Sets Country + /// + [JsonPropertyName("country")] + public string? Country { get { return this.CountryOption; } set { this.CountryOption = new(value); } } + + /// + /// Used to track the state of CreatedBy + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByOption { get; private set; } + + /// + /// Gets or Sets CreatedBy + /// + [JsonPropertyName("createdBy")] + public string? CreatedBy { get { return this.CreatedByOption; } set { this.CreatedByOption = new(value); } } + + /// + /// Used to track the state of CreatedByFirstName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByFirstNameOption { get; private set; } + + /// + /// Gets or Sets CreatedByFirstName + /// + [JsonPropertyName("createdByFirstName")] + public string? CreatedByFirstName { get { return this.CreatedByFirstNameOption; } set { this.CreatedByFirstNameOption = new(value); } } + + /// + /// Used to track the state of CreatedByLastName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByLastNameOption { get; private set; } + + /// + /// Gets or Sets CreatedByLastName + /// + [JsonPropertyName("createdByLastName")] + public string? CreatedByLastName { get { return this.CreatedByLastNameOption; } set { this.CreatedByLastNameOption = new(value); } } + + /// + /// Used to track the state of DeltaECalculationRepaired + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeltaECalculationRepairedOption { get; private set; } + + /// + /// Gets or Sets DeltaECalculationRepaired + /// + [JsonPropertyName("deltaECalculationRepaired")] + public string? DeltaECalculationRepaired { get { return this.DeltaECalculationRepairedOption; } set { this.DeltaECalculationRepairedOption = new(value); } } + + /// + /// Used to track the state of DeltaECalculationSprayout + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeltaECalculationSprayoutOption { get; private set; } + + /// + /// Gets or Sets DeltaECalculationSprayout + /// + [JsonPropertyName("deltaECalculationSprayout")] + public string? DeltaECalculationSprayout { get { return this.DeltaECalculationSprayoutOption; } set { this.DeltaECalculationSprayoutOption = new(value); } } + + /// + /// Used to track the state of OwnColorVariantNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OwnColorVariantNumberOption { get; private set; } + + /// + /// Gets or Sets OwnColorVariantNumber + /// + [JsonPropertyName("ownColorVariantNumber")] + public int? OwnColorVariantNumber { get { return this.OwnColorVariantNumberOption; } set { this.OwnColorVariantNumberOption = new(value); } } + + /// + /// Used to track the state of PrimerProductId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PrimerProductIdOption { get; private set; } + + /// + /// Gets or Sets PrimerProductId + /// + [JsonPropertyName("primerProductId")] + public string? PrimerProductId { get { return this.PrimerProductIdOption; } set { this.PrimerProductIdOption = new(value); } } + + /// + /// Used to track the state of ProductId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductIdOption { get; private set; } + + /// + /// ProductId is only required for color mixes + /// + /// ProductId is only required for color mixes + [JsonPropertyName("productId")] + public string? ProductId { get { return this.ProductIdOption; } set { this.ProductIdOption = new(value); } } + + /// + /// Used to track the state of ProductLineCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductLineCodeOption { get; private set; } + + /// + /// ProductLineCode is only required for color mixes + /// + /// ProductLineCode is only required for color mixes + [JsonPropertyName("productLineCode")] + public string? ProductLineCode { get { return this.ProductLineCodeOption; } set { this.ProductLineCodeOption = new(value); } } + + /// + /// Used to track the state of ProductName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductNameOption { get; private set; } + + /// + /// ProductName is only required for color mixes + /// + /// ProductName is only required for color mixes + [JsonPropertyName("productName")] + public string? ProductName { get { return this.ProductNameOption; } set { this.ProductNameOption = new(value); } } + + /// + /// Used to track the state of SelectedVersionIndex + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SelectedVersionIndexOption { get; private set; } + + /// + /// Gets or Sets SelectedVersionIndex + /// + [JsonPropertyName("selectedVersionIndex")] + public int? SelectedVersionIndex { get { return this.SelectedVersionIndexOption; } set { this.SelectedVersionIndexOption = new(value); } } + + /// + /// Used to track the state of ShopId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShopIdOption { get; private set; } + + /// + /// Gets or Sets ShopId + /// + [JsonPropertyName("shopId")] + public Guid? ShopId { get { return this.ShopIdOption; } set { this.ShopIdOption = new(value); } } + + /// + /// Used to track the state of SomeCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SomeCodeOption { get; private set; } + + /// + /// SomeCode is only required for color mixes + /// + /// SomeCode is only required for color mixes + [JsonPropertyName("someCode")] + public string? SomeCode { get { return this.SomeCodeOption; } set { this.SomeCodeOption = new(value); } } + + /// + /// Used to track the state of TotalPrice + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TotalPriceOption { get; private set; } + + /// + /// Gets or Sets TotalPrice + /// + [JsonPropertyName("totalPrice")] + public float? TotalPrice { get { return this.TotalPriceOption; } set { this.TotalPriceOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixLog {\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" FormulaVersionDate: ").Append(FormulaVersionDate).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" MixDate: ").Append(MixDate).Append("\n"); + sb.Append(" TotalOverPoors: ").Append(TotalOverPoors).Append("\n"); + sb.Append(" TotalRecalculations: ").Append(TotalRecalculations).Append("\n"); + sb.Append(" TotalSkips: ").Append(TotalSkips).Append("\n"); + sb.Append(" TotalUnderPours: ").Append(TotalUnderPours).Append("\n"); + sb.Append(" BatchNumber: ").Append(BatchNumber).Append("\n"); + sb.Append(" BrandCode: ").Append(BrandCode).Append("\n"); + sb.Append(" BrandId: ").Append(BrandId).Append("\n"); + sb.Append(" BrandName: ").Append(BrandName).Append("\n"); + sb.Append(" CategoryCode: ").Append(CategoryCode).Append("\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" ColorDescription: ").Append(ColorDescription).Append("\n"); + sb.Append(" Comment: ").Append(Comment).Append("\n"); + sb.Append(" CommercialProductCode: ").Append(CommercialProductCode).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append(" CreatedBy: ").Append(CreatedBy).Append("\n"); + sb.Append(" CreatedByFirstName: ").Append(CreatedByFirstName).Append("\n"); + sb.Append(" CreatedByLastName: ").Append(CreatedByLastName).Append("\n"); + sb.Append(" DeltaECalculationRepaired: ").Append(DeltaECalculationRepaired).Append("\n"); + sb.Append(" DeltaECalculationSprayout: ").Append(DeltaECalculationSprayout).Append("\n"); + sb.Append(" OwnColorVariantNumber: ").Append(OwnColorVariantNumber).Append("\n"); + sb.Append(" PrimerProductId: ").Append(PrimerProductId).Append("\n"); + sb.Append(" ProductId: ").Append(ProductId).Append("\n"); + sb.Append(" ProductLineCode: ").Append(ProductLineCode).Append("\n"); + sb.Append(" ProductName: ").Append(ProductName).Append("\n"); + sb.Append(" SelectedVersionIndex: ").Append(SelectedVersionIndex).Append("\n"); + sb.Append(" ShopId: ").Append(ShopId).Append("\n"); + sb.Append(" SomeCode: ").Append(SomeCode).Append("\n"); + sb.Append(" TotalPrice: ").Append(TotalPrice).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixLogJsonConverter : JsonConverter + { + /// + /// The format to use to serialize FormulaVersionDate + /// + public static string FormulaVersionDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize MixDate + /// + public static string MixDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixLog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option description = default; + Option formulaVersionDate = default; + Option id = default; + Option mixDate = default; + Option totalOverPoors = default; + Option totalRecalculations = default; + Option totalSkips = default; + Option totalUnderPours = default; + Option batchNumber = default; + Option brandCode = default; + Option brandId = default; + Option brandName = default; + Option categoryCode = default; + Option color = default; + Option colorDescription = default; + Option comment = default; + Option commercialProductCode = default; + Option country = default; + Option createdBy = default; + Option createdByFirstName = default; + Option createdByLastName = default; + Option deltaECalculationRepaired = default; + Option deltaECalculationSprayout = default; + Option ownColorVariantNumber = default; + Option primerProductId = default; + Option productId = default; + Option productLineCode = default; + Option productName = default; + Option selectedVersionIndex = default; + Option shopId = default; + Option someCode = default; + Option totalPrice = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "description": + description = new Option(utf8JsonReader.GetString()!); + break; + case "formulaVersionDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + formulaVersionDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetGuid()); + break; + case "mixDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mixDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "totalOverPoors": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalOverPoors = new Option(utf8JsonReader.GetInt32()); + break; + case "totalRecalculations": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalRecalculations = new Option(utf8JsonReader.GetInt32()); + break; + case "totalSkips": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalSkips = new Option(utf8JsonReader.GetInt32()); + break; + case "totalUnderPours": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalUnderPours = new Option(utf8JsonReader.GetInt32()); + break; + case "batchNumber": + batchNumber = new Option(utf8JsonReader.GetString()!); + break; + case "brandCode": + brandCode = new Option(utf8JsonReader.GetString()!); + break; + case "brandId": + brandId = new Option(utf8JsonReader.GetString()!); + break; + case "brandName": + brandName = new Option(utf8JsonReader.GetString()!); + break; + case "categoryCode": + categoryCode = new Option(utf8JsonReader.GetString()!); + break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + case "colorDescription": + colorDescription = new Option(utf8JsonReader.GetString()!); + break; + case "comment": + comment = new Option(utf8JsonReader.GetString()!); + break; + case "commercialProductCode": + commercialProductCode = new Option(utf8JsonReader.GetString()!); + break; + case "country": + country = new Option(utf8JsonReader.GetString()!); + break; + case "createdBy": + createdBy = new Option(utf8JsonReader.GetString()!); + break; + case "createdByFirstName": + createdByFirstName = new Option(utf8JsonReader.GetString()!); + break; + case "createdByLastName": + createdByLastName = new Option(utf8JsonReader.GetString()!); + break; + case "deltaECalculationRepaired": + deltaECalculationRepaired = new Option(utf8JsonReader.GetString()!); + break; + case "deltaECalculationSprayout": + deltaECalculationSprayout = new Option(utf8JsonReader.GetString()!); + break; + case "ownColorVariantNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + ownColorVariantNumber = new Option(utf8JsonReader.GetInt32()); + break; + case "primerProductId": + primerProductId = new Option(utf8JsonReader.GetString()!); + break; + case "productId": + productId = new Option(utf8JsonReader.GetString()!); + break; + case "productLineCode": + productLineCode = new Option(utf8JsonReader.GetString()!); + break; + case "productName": + productName = new Option(utf8JsonReader.GetString()!); + break; + case "selectedVersionIndex": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + selectedVersionIndex = new Option(utf8JsonReader.GetInt32()); + break; + case "shopId": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shopId = new Option(utf8JsonReader.GetGuid()); + break; + case "someCode": + someCode = new Option(utf8JsonReader.GetString()); + break; + case "totalPrice": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalPrice = new Option((float)utf8JsonReader.GetDouble()); + break; + default: + break; + } + } + } + + if (!description.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(description)); + + if (!formulaVersionDate.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(formulaVersionDate)); + + if (!id.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(id)); + + if (!mixDate.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(mixDate)); + + if (!totalOverPoors.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalOverPoors)); + + if (!totalRecalculations.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalRecalculations)); + + if (!totalSkips.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalSkips)); + + if (!totalUnderPours.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalUnderPours)); + + if (description.IsSet && description.Value == null) + throw new ArgumentNullException(nameof(description), "Property is not nullable for class MixLog."); + + if (formulaVersionDate.IsSet && formulaVersionDate.Value == null) + throw new ArgumentNullException(nameof(formulaVersionDate), "Property is not nullable for class MixLog."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixLog."); + + if (mixDate.IsSet && mixDate.Value == null) + throw new ArgumentNullException(nameof(mixDate), "Property is not nullable for class MixLog."); + + if (totalOverPoors.IsSet && totalOverPoors.Value == null) + throw new ArgumentNullException(nameof(totalOverPoors), "Property is not nullable for class MixLog."); + + if (totalRecalculations.IsSet && totalRecalculations.Value == null) + throw new ArgumentNullException(nameof(totalRecalculations), "Property is not nullable for class MixLog."); + + if (totalSkips.IsSet && totalSkips.Value == null) + throw new ArgumentNullException(nameof(totalSkips), "Property is not nullable for class MixLog."); + + if (totalUnderPours.IsSet && totalUnderPours.Value == null) + throw new ArgumentNullException(nameof(totalUnderPours), "Property is not nullable for class MixLog."); + + if (batchNumber.IsSet && batchNumber.Value == null) + throw new ArgumentNullException(nameof(batchNumber), "Property is not nullable for class MixLog."); + + if (brandCode.IsSet && brandCode.Value == null) + throw new ArgumentNullException(nameof(brandCode), "Property is not nullable for class MixLog."); + + if (brandId.IsSet && brandId.Value == null) + throw new ArgumentNullException(nameof(brandId), "Property is not nullable for class MixLog."); + + if (brandName.IsSet && brandName.Value == null) + throw new ArgumentNullException(nameof(brandName), "Property is not nullable for class MixLog."); + + if (categoryCode.IsSet && categoryCode.Value == null) + throw new ArgumentNullException(nameof(categoryCode), "Property is not nullable for class MixLog."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class MixLog."); + + if (colorDescription.IsSet && colorDescription.Value == null) + throw new ArgumentNullException(nameof(colorDescription), "Property is not nullable for class MixLog."); + + if (comment.IsSet && comment.Value == null) + throw new ArgumentNullException(nameof(comment), "Property is not nullable for class MixLog."); + + if (commercialProductCode.IsSet && commercialProductCode.Value == null) + throw new ArgumentNullException(nameof(commercialProductCode), "Property is not nullable for class MixLog."); + + if (country.IsSet && country.Value == null) + throw new ArgumentNullException(nameof(country), "Property is not nullable for class MixLog."); + + if (createdBy.IsSet && createdBy.Value == null) + throw new ArgumentNullException(nameof(createdBy), "Property is not nullable for class MixLog."); + + if (createdByFirstName.IsSet && createdByFirstName.Value == null) + throw new ArgumentNullException(nameof(createdByFirstName), "Property is not nullable for class MixLog."); + + if (createdByLastName.IsSet && createdByLastName.Value == null) + throw new ArgumentNullException(nameof(createdByLastName), "Property is not nullable for class MixLog."); + + if (deltaECalculationRepaired.IsSet && deltaECalculationRepaired.Value == null) + throw new ArgumentNullException(nameof(deltaECalculationRepaired), "Property is not nullable for class MixLog."); + + if (deltaECalculationSprayout.IsSet && deltaECalculationSprayout.Value == null) + throw new ArgumentNullException(nameof(deltaECalculationSprayout), "Property is not nullable for class MixLog."); + + if (primerProductId.IsSet && primerProductId.Value == null) + throw new ArgumentNullException(nameof(primerProductId), "Property is not nullable for class MixLog."); + + if (productId.IsSet && productId.Value == null) + throw new ArgumentNullException(nameof(productId), "Property is not nullable for class MixLog."); + + if (productLineCode.IsSet && productLineCode.Value == null) + throw new ArgumentNullException(nameof(productLineCode), "Property is not nullable for class MixLog."); + + if (productName.IsSet && productName.Value == null) + throw new ArgumentNullException(nameof(productName), "Property is not nullable for class MixLog."); + + if (selectedVersionIndex.IsSet && selectedVersionIndex.Value == null) + throw new ArgumentNullException(nameof(selectedVersionIndex), "Property is not nullable for class MixLog."); + + if (shopId.IsSet && shopId.Value == null) + throw new ArgumentNullException(nameof(shopId), "Property is not nullable for class MixLog."); + + return new MixLog(description.Value!, formulaVersionDate.Value!.Value!, id.Value!.Value!, mixDate.Value!.Value!, totalOverPoors.Value!.Value!, totalRecalculations.Value!.Value!, totalSkips.Value!.Value!, totalUnderPours.Value!.Value!, batchNumber, brandCode, brandId, brandName, categoryCode, color, colorDescription, comment, commercialProductCode, country, createdBy, createdByFirstName, createdByLastName, deltaECalculationRepaired, deltaECalculationSprayout, ownColorVariantNumber, primerProductId, productId, productLineCode, productName, selectedVersionIndex, shopId, someCode, totalPrice); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixLog, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions) + { + if (mixLog.Description == null) + throw new ArgumentNullException(nameof(mixLog.Description), "Property is required for class MixLog."); + + if (mixLog.BatchNumberOption.IsSet && mixLog.BatchNumber == null) + throw new ArgumentNullException(nameof(mixLog.BatchNumber), "Property is required for class MixLog."); + + if (mixLog.BrandCodeOption.IsSet && mixLog.BrandCode == null) + throw new ArgumentNullException(nameof(mixLog.BrandCode), "Property is required for class MixLog."); + + if (mixLog.BrandIdOption.IsSet && mixLog.BrandId == null) + throw new ArgumentNullException(nameof(mixLog.BrandId), "Property is required for class MixLog."); + + if (mixLog.BrandNameOption.IsSet && mixLog.BrandName == null) + throw new ArgumentNullException(nameof(mixLog.BrandName), "Property is required for class MixLog."); + + if (mixLog.CategoryCodeOption.IsSet && mixLog.CategoryCode == null) + throw new ArgumentNullException(nameof(mixLog.CategoryCode), "Property is required for class MixLog."); + + if (mixLog.ColorOption.IsSet && mixLog.Color == null) + throw new ArgumentNullException(nameof(mixLog.Color), "Property is required for class MixLog."); + + if (mixLog.ColorDescriptionOption.IsSet && mixLog.ColorDescription == null) + throw new ArgumentNullException(nameof(mixLog.ColorDescription), "Property is required for class MixLog."); + + if (mixLog.CommentOption.IsSet && mixLog.Comment == null) + throw new ArgumentNullException(nameof(mixLog.Comment), "Property is required for class MixLog."); + + if (mixLog.CommercialProductCodeOption.IsSet && mixLog.CommercialProductCode == null) + throw new ArgumentNullException(nameof(mixLog.CommercialProductCode), "Property is required for class MixLog."); + + if (mixLog.CountryOption.IsSet && mixLog.Country == null) + throw new ArgumentNullException(nameof(mixLog.Country), "Property is required for class MixLog."); + + if (mixLog.CreatedByOption.IsSet && mixLog.CreatedBy == null) + throw new ArgumentNullException(nameof(mixLog.CreatedBy), "Property is required for class MixLog."); + + if (mixLog.CreatedByFirstNameOption.IsSet && mixLog.CreatedByFirstName == null) + throw new ArgumentNullException(nameof(mixLog.CreatedByFirstName), "Property is required for class MixLog."); + + if (mixLog.CreatedByLastNameOption.IsSet && mixLog.CreatedByLastName == null) + throw new ArgumentNullException(nameof(mixLog.CreatedByLastName), "Property is required for class MixLog."); + + if (mixLog.DeltaECalculationRepairedOption.IsSet && mixLog.DeltaECalculationRepaired == null) + throw new ArgumentNullException(nameof(mixLog.DeltaECalculationRepaired), "Property is required for class MixLog."); + + if (mixLog.DeltaECalculationSprayoutOption.IsSet && mixLog.DeltaECalculationSprayout == null) + throw new ArgumentNullException(nameof(mixLog.DeltaECalculationSprayout), "Property is required for class MixLog."); + + if (mixLog.PrimerProductIdOption.IsSet && mixLog.PrimerProductId == null) + throw new ArgumentNullException(nameof(mixLog.PrimerProductId), "Property is required for class MixLog."); + + if (mixLog.ProductIdOption.IsSet && mixLog.ProductId == null) + throw new ArgumentNullException(nameof(mixLog.ProductId), "Property is required for class MixLog."); + + if (mixLog.ProductLineCodeOption.IsSet && mixLog.ProductLineCode == null) + throw new ArgumentNullException(nameof(mixLog.ProductLineCode), "Property is required for class MixLog."); + + if (mixLog.ProductNameOption.IsSet && mixLog.ProductName == null) + throw new ArgumentNullException(nameof(mixLog.ProductName), "Property is required for class MixLog."); + + writer.WriteString("description", mixLog.Description); + + writer.WriteString("formulaVersionDate", mixLog.FormulaVersionDate.ToString(FormulaVersionDateFormat)); + + writer.WriteString("id", mixLog.Id); + + writer.WriteString("mixDate", mixLog.MixDate.ToString(MixDateFormat)); + + writer.WriteNumber("totalOverPoors", mixLog.TotalOverPoors); + + writer.WriteNumber("totalRecalculations", mixLog.TotalRecalculations); + + writer.WriteNumber("totalSkips", mixLog.TotalSkips); + + writer.WriteNumber("totalUnderPours", mixLog.TotalUnderPours); + + if (mixLog.BatchNumberOption.IsSet) + writer.WriteString("batchNumber", mixLog.BatchNumber); + + if (mixLog.BrandCodeOption.IsSet) + writer.WriteString("brandCode", mixLog.BrandCode); + + if (mixLog.BrandIdOption.IsSet) + writer.WriteString("brandId", mixLog.BrandId); + + if (mixLog.BrandNameOption.IsSet) + writer.WriteString("brandName", mixLog.BrandName); + + if (mixLog.CategoryCodeOption.IsSet) + writer.WriteString("categoryCode", mixLog.CategoryCode); + + if (mixLog.ColorOption.IsSet) + writer.WriteString("color", mixLog.Color); + + if (mixLog.ColorDescriptionOption.IsSet) + writer.WriteString("colorDescription", mixLog.ColorDescription); + + if (mixLog.CommentOption.IsSet) + writer.WriteString("comment", mixLog.Comment); + + if (mixLog.CommercialProductCodeOption.IsSet) + writer.WriteString("commercialProductCode", mixLog.CommercialProductCode); + + if (mixLog.CountryOption.IsSet) + writer.WriteString("country", mixLog.Country); + + if (mixLog.CreatedByOption.IsSet) + writer.WriteString("createdBy", mixLog.CreatedBy); + + if (mixLog.CreatedByFirstNameOption.IsSet) + writer.WriteString("createdByFirstName", mixLog.CreatedByFirstName); + + if (mixLog.CreatedByLastNameOption.IsSet) + writer.WriteString("createdByLastName", mixLog.CreatedByLastName); + + if (mixLog.DeltaECalculationRepairedOption.IsSet) + writer.WriteString("deltaECalculationRepaired", mixLog.DeltaECalculationRepaired); + + if (mixLog.DeltaECalculationSprayoutOption.IsSet) + writer.WriteString("deltaECalculationSprayout", mixLog.DeltaECalculationSprayout); + + if (mixLog.OwnColorVariantNumberOption.IsSet) + if (mixLog.OwnColorVariantNumberOption.Value != null) + writer.WriteNumber("ownColorVariantNumber", mixLog.OwnColorVariantNumberOption.Value!.Value); + else + writer.WriteNull("ownColorVariantNumber"); + + if (mixLog.PrimerProductIdOption.IsSet) + writer.WriteString("primerProductId", mixLog.PrimerProductId); + + if (mixLog.ProductIdOption.IsSet) + writer.WriteString("productId", mixLog.ProductId); + + if (mixLog.ProductLineCodeOption.IsSet) + writer.WriteString("productLineCode", mixLog.ProductLineCode); + + if (mixLog.ProductNameOption.IsSet) + writer.WriteString("productName", mixLog.ProductName); + + if (mixLog.SelectedVersionIndexOption.IsSet) + writer.WriteNumber("selectedVersionIndex", mixLog.SelectedVersionIndexOption.Value!.Value); + + if (mixLog.ShopIdOption.IsSet) + writer.WriteString("shopId", mixLog.ShopIdOption.Value!.Value); + + if (mixLog.SomeCodeOption.IsSet) + if (mixLog.SomeCodeOption.Value != null) + writer.WriteString("someCode", mixLog.SomeCode); + else + writer.WriteNull("someCode"); + + if (mixLog.TotalPriceOption.IsSet) + if (mixLog.TotalPriceOption.Value != null) + writer.WriteNumber("totalPrice", mixLog.TotalPriceOption.Value!.Value); + else + writer.WriteNull("totalPrice"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs new file mode 100644 index 000000000000..ac4b562eb3e7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -0,0 +1,180 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedAnyOf + /// + public partial class MixedAnyOf : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// content + [JsonConstructor] + public MixedAnyOf(Option content = default) + { + ContentOption = content; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Content + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ContentOption { get; private set; } + + /// + /// Gets or Sets Content + /// + [JsonPropertyName("content")] + public MixedAnyOfContent? Content { get { return this.ContentOption; } set { this.ContentOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedAnyOf {\n"); + sb.Append(" Content: ").Append(Content).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedAnyOfJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option content = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "content": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (content.IsSet && content.Value == null) + throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedAnyOf."); + + return new MixedAnyOf(content); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedAnyOf, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) + throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + + if (mixedAnyOf.ContentOption.IsSet) + { + writer.WritePropertyName("content"); + JsonSerializer.Serialize(writer, mixedAnyOf.Content, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs new file mode 100644 index 000000000000..05de563f77d7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs @@ -0,0 +1,285 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mixed anyOf types for testing + /// + public partial class MixedAnyOfContent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + public MixedAnyOfContent(Option @string, Option @bool, Option @int, Option @decimal, Option mixedSubId) + { + StringOption = @string; + BoolOption = @bool; + IntOption = @int; + DecimalOption = @decimal; + MixedSubIdOption = mixedSubId; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + public string? String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Used to track the state of Bool + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BoolOption { get; private set; } + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get { return this.BoolOption; } set { this.BoolOption = new(value); } } + + /// + /// Used to track the state of Int + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntOption { get; private set; } + + /// + /// Gets or Sets Int + /// + public int? Int { get { return this.IntOption; } set { this.IntOption = new(value); } } + + /// + /// Used to track the state of Decimal + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DecimalOption { get; private set; } + + /// + /// Gets or Sets Decimal + /// + public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new(value); } } + + /// + /// Used to track the state of MixedSubId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MixedSubIdOption { get; private set; } + + /// + /// Gets or Sets MixedSubId + /// + public MixedSubId? MixedSubId { get { return this.MixedSubIdOption; } set { this.MixedSubIdOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedAnyOfContent {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedAnyOfContentJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedAnyOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string? varString = default; + bool? varBool = default; + int? varInt = default; + decimal? varDecimal = default; + MixedSubId? mixedSubId = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderInt = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt); + + Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal); + + Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + Option varStringParsedValue = varString == null + ? default + : new Option(varString); + Option varBoolParsedValue = varBool == null + ? default + : new Option(varBool); + Option varIntParsedValue = varInt == null + ? default + : new Option(varInt); + Option varDecimalParsedValue = varDecimal == null + ? default + : new Option(varDecimal); + Option mixedSubIdParsedValue = mixedSubId == null + ? default + : new Option(mixedSubId); + + return new MixedAnyOfContent(varStringParsedValue, varBoolParsedValue, varIntParsedValue, varDecimalParsedValue, mixedSubIdParsedValue); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (mixedAnyOfContent.StringOption.IsSet && mixedAnyOfContent.StringOption.Value != null) + writer.WriteString("content", mixedAnyOfContent.StringOption.Value); + + if (mixedAnyOfContent.BoolOption.IsSet && mixedAnyOfContent.BoolOption.Value != null) + writer.WriteBoolean("content", mixedAnyOfContent.BoolOption.Value.Value); + + if (mixedAnyOfContent.IntOption.IsSet && mixedAnyOfContent.IntOption.Value != null) + writer.WriteNumber("content", mixedAnyOfContent.IntOption.Value.Value); + + if (mixedAnyOfContent.DecimalOption.IsSet && mixedAnyOfContent.DecimalOption.Value != null) + writer.WriteNumber("content", mixedAnyOfContent.DecimalOption.Value.Value); + + if (mixedAnyOfContent.MixedSubIdOption.IsSet && mixedAnyOfContent.MixedSubIdOption.Value != null) + { + MixedSubIdJsonConverter MixedSubIdJsonConverter = (MixedSubIdJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mixedAnyOfContent.MixedSubIdOption.Value.GetType())); + MixedSubIdJsonConverter.WriteProperties(writer, mixedAnyOfContent.MixedSubIdOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, mixedAnyOfContent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs new file mode 100644 index 000000000000..7a8da4dbed10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -0,0 +1,180 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedOneOf + /// + public partial class MixedOneOf : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// content + [JsonConstructor] + public MixedOneOf(Option content = default) + { + ContentOption = content; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Content + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ContentOption { get; private set; } + + /// + /// Gets or Sets Content + /// + [JsonPropertyName("content")] + public MixedOneOfContent? Content { get { return this.ContentOption; } set { this.ContentOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedOneOf {\n"); + sb.Append(" Content: ").Append(Content).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedOneOfJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option content = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "content": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (content.IsSet && content.Value == null) + throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedOneOf."); + + return new MixedOneOf(content); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedOneOf, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) + throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + + if (mixedOneOf.ContentOption.IsSet) + { + writer.WritePropertyName("content"); + JsonSerializer.Serialize(writer, mixedOneOf.Content, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOfContent.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOfContent.cs new file mode 100644 index 000000000000..15e011ce0918 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedOneOfContent.cs @@ -0,0 +1,263 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mixed oneOf types for testing + /// + public partial class MixedOneOfContent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(string @string) + { + String = @string; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(bool @bool) + { + Bool = @bool; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(int @int) + { + Int = @int; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(decimal @decimal) + { + Decimal = @decimal; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(MixedSubId mixedSubId) + { + MixedSubId = mixedSubId; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets String + /// + public string? String { get; set; } + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get; set; } + + /// + /// Gets or Sets Int + /// + public int? Int { get; set; } + + /// + /// Gets or Sets Decimal + /// + public decimal? Decimal { get; set; } + + /// + /// Gets or Sets MixedSubId + /// + public MixedSubId? MixedSubId { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedOneOfContent {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedOneOfContentJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedOneOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string? varString = default; + bool? varBool = default; + int? varInt = default; + decimal? varDecimal = default; + MixedSubId? mixedSubId = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderInt = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt); + + Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal); + + Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varString != null) + return new MixedOneOfContent(varString); + + if (varBool != null) + return new MixedOneOfContent(varBool.Value); + + if (varInt != null) + return new MixedOneOfContent(varInt.Value); + + if (varDecimal != null) + return new MixedOneOfContent(varDecimal.Value); + + if (mixedSubId != null) + return new MixedOneOfContent(mixedSubId); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedOneOfContent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs new file mode 100644 index 000000000000..17ee15eb2f4d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedPropertiesAndAdditionalPropertiesClass + /// + public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// dateTime + /// map + /// uuid + /// uuidWithPattern + [JsonConstructor] + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option?> map = default, Option uuid = default, Option uuidWithPattern = default) + { + DateTimeOption = dateTime; + MapOption = map; + UuidOption = uuid; + UuidWithPatternOption = uuidWithPattern; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateTimeOption { get; private set; } + + /// + /// Gets or Sets DateTime + /// + [JsonPropertyName("dateTime")] + public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new(value); } } + + /// + /// Used to track the state of Map + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapOption { get; private set; } + + /// + /// Gets or Sets Map + /// + [JsonPropertyName("map")] + public Dictionary? Map { get { return this.MapOption; } set { this.MapOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Used to track the state of UuidWithPattern + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidWithPatternOption { get; private set; } + + /// + /// Gets or Sets UuidWithPattern + /// + [JsonPropertyName("uuid_with_pattern")] + public Guid? UuidWithPattern { get { return this.UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Map: ").Append(Map).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" UuidWithPattern: ").Append(UuidWithPattern).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + + if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()!).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedPropertiesAndAdditionalPropertiesClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateTime + /// + public static string DateTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option dateTime = default; + Option?> map = default; + Option uuid = default; + Option uuidWithPattern = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "dateTime": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + case "uuid_with_pattern": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (map.IsSet && map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedPropertiesAndAdditionalPropertiesClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); + + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) + { + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + } + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs new file mode 100644 index 000000000000..6b56e6017b15 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedSubId + /// + public partial class MixedSubId : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + [JsonConstructor] + public MixedSubId(Option id = default) + { + IdOption = id; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public string? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedSubId {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedSubIdJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedSubId Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + id = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixedSubId."); + + return new MixedSubId(id); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedSubId, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) + throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + + if (mixedSubId.IdOption.IsSet) + writer.WriteString("id", mixedSubId.Id); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs new file mode 100644 index 000000000000..bb28841a9e57 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Model200Response.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name starting with number + /// + public partial class Model200Response : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// class + /// name + [JsonConstructor] + public Model200Response(Option @class = default, Option name = default) + { + ClassOption = @class; + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Class + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ClassOption { get; private set; } + + /// + /// Gets or Sets Class + /// + [JsonPropertyName("class")] + public string? Class { get { return this.ClassOption; } set { this.ClassOption = new(value); } } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public int? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Model200Response {\n"); + sb.Append(" Class: ").Append(Class).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class Model200ResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClass = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "class": + varClass = new Option(utf8JsonReader.GetString()!); + break; + case "name": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + name = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); + + return new Model200Response(varClass, name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, model200Response, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) + { + if (model200Response.ClassOption.IsSet && model200Response.Class == null) + throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + + if (model200Response.ClassOption.IsSet) + writer.WriteString("class", model200Response.Class); + + if (model200Response.NameOption.IsSet) + writer.WriteNumber("name", model200Response.NameOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs new file mode 100644 index 000000000000..7a982b8104d3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ModelClient.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ModelClient + /// + public partial class ModelClient : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varClient + [JsonConstructor] + public ModelClient(Option varClient = default) + { + VarClientOption = varClient; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of VarClient + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarClientOption { get; private set; } + + /// + /// Gets or Sets VarClient + /// + [JsonPropertyName("client")] + public string? VarClient { get { return this.VarClientOption; } set { this.VarClientOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ModelClient {\n"); + sb.Append(" VarClient: ").Append(VarClient).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ModelClientJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClient = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "client": + varClient = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (varClient.IsSet && varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); + + return new ModelClient(varClient); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, modelClient, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) + { + if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + + if (modelClient.VarClientOption.IsSet) + writer.WriteString("client", modelClient.VarClient); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs new file mode 100644 index 000000000000..fb877759c605 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Name.cs @@ -0,0 +1,293 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name same as property name + /// + public partial class Name : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varName + /// property + /// snakeCase + /// var123Number + [JsonConstructor] + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) + { + VarName = varName; + PropertyOption = property; + SnakeCaseOption = snakeCase; + Var123NumberOption = var123Number; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets VarName + /// + [JsonPropertyName("name")] + public int VarName { get; set; } + + /// + /// Used to track the state of Property + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PropertyOption { get; private set; } + + /// + /// Gets or Sets Property + /// + [JsonPropertyName("property")] + public string? Property { get { return this.PropertyOption; } set { this.PropertyOption = new(value); } } + + /// + /// Used to track the state of SnakeCase + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SnakeCaseOption { get; } + + /// + /// Gets or Sets SnakeCase + /// + [JsonPropertyName("snake_case")] + public int? SnakeCase { get { return this.SnakeCaseOption; } } + + /// + /// Used to track the state of Var123Number + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Var123NumberOption { get; } + + /// + /// Gets or Sets Var123Number + /// + [JsonPropertyName("123Number")] + public int? Var123Number { get { return this.Var123NumberOption; } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Name {\n"); + sb.Append(" VarName: ").Append(VarName).Append("\n"); + sb.Append(" Property: ").Append(Property).Append("\n"); + sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); + sb.Append(" Var123Number: ").Append(Var123Number).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as Name).AreEqual; + } + + /// + /// Returns true if Name instances are equal + /// + /// Instance of Name to be compared + /// Boolean + public bool Equals(Name? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (SnakeCase != null) + hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); + + if (Var123Number != null) + hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NameJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varName = new Option(utf8JsonReader.GetInt32()); + break; + case "property": + property = new Option(utf8JsonReader.GetString()!); + break; + case "snake_case": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + snakeCase = new Option(utf8JsonReader.GetInt32()); + break; + case "123Number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + var123Number = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (!varName.IsSet) + throw new ArgumentException("Property is required for class Name.", nameof(varName)); + + if (varName.IsSet && varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); + + if (property.IsSet && property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); + + if (snakeCase.IsSet && snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); + + if (var123Number.IsSet && var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); + + return new Name(varName.Value!.Value!, property, snakeCase, var123Number); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, name, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) + { + if (name.PropertyOption.IsSet && name.Property == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + + writer.WriteNumber("name", name.VarName); + + if (name.PropertyOption.IsSet) + writer.WriteString("property", name.Property); + + if (name.SnakeCaseOption.IsSet) + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); + + if (name.Var123NumberOption.IsSet) + writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs new file mode 100644 index 000000000000..f7e59fb345ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -0,0 +1,194 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NotificationtestGetElementsV1ResponseMPayload + /// + public partial class NotificationtestGetElementsV1ResponseMPayload : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// aObjVariableobject + /// pkiNotificationtestID + [JsonConstructor] + public NotificationtestGetElementsV1ResponseMPayload(List> aObjVariableobject, int pkiNotificationtestID) + { + AObjVariableobject = aObjVariableobject; + PkiNotificationtestID = pkiNotificationtestID; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets AObjVariableobject + /// + [JsonPropertyName("a_objVariableobject")] + public List> AObjVariableobject { get; set; } + + /// + /// Gets or Sets PkiNotificationtestID + /// + [JsonPropertyName("pkiNotificationtestID")] + public int PkiNotificationtestID { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NotificationtestGetElementsV1ResponseMPayload {\n"); + sb.Append(" AObjVariableobject: ").Append(AObjVariableobject).Append("\n"); + sb.Append(" PkiNotificationtestID: ").Append(PkiNotificationtestID).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NotificationtestGetElementsV1ResponseMPayloadJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>?> aObjVariableobject = default; + Option pkiNotificationtestID = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "a_objVariableobject": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "pkiNotificationtestID": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (!aObjVariableobject.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); + + if (!pkiNotificationtestID.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); + + if (aObjVariableobject.IsSet && aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, notificationtestGetElementsV1ResponseMPayload, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) + { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + + writer.WritePropertyName("a_objVariableobject"); + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs new file mode 100644 index 000000000000..91695a8649d6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableClass.cs @@ -0,0 +1,498 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NullableClass + /// + public partial class NullableClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayAndItemsNullableProp + /// arrayItemsNullable + /// arrayNullableProp + /// booleanProp + /// dateProp + /// datetimeProp + /// integerProp + /// numberProp + /// objectAndItemsNullableProp + /// objectItemsNullable + /// objectNullableProp + /// stringProp + [JsonConstructor] + public NullableClass(Option?> arrayAndItemsNullableProp = default, Option?> arrayItemsNullable = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectItemsNullable = default, Option?> objectNullableProp = default, Option stringProp = default) + { + ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayItemsNullableOption = arrayItemsNullable; + ArrayNullablePropOption = arrayNullableProp; + BooleanPropOption = booleanProp; + DatePropOption = dateProp; + DatetimePropOption = datetimeProp; + IntegerPropOption = integerProp; + NumberPropOption = numberProp; + ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectItemsNullableOption = objectItemsNullable; + ObjectNullablePropOption = objectNullableProp; + StringPropOption = stringProp; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayAndItemsNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayAndItemsNullablePropOption { get; private set; } + + /// + /// Gets or Sets ArrayAndItemsNullableProp + /// + [JsonPropertyName("array_and_items_nullable_prop")] + public List? ArrayAndItemsNullableProp { get { return this.ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } + + /// + /// Used to track the state of ArrayItemsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ArrayItemsNullable + /// + [JsonPropertyName("array_items_nullable")] + public List? ArrayItemsNullable { get { return this.ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } + + /// + /// Used to track the state of ArrayNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayNullablePropOption { get; private set; } + + /// + /// Gets or Sets ArrayNullableProp + /// + [JsonPropertyName("array_nullable_prop")] + public List? ArrayNullableProp { get { return this.ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } + + /// + /// Used to track the state of BooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BooleanPropOption { get; private set; } + + /// + /// Gets or Sets BooleanProp + /// + [JsonPropertyName("boolean_prop")] + public bool? BooleanProp { get { return this.BooleanPropOption; } set { this.BooleanPropOption = new(value); } } + + /// + /// Used to track the state of DateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DatePropOption { get; private set; } + + /// + /// Gets or Sets DateProp + /// + [JsonPropertyName("date_prop")] + public DateOnly? DateProp { get { return this.DatePropOption; } set { this.DatePropOption = new(value); } } + + /// + /// Used to track the state of DatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DatetimePropOption { get; private set; } + + /// + /// Gets or Sets DatetimeProp + /// + [JsonPropertyName("datetime_prop")] + public DateTime? DatetimeProp { get { return this.DatetimePropOption; } set { this.DatetimePropOption = new(value); } } + + /// + /// Used to track the state of IntegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntegerPropOption { get; private set; } + + /// + /// Gets or Sets IntegerProp + /// + [JsonPropertyName("integer_prop")] + public int? IntegerProp { get { return this.IntegerPropOption; } set { this.IntegerPropOption = new(value); } } + + /// + /// Used to track the state of NumberProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NumberPropOption { get; private set; } + + /// + /// Gets or Sets NumberProp + /// + [JsonPropertyName("number_prop")] + public decimal? NumberProp { get { return this.NumberPropOption; } set { this.NumberPropOption = new(value); } } + + /// + /// Used to track the state of ObjectAndItemsNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ObjectAndItemsNullablePropOption { get; private set; } + + /// + /// Gets or Sets ObjectAndItemsNullableProp + /// + [JsonPropertyName("object_and_items_nullable_prop")] + public Dictionary? ObjectAndItemsNullableProp { get { return this.ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } + + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ObjectItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ObjectItemsNullable + /// + [JsonPropertyName("object_items_nullable")] + public Dictionary? ObjectItemsNullable { get { return this.ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + + /// + /// Used to track the state of ObjectNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ObjectNullablePropOption { get; private set; } + + /// + /// Gets or Sets ObjectNullableProp + /// + [JsonPropertyName("object_nullable_prop")] + public Dictionary? ObjectNullableProp { get { return this.ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } + + /// + /// Used to track the state of StringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringPropOption { get; private set; } + + /// + /// Gets or Sets StringProp + /// + [JsonPropertyName("string_prop")] + public string? StringProp { get { return this.StringPropOption; } set { this.StringPropOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableClass {\n"); + sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append("\n"); + sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); + sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append("\n"); + sb.Append(" BooleanProp: ").Append(BooleanProp).Append("\n"); + sb.Append(" DateProp: ").Append(DateProp).Append("\n"); + sb.Append(" DatetimeProp: ").Append(DatetimeProp).Append("\n"); + sb.Append(" IntegerProp: ").Append(IntegerProp).Append("\n"); + sb.Append(" NumberProp: ").Append(NumberProp).Append("\n"); + sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n"); + sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); + sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n"); + sb.Append(" StringProp: ").Append(StringProp).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateProp + /// + public static string DatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize DatetimeProp + /// + public static string DatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> arrayAndItemsNullableProp = default; + Option?> arrayItemsNullable = default; + Option?> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option?> objectAndItemsNullableProp = default; + Option?> objectItemsNullable = default; + Option?> objectNullableProp = default; + Option stringProp = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_and_items_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_items_nullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "array_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + booleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + integerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "number_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + numberProp = new Option(utf8JsonReader.GetDecimal()); + break; + case "object_and_items_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "object_items_nullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "object_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "string_prop": + stringProp = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (arrayItemsNullable.IsSet && arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); + + if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); + + return new NullableClass(arrayAndItemsNullableProp, arrayItemsNullable, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectItemsNullable, objectNullableProp, stringProp); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, nullableClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) + { + if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) + if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayItemsNullableOption.IsSet) + { + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } + if (nullableClass.ArrayNullablePropOption.IsSet) + if (nullableClass.ArrayNullablePropOption.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanPropOption.IsSet) + if (nullableClass.BooleanPropOption.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DatePropOption.IsSet) + if (nullableClass.DatePropOption.Value != null) + writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimePropOption.IsSet) + if (nullableClass.DatetimePropOption.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerPropOption.IsSet) + if (nullableClass.IntegerPropOption.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberPropOption.IsSet) + if (nullableClass.NumberPropOption.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); + else + writer.WriteNull("number_prop"); + + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) + if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectItemsNullableOption.IsSet) + { + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } + if (nullableClass.ObjectNullablePropOption.IsSet) + if (nullableClass.ObjectNullablePropOption.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringPropOption.IsSet) + if (nullableClass.StringPropOption.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp); + else + writer.WriteNull("string_prop"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs new file mode 100644 index 000000000000..83619d031144 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NullableGuidClass + /// + public partial class NullableGuidClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// uuid + [JsonConstructor] + public NullableGuidClass(Option uuid = default) + { + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableGuidClass {\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableGuidClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + return new NullableGuidClass(uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, nullableGuidClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) + { + if (nullableGuidClass.UuidOption.IsSet) + if (nullableGuidClass.UuidOption.Value != null) + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); + else + writer.WriteNull("uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableShape.cs new file mode 100644 index 000000000000..a06afa2a9be6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NullableShape.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// 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. + /// + public partial class NullableShape : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public NullableShape(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public NullableShape(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle? Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral? Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableShape {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableShapeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral? quadrilateral = null; + Triangle? triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("shapeType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("Quadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator?.Equals("Triangle") ?? false) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); + + if (quadrilateral != null) + return new NullableShape(quadrilateral); + + if (triangle != null) + return new NullableShape(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (nullableShape.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, nullableShape.Triangle, jsonSerializerOptions); + } + + if (nullableShape.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, nullableShape.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, nullableShape, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs new file mode 100644 index 000000000000..b52b1cc177f1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NumberOnly + /// + public partial class NumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// justNumber + [JsonConstructor] + public NumberOnly(Option justNumber = default) + { + JustNumberOption = justNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of JustNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option JustNumberOption { get; private set; } + + /// + /// Gets or Sets JustNumber + /// + [JsonPropertyName("JustNumber")] + public decimal? JustNumber { get { return this.JustNumberOption; } set { this.JustNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NumberOnly {\n"); + sb.Append(" JustNumber: ").Append(JustNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option justNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "JustNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + justNumber = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (justNumber.IsSet && justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); + + return new NumberOnly(justNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, numberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (numberOnly.JustNumberOption.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs new file mode 100644 index 000000000000..ec6905ea3a72 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -0,0 +1,270 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ObjectWithDeprecatedFields + /// + public partial class ObjectWithDeprecatedFields : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bars + /// deprecatedRef + /// id + /// uuid + [JsonConstructor] + public ObjectWithDeprecatedFields(Option?> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) + { + BarsOption = bars; + DeprecatedRefOption = deprecatedRef; + IdOption = id; + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bars + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> BarsOption { get; private set; } + + /// + /// Gets or Sets Bars + /// + [JsonPropertyName("bars")] + [Obsolete] + public List? Bars { get { return this.BarsOption; } set { this.BarsOption = new(value); } } + + /// + /// Used to track the state of DeprecatedRef + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeprecatedRefOption { get; private set; } + + /// + /// Gets or Sets DeprecatedRef + /// + [JsonPropertyName("deprecatedRef")] + [Obsolete] + public DeprecatedObject? DeprecatedRef { get { return this.DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + [Obsolete] + public decimal? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + [JsonPropertyName("uuid")] + public string? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ObjectWithDeprecatedFields {\n"); + sb.Append(" Bars: ").Append(Bars).Append("\n"); + sb.Append(" DeprecatedRef: ").Append(DeprecatedRef).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ObjectWithDeprecatedFieldsJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bars": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "deprecatedRef": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetDecimal()); + break; + case "uuid": + uuid = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (bars.IsSet && bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (deprecatedRef.IsSet && deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); + + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, objectWithDeprecatedFields, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) + { + if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.BarsOption.IsSet) + { + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + } + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) + { + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + } + if (objectWithDeprecatedFields.IdOption.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); + + if (objectWithDeprecatedFields.UuidOption.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OneOfString.cs new file mode 100644 index 000000000000..5471f08f5194 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OneOfString.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// OneOfString + /// + public partial class OneOfString : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + internal OneOfString(string @string) + { + String = @string; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets String + /// + public string? String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OneOfString {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OneOfStringJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string? varString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varString != null) + return new OneOfString(varString); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, oneOfString, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs new file mode 100644 index 000000000000..a3e3679fe3dc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Order.cs @@ -0,0 +1,398 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Order + /// + public partial class Order : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// complete (default to false) + /// id + /// petId + /// quantity + /// shipDate + /// Order Status + [JsonConstructor] + public Order(Option complete = default, Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default) + { + CompleteOption = complete; + IdOption = id; + PetIdOption = petId; + QuantityOption = quantity; + ShipDateOption = shipDate; + StatusOption = status; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Returns a + /// + /// + /// + /// + public static StatusEnum StatusEnumFromString(string value) + { + if (value.Equals("placed")) + return StatusEnum.Placed; + + if (value.Equals("approved")) + return StatusEnum.Approved; + + if (value.Equals("delivered")) + return StatusEnum.Delivered; + + throw new NotImplementedException($"Could not convert value to type StatusEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static StatusEnum? StatusEnumFromStringOrDefault(string value) + { + if (value.Equals("placed")) + return StatusEnum.Placed; + + if (value.Equals("approved")) + return StatusEnum.Approved; + + if (value.Equals("delivered")) + return StatusEnum.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string StatusEnumToJsonValue(StatusEnum? value) + { + if (value == StatusEnum.Placed) + return "placed"; + + if (value == StatusEnum.Approved) + return "approved"; + + if (value == StatusEnum.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// Order Status + /// + /// Order Status + [JsonPropertyName("status")] + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CompleteOption { get; private set; } + + /// + /// Gets or Sets Complete + /// + [JsonPropertyName("complete")] + public bool? Complete { get { return this.CompleteOption; } set { this.CompleteOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of PetId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PetIdOption { get; private set; } + + /// + /// Gets or Sets PetId + /// + [JsonPropertyName("petId")] + public long? PetId { get { return this.PetIdOption; } set { this.PetIdOption = new(value); } } + + /// + /// Used to track the state of Quantity + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QuantityOption { get; private set; } + + /// + /// Gets or Sets Quantity + /// + [JsonPropertyName("quantity")] + public int? Quantity { get { return this.QuantityOption; } set { this.QuantityOption = new(value); } } + + /// + /// Used to track the state of ShipDate + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShipDateOption { get; private set; } + + /// + /// Gets or Sets ShipDate + /// + /* 2020-02-02T20:20:20.000222Z */ + [JsonPropertyName("shipDate")] + public DateTime? ShipDate { get { return this.ShipDateOption; } set { this.ShipDateOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Order {\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" PetId: ").Append(PetId).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OrderJsonConverter : JsonConverter + { + /// + /// The format to use to serialize ShipDate + /// + public static string ShipDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "complete": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + complete = new Option(utf8JsonReader.GetBoolean()); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "petId": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + petId = new Option(utf8JsonReader.GetInt64()); + break; + case "quantity": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + quantity = new Option(utf8JsonReader.GetInt32()); + break; + case "shipDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "status": + string? statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); + break; + default: + break; + } + } + } + + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); + + if (petId.IsSet && petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); + + if (quantity.IsSet && quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); + + if (shipDate.IsSet && shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); + + return new Order(complete, id, petId, quantity, shipDate, status); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, order, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) + { + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); + + if (order.IdOption.IsSet) + writer.WriteNumber("id", order.IdOption.Value!.Value); + + if (order.PetIdOption.IsSet) + writer.WriteNumber("petId", order.PetIdOption.Value!.Value); + + if (order.QuantityOption.IsSet) + writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); + + if (order.ShipDateOption.IsSet) + writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); + + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); + writer.WriteString("status", statusRawValue); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs new file mode 100644 index 000000000000..01d4f3844ebf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -0,0 +1,230 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// OuterComposite + /// + public partial class OuterComposite : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// myBoolean + /// myNumber + /// myString + [JsonConstructor] + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) + { + MyBooleanOption = myBoolean; + MyNumberOption = myNumber; + MyStringOption = myString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of MyBoolean + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyBooleanOption { get; private set; } + + /// + /// Gets or Sets MyBoolean + /// + [JsonPropertyName("my_boolean")] + public bool? MyBoolean { get { return this.MyBooleanOption; } set { this.MyBooleanOption = new(value); } } + + /// + /// Used to track the state of MyNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyNumberOption { get; private set; } + + /// + /// Gets or Sets MyNumber + /// + [JsonPropertyName("my_number")] + public decimal? MyNumber { get { return this.MyNumberOption; } set { this.MyNumberOption = new(value); } } + + /// + /// Used to track the state of MyString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyStringOption { get; private set; } + + /// + /// Gets or Sets MyString + /// + [JsonPropertyName("my_string")] + public string? MyString { get { return this.MyStringOption; } set { this.MyStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OuterComposite {\n"); + sb.Append(" MyBoolean: ").Append(MyBoolean).Append("\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); + sb.Append(" MyString: ").Append(MyString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OuterCompositeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option myBoolean = default; + Option myNumber = default; + Option myString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "my_boolean": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + myBoolean = new Option(utf8JsonReader.GetBoolean()); + break; + case "my_number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + myNumber = new Option(utf8JsonReader.GetDecimal()); + break; + case "my_string": + myString = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (myBoolean.IsSet && myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); + + if (myNumber.IsSet && myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); + + if (myString.IsSet && myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); + + return new OuterComposite(myBoolean, myNumber, myString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, outerComposite, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) + { + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + + if (outerComposite.MyBooleanOption.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); + + if (outerComposite.MyNumberOption.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); + + if (outerComposite.MyStringOption.IsSet) + writer.WriteString("my_string", outerComposite.MyString); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnum.cs new file mode 100644 index 000000000000..96af6f3670d8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnum + /// + public enum OuterEnum + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnum FromString(string value) + { + if (value.Equals("placed")) + return OuterEnum.Placed; + + if (value.Equals("approved")) + return OuterEnum.Approved; + + if (value.Equals("delivered")) + return OuterEnum.Delivered; + + throw new NotImplementedException($"Could not convert value to type OuterEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnum? FromStringOrDefault(string value) + { + if (value.Equals("placed")) + return OuterEnum.Placed; + + if (value.Equals("approved")) + return OuterEnum.Approved; + + if (value.Equals("delivered")) + return OuterEnum.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnum value) + { + if (value == OuterEnum.Placed) + return "placed"; + + if (value == OuterEnum.Approved) + return "approved"; + + if (value == OuterEnum.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnum? result = rawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnum outerEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnum.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnum from the Json object + /// + /// + /// + /// + /// + public override OuterEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnum? result = rawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnum? outerEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnum?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs new file mode 100644 index 000000000000..a50d5c056ecc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumDefaultValue + /// + public enum OuterEnumDefaultValue + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumDefaultValueValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumDefaultValue FromString(string value) + { + if (value.Equals("placed")) + return OuterEnumDefaultValue.Placed; + + if (value.Equals("approved")) + return OuterEnumDefaultValue.Approved; + + if (value.Equals("delivered")) + return OuterEnumDefaultValue.Delivered; + + throw new NotImplementedException($"Could not convert value to type OuterEnumDefaultValue: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumDefaultValue? FromStringOrDefault(string value) + { + if (value.Equals("placed")) + return OuterEnumDefaultValue.Placed; + + if (value.Equals("approved")) + return OuterEnumDefaultValue.Approved; + + if (value.Equals("delivered")) + return OuterEnumDefaultValue.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnumDefaultValue value) + { + if (value == OuterEnumDefaultValue.Placed) + return "placed"; + + if (value == OuterEnumDefaultValue.Approved) + return "approved"; + + if (value == OuterEnumDefaultValue.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumDefaultValueJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumDefaultValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumDefaultValue? result = rawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumDefaultValue to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumDefaultValue outerEnumDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumDefaultValue.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumDefaultValueNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumDefaultValue from the Json object + /// + /// + /// + /// + /// + public override OuterEnumDefaultValue? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumDefaultValue? result = rawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumDefaultValue? outerEnumDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumDefaultValue?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumInteger.cs new file mode 100644 index 000000000000..41ecebcf8f5b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -0,0 +1,181 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumInteger + /// + public enum OuterEnumInteger + { + /// + /// Enum NUMBER_0 for value: 0 + /// + NUMBER_0 = 0, + + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumIntegerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumInteger FromString(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumInteger.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumInteger.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumInteger.NUMBER_2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumInteger: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumInteger? FromStringOrDefault(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumInteger.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumInteger.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumInteger.NUMBER_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(OuterEnumInteger value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumIntegerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumInteger Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumInteger? result = rawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumInteger to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumInteger outerEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumInteger.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumIntegerNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumInteger from the Json object + /// + /// + /// + /// + /// + public override OuterEnumInteger? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumInteger? result = rawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumInteger? outerEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumInteger?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs new file mode 100644 index 000000000000..902dbb066392 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -0,0 +1,181 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumIntegerDefaultValue + /// + public enum OuterEnumIntegerDefaultValue + { + /// + /// Enum NUMBER_0 for value: 0 + /// + NUMBER_0 = 0, + + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumIntegerDefaultValueValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumIntegerDefaultValue FromString(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumIntegerDefaultValue: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumIntegerDefaultValue? FromStringOrDefault(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(OuterEnumIntegerDefaultValue value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumIntegerDefaultValueJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumIntegerDefaultValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumIntegerDefaultValue? result = rawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumIntegerDefaultValue to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumIntegerDefaultValue.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumIntegerDefaultValueNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumIntegerDefaultValue from the Json object + /// + /// + /// + /// + /// + public override OuterEnumIntegerDefaultValue? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumIntegerDefaultValue? result = rawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumIntegerDefaultValue?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumTest.cs new file mode 100644 index 000000000000..03a8ccdecacd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines Outer_Enum_Test + /// + public enum OuterEnumTest + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumTestValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumTest FromString(string value) + { + if (value.Equals("UPPER")) + return OuterEnumTest.UPPER; + + if (value.Equals("lower")) + return OuterEnumTest.Lower; + + if (value.Equals("")) + return OuterEnumTest.Empty; + + if (value.Equals("Value\twith tab")) + return OuterEnumTest.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return OuterEnumTest.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return OuterEnumTest.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return OuterEnumTest.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return OuterEnumTest.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumTest: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumTest? FromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return OuterEnumTest.UPPER; + + if (value.Equals("lower")) + return OuterEnumTest.Lower; + + if (value.Equals("")) + return OuterEnumTest.Empty; + + if (value.Equals("Value\twith tab")) + return OuterEnumTest.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return OuterEnumTest.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return OuterEnumTest.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return OuterEnumTest.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return OuterEnumTest.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnumTest value) + { + if (value == OuterEnumTest.UPPER) + return "UPPER"; + + if (value == OuterEnumTest.Lower) + return "lower"; + + if (value == OuterEnumTest.Empty) + return ""; + + if (value == OuterEnumTest.ValuewithTab) + return "Value\twith tab"; + + if (value == OuterEnumTest.ValueWithQuote) + return "Value with \" quote"; + + if (value == OuterEnumTest.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == OuterEnumTest.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == OuterEnumTest.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumTestJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumTest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumTest? result = rawValue == null + ? null + : OuterEnumTestValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumTest to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumTest outerEnumTest, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumTest.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumTestNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumTest from the Json object + /// + /// + /// + /// + /// + public override OuterEnumTest? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumTest? result = rawValue == null + ? null + : OuterEnumTestValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumTest? outerEnumTest, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumTest?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ParentPet.cs new file mode 100644 index 000000000000..a4b1ab4347d6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ParentPet.cs @@ -0,0 +1,160 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ParentPet + /// + public partial class ParentPet : GrandparentAnimal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructor] + public ParentPet() : base() + { + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string PetType { get; } = "ParentPet"; + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ParentPet {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class ParentPetJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option petType = default; + + string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type"); + + if (discriminator != null && discriminator.Equals("ChildCat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pet_type": + petType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + return new ParentPet(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) + { + if (parentPet is ChildCat childCat){ + JsonSerializer.Serialize(writer, childCat, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, parentPet, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("pet_type", parentPet.PetType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs new file mode 100644 index 000000000000..55df1e0579f5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pet.cs @@ -0,0 +1,398 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Pet + /// + public partial class Pet : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + /// photoUrls + /// category + /// id + /// pet status in the store + /// tags + [JsonConstructor] + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option?> tags = default) + { + Name = name; + PhotoUrls = photoUrls; + CategoryOption = category; + IdOption = id; + StatusOption = status; + TagsOption = tags; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + /// + /// Enum Available for value: available + /// + Available = 1, + + /// + /// Enum Pending for value: pending + /// + Pending = 2, + + /// + /// Enum Sold for value: sold + /// + Sold = 3 + } + + /// + /// Returns a + /// + /// + /// + /// + public static StatusEnum StatusEnumFromString(string value) + { + if (value.Equals("available")) + return StatusEnum.Available; + + if (value.Equals("pending")) + return StatusEnum.Pending; + + if (value.Equals("sold")) + return StatusEnum.Sold; + + throw new NotImplementedException($"Could not convert value to type StatusEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static StatusEnum? StatusEnumFromStringOrDefault(string value) + { + if (value.Equals("available")) + return StatusEnum.Available; + + if (value.Equals("pending")) + return StatusEnum.Pending; + + if (value.Equals("sold")) + return StatusEnum.Sold; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string StatusEnumToJsonValue(StatusEnum? value) + { + if (value == StatusEnum.Available) + return "available"; + + if (value == StatusEnum.Pending) + return "pending"; + + if (value == StatusEnum.Sold) + return "sold"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// pet status in the store + /// + /// pet status in the store + [JsonPropertyName("status")] + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Gets or Sets Name + /// + /* doggie */ + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or Sets PhotoUrls + /// + [JsonPropertyName("photoUrls")] + public List PhotoUrls { get; set; } + + /// + /// Used to track the state of Category + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CategoryOption { get; private set; } + + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Category? Category { get { return this.CategoryOption; } set { this.CategoryOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Tags + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> TagsOption { get; private set; } + + /// + /// Gets or Sets Tags + /// + [JsonPropertyName("tags")] + public List? Tags { get { return this.TagsOption; } set { this.TagsOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Pet {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Tags: ").Append(Tags).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PetJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + Option?> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option?> tags = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + case "photoUrls": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "status": + string? statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); + break; + case "tags": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (!name.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(name)); + + if (!photoUrls.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); + + if (photoUrls.IsSet && photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); + + if (category.IsSet && category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + + if (tags.IsSet && tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + + return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, pet, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) + { + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.CategoryOption.IsSet && pet.Category == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + + if (pet.TagsOption.IsSet && pet.Tags == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + + writer.WriteString("name", pet.Name); + + writer.WritePropertyName("photoUrls"); + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.CategoryOption.IsSet) + { + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + } + if (pet.IdOption.IsSet) + writer.WriteNumber("id", pet.IdOption.Value!.Value); + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); + writer.WriteString("status", statusRawValue); + if (pet.TagsOption.IsSet) + { + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pig.cs new file mode 100644 index 000000000000..2cd41f15027a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Pig.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Pig + /// + public partial class Pig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Pig(BasquePig basquePig) + { + BasquePig = basquePig; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Pig(DanishPig danishPig) + { + DanishPig = danishPig; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets BasquePig + /// + public BasquePig? BasquePig { get; set; } + + /// + /// Gets or Sets DanishPig + /// + public DanishPig? DanishPig { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Pig {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + BasquePig? basquePig = null; + DanishPig? danishPig = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("className") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("BasquePig") ?? false) + { + Utf8JsonReader utf8JsonReaderBasquePig = utf8JsonReader; + basquePig = JsonSerializer.Deserialize(ref utf8JsonReaderBasquePig, jsonSerializerOptions); + } + if (discriminator?.Equals("DanishPig") ?? false) + { + Utf8JsonReader utf8JsonReaderDanishPig = utf8JsonReader; + danishPig = JsonSerializer.Deserialize(ref utf8JsonReaderDanishPig, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Pig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); + + if (basquePig != null) + return new Pig(basquePig); + + if (danishPig != null) + return new Pig(danishPig); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (pig.BasquePig != null) + { + BasquePigJsonConverter basquePigJsonConverter = (BasquePigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.BasquePig.GetType())); + basquePigJsonConverter.WriteProperties(writer, pig.BasquePig, jsonSerializerOptions); + } + + if (pig.DanishPig != null) + { + DanishPigJsonConverter danishPigJsonConverter = (DanishPigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.DanishPig.GetType())); + danishPigJsonConverter.WriteProperties(writer, pig.DanishPig, jsonSerializerOptions); + } + + WriteProperties(writer, pig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/PolymorphicProperty.cs new file mode 100644 index 000000000000..3c1b978da7f0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// PolymorphicProperty + /// + public partial class PolymorphicProperty : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(bool @bool) + { + Bool = @bool; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(string @string) + { + String = @string; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(Object @object) + { + Object = @object; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(List list) + { + List = list; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get; set; } + + /// + /// Gets or Sets String + /// + public string? String { get; set; } + + /// + /// Gets or Sets Object + /// + public Object? Object { get; set; } + + /// + /// Gets or Sets List + /// + public List? List { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PolymorphicProperty {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PolymorphicPropertyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + bool? varBool = default; + string? varString = default; + Object? varObject = default; + List? list = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderObject = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderObject, jsonSerializerOptions, out varObject); + + Utf8JsonReader utf8JsonReaderList = utf8JsonReader; + ClientUtils.TryDeserialize?>(ref utf8JsonReaderList, jsonSerializerOptions, out list); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varBool != null) + return new PolymorphicProperty(varBool.Value); + + if (varString != null) + return new PolymorphicProperty(varString); + + if (varObject != null) + return new PolymorphicProperty(varObject); + + if (list != null) + return new PolymorphicProperty(list); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, polymorphicProperty, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Quadrilateral.cs new file mode 100644 index 000000000000..5c7aa541ffc5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Quadrilateral + /// + public partial class Quadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Quadrilateral(SimpleQuadrilateral simpleQuadrilateral) + { + SimpleQuadrilateral = simpleQuadrilateral; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Quadrilateral(ComplexQuadrilateral complexQuadrilateral) + { + ComplexQuadrilateral = complexQuadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets SimpleQuadrilateral + /// + public SimpleQuadrilateral? SimpleQuadrilateral { get; set; } + + /// + /// Gets or Sets ComplexQuadrilateral + /// + public ComplexQuadrilateral? ComplexQuadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Quadrilateral {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class QuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + + ComplexQuadrilateral? complexQuadrilateral = null; + SimpleQuadrilateral? simpleQuadrilateral = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("quadrilateralType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("ComplexQuadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderComplexQuadrilateral = utf8JsonReader; + complexQuadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderComplexQuadrilateral, jsonSerializerOptions); + } + if (discriminator?.Equals("SimpleQuadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderSimpleQuadrilateral = utf8JsonReader; + simpleQuadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderSimpleQuadrilateral, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); + + if (complexQuadrilateral != null) + return new Quadrilateral(complexQuadrilateral); + + if (simpleQuadrilateral != null) + return new Quadrilateral(simpleQuadrilateral); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (quadrilateral.SimpleQuadrilateral != null) + { + SimpleQuadrilateralJsonConverter simpleQuadrilateralJsonConverter = (SimpleQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.SimpleQuadrilateral.GetType())); + simpleQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.SimpleQuadrilateral, jsonSerializerOptions); + } + + if (quadrilateral.ComplexQuadrilateral != null) + { + ComplexQuadrilateralJsonConverter complexQuadrilateralJsonConverter = (ComplexQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.ComplexQuadrilateral.GetType())); + complexQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.ComplexQuadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, quadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs new file mode 100644 index 000000000000..c535142bde64 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -0,0 +1,171 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// QuadrilateralInterface + /// + public partial class QuadrilateralInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + [JsonConstructor] + public QuadrilateralInterface(string quadrilateralType) + { + QuadrilateralType = quadrilateralType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class QuadrilateralInterface {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class QuadrilateralInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + return new QuadrilateralInterface(quadrilateralType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, quadrilateralInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs new file mode 100644 index 000000000000..a48fcb21dbef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -0,0 +1,243 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ReadOnlyFirst + /// + public partial class ReadOnlyFirst : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar + /// baz + [JsonConstructor] + public ReadOnlyFirst(Option bar = default, Option baz = default) + { + BarOption = bar; + BazOption = baz; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string? Bar { get { return this.BarOption; } } + + /// + /// Used to track the state of Baz + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BazOption { get; private set; } + + /// + /// Gets or Sets Baz + /// + [JsonPropertyName("baz")] + public string? Baz { get { return this.BazOption; } set { this.BazOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ReadOnlyFirst {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Baz: ").Append(Baz).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ReadOnlyFirst).AreEqual; + } + + /// + /// Returns true if ReadOnlyFirst instances are equal + /// + /// Instance of ReadOnlyFirst to be compared + /// Boolean + public bool Equals(ReadOnlyFirst? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ReadOnlyFirstJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + Option baz = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()!); + break; + case "baz": + baz = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); + + if (baz.IsSet && baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); + + return new ReadOnlyFirst(bar, baz); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, readOnlyFirst, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) + { + if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BarOption.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar); + + if (readOnlyFirst.BazOption.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..15688d958f05 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,2380 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + [JsonConstructor] + public RequiredClass(DateOnly requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateOnly? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; + NotRequiredNullableDatePropOption = notRequiredNullableDateProp; + NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; + NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumIntegerOption = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnlyOption = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumStringOption = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValueOption = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringPropOption = notrequiredNullableStringProp; + NotrequiredNullableUuidOption = notrequiredNullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNullableEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateOnly RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Used to track the state of NotRequiredNotnullableDateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNotnullableDatePropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateOnly? NotRequiredNotnullableDateProp { get { return this.NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNotnullableintegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNotnullableintegerPropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this.NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNullableDateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNullableDatePropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public DateOnly? NotRequiredNullableDateProp { get { return this.NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNullableIntegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNullableIntegerPropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this.NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List? NotrequiredNotnullableArrayOfString { get { return this.NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableBooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this.NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this.NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableStringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableStringPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string? NotrequiredNotnullableStringProp { get { return this.NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableUuidOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this.NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public List? NotrequiredNullableArrayOfString { get { return this.NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableBooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableBooleanPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public bool? NotrequiredNullableBooleanProp { get { return this.NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableDatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableDatetimePropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public DateTime? NotrequiredNullableDatetimeProp { get { return this.NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableStringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableStringPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public string? NotrequiredNullableStringProp { get { return this.NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableUuidOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("notrequired_nullable_uuid")] + public Guid? NotrequiredNullableUuid { get { return this.NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List? RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateOnly? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string? RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option?> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option?> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option?> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + Option?> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string? requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string? notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); + + if (requiredNotNullableDateProp.IsSet && requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.IsSet && requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.IsSet && requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.IsSet && requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.IsSet && requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.IsSet && requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.IsSet && requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.IsSet && requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.IsSet && requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.IsSet && requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.IsSet && requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.IsSet && notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.IsSet && notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.IsSet && notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.IsSet && notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.IsSet && notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.IsSet && notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.IsSet && notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.IsSet && notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.IsSet && notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.IsSet && notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); + + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); + + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); + + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); + + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); + + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); + + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); + + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); + + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); + + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) + if (requiredClass.NotRequiredNullableDatePropOption.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); + + if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) + if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); + + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) + if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) + if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + + if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) + if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + + if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); + + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringPropOption.IsSet) + if (requiredClass.NotrequiredNullableStringPropOption.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); + else + writer.WriteNull("notrequired_nullable_string_prop"); + + if (requiredClass.NotrequiredNullableUuidOption.IsSet) + if (requiredClass.NotrequiredNullableUuidOption.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); + else + writer.WriteNull("notrequired_nullable_uuid"); + + if (requiredClass.RequiredNullableArrayOfString != null) + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); + + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); + + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); + + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); + + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); + + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); + + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); + + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs new file mode 100644 index 000000000000..0d9fe3516e6f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Return.cs @@ -0,0 +1,248 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing reserved words + /// + public partial class Return : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lock + /// abstract + /// varReturn + /// unsafe + [JsonConstructor] + public Return(string @lock, string? @abstract = default, Option varReturn = default, Option @unsafe = default) + { + Lock = @lock; + Abstract = @abstract; + VarReturnOption = varReturn; + UnsafeOption = @unsafe; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Lock + /// + [JsonPropertyName("lock")] + public string Lock { get; set; } + + /// + /// Gets or Sets Abstract + /// + [JsonPropertyName("abstract")] + public string? Abstract { get; set; } + + /// + /// Used to track the state of VarReturn + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarReturnOption { get; private set; } + + /// + /// Gets or Sets VarReturn + /// + [JsonPropertyName("return")] + public int? VarReturn { get { return this.VarReturnOption; } set { this.VarReturnOption = new(value); } } + + /// + /// Used to track the state of Unsafe + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsafeOption { get; private set; } + + /// + /// Gets or Sets Unsafe + /// + [JsonPropertyName("unsafe")] + public string? Unsafe { get { return this.UnsafeOption; } set { this.UnsafeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Return {\n"); + sb.Append(" Lock: ").Append(Lock).Append("\n"); + sb.Append(" Abstract: ").Append(Abstract).Append("\n"); + sb.Append(" VarReturn: ").Append(VarReturn).Append("\n"); + sb.Append(" Unsafe: ").Append(Unsafe).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ReturnJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varLock = default; + Option varAbstract = default; + Option varReturn = default; + Option varUnsafe = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lock": + varLock = new Option(utf8JsonReader.GetString()!); + break; + case "abstract": + varAbstract = new Option(utf8JsonReader.GetString()); + break; + case "return": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varReturn = new Option(utf8JsonReader.GetInt32()); + break; + case "unsafe": + varUnsafe = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!varLock.IsSet) + throw new ArgumentException("Property is required for class Return.", nameof(varLock)); + + if (!varAbstract.IsSet) + throw new ArgumentException("Property is required for class Return.", nameof(varAbstract)); + + if (varLock.IsSet && varLock.Value == null) + throw new ArgumentNullException(nameof(varLock), "Property is not nullable for class Return."); + + if (varReturn.IsSet && varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); + + if (varUnsafe.IsSet && varUnsafe.Value == null) + throw new ArgumentNullException(nameof(varUnsafe), "Property is not nullable for class Return."); + + return new Return(varLock.Value!, varAbstract.Value!, varReturn, varUnsafe); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, varReturn, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) + { + if (varReturn.Lock == null) + throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); + + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) + throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + + writer.WriteString("lock", varReturn.Lock); + + if (varReturn.Abstract != null) + writer.WriteString("abstract", varReturn.Abstract); + else + writer.WriteNull("abstract"); + + if (varReturn.VarReturnOption.IsSet) + writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); + + if (varReturn.UnsafeOption.IsSet) + writer.WriteString("unsafe", varReturn.Unsafe); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs new file mode 100644 index 000000000000..d520cfcc9a96 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -0,0 +1,206 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Role report Hash + /// + public partial class RolesReportsHash : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// role + /// roleUuid + [JsonConstructor] + public RolesReportsHash(Option role = default, Option roleUuid = default) + { + RoleOption = role; + RoleUuidOption = roleUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Role + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option RoleOption { get; private set; } + + /// + /// Gets or Sets Role + /// + [JsonPropertyName("role")] + public RolesReportsHashRole? Role { get { return this.RoleOption; } set { this.RoleOption = new(value); } } + + /// + /// Used to track the state of RoleUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option RoleUuidOption { get; private set; } + + /// + /// Gets or Sets RoleUuid + /// + [JsonPropertyName("role_uuid")] + public Guid? RoleUuid { get { return this.RoleUuidOption; } set { this.RoleUuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RolesReportsHash {\n"); + sb.Append(" Role: ").Append(Role).Append("\n"); + sb.Append(" RoleUuid: ").Append(RoleUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RolesReportsHashJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option role = default; + Option roleUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "role": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "role_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + roleUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (role.IsSet && role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); + + if (roleUuid.IsSet && roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); + + return new RolesReportsHash(role, roleUuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, rolesReportsHash, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) + { + if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + + if (rolesReportsHash.RoleOption.IsSet) + { + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + } + if (rolesReportsHash.RoleUuidOption.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs new file mode 100644 index 000000000000..684ca8e8b515 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RolesReportsHashRole + /// + public partial class RolesReportsHashRole : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public RolesReportsHashRole(Option name = default) + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RolesReportsHashRole {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RolesReportsHashRoleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); + + return new RolesReportsHashRole(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, rolesReportsHashRole, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) + { + if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + + if (rolesReportsHashRole.NameOption.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs new file mode 100644 index 000000000000..926b431dda32 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -0,0 +1,195 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ScaleneTriangle + /// + public partial class ScaleneTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public ScaleneTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ScaleneTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ScaleneTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, scaleneTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + + writer.WriteString("triangleType", scaleneTriangle.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Shape.cs new file mode 100644 index 000000000000..c608b7288d95 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Shape.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Shape + /// + public partial class Shape : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Shape(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Shape(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle? Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral? Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Shape {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral? quadrilateral = null; + Triangle? triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("shapeType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("Quadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator?.Equals("Triangle") ?? false) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); + + if (quadrilateral != null) + return new Shape(quadrilateral); + + if (triangle != null) + return new Shape(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (shape.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, shape.Triangle, jsonSerializerOptions); + } + + if (shape.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, shape.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, shape, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs new file mode 100644 index 000000000000..15777abac01d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -0,0 +1,171 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ShapeInterface + /// + public partial class ShapeInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + [JsonConstructor] + public ShapeInterface(string shapeType) + { + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShapeInterface {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + return new ShapeInterface(shapeType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, shapeInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + + writer.WriteString("shapeType", shapeInterface.ShapeType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs new file mode 100644 index 000000000000..3fc9f2735096 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + /// + public partial class ShapeOrNull : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public ShapeOrNull(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public ShapeOrNull(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle? Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral? Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShapeOrNull {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeOrNullJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral? quadrilateral = null; + Triangle? triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("shapeType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("Quadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator?.Equals("Triangle") ?? false) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); + + if (quadrilateral != null) + return new ShapeOrNull(quadrilateral); + + if (triangle != null) + return new ShapeOrNull(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (shapeOrNull.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, shapeOrNull.Triangle, jsonSerializerOptions); + } + + if (shapeOrNull.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, shapeOrNull.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, shapeOrNull, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs new file mode 100644 index 000000000000..bab36d28f5ef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -0,0 +1,195 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// SimpleQuadrilateral + /// + public partial class SimpleQuadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + /// shapeType + [JsonConstructor] + public SimpleQuadrilateral(string quadrilateralType, string shapeType) + { + QuadrilateralType = quadrilateralType; + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SimpleQuadrilateral {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SimpleQuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()!); + break; + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, simpleQuadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs new file mode 100644 index 000000000000..d66e2a9e7328 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// SpecialModelName + /// + public partial class SpecialModelName : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varSpecialModelName + /// specialPropertyName + [JsonConstructor] + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) + { + VarSpecialModelNameOption = varSpecialModelName; + SpecialPropertyNameOption = specialPropertyName; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of VarSpecialModelName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarSpecialModelNameOption { get; private set; } + + /// + /// Gets or Sets VarSpecialModelName + /// + [JsonPropertyName("_special_model.name_")] + public string? VarSpecialModelName { get { return this.VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } + + /// + /// Used to track the state of SpecialPropertyName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SpecialPropertyNameOption { get; private set; } + + /// + /// Gets or Sets SpecialPropertyName + /// + [JsonPropertyName("$special[property.name]")] + public long? SpecialPropertyName { get { return this.SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SpecialModelName {\n"); + sb.Append(" VarSpecialModelName: ").Append(VarSpecialModelName).Append("\n"); + sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SpecialModelNameJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varSpecialModelName = default; + Option specialPropertyName = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "_special_model.name_": + varSpecialModelName = new Option(utf8JsonReader.GetString()!); + break; + case "$special[property.name]": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + specialPropertyName = new Option(utf8JsonReader.GetInt64()); + break; + default: + break; + } + } + } + + if (varSpecialModelName.IsSet && varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); + + if (specialPropertyName.IsSet && specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); + + return new SpecialModelName(varSpecialModelName, specialPropertyName); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, specialModelName, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) + { + if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + + if (specialModelName.VarSpecialModelNameOption.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); + + if (specialModelName.SpecialPropertyNameOption.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs new file mode 100644 index 000000000000..92de05e2d752 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Tag.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Tag + /// + public partial class Tag : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + /// name + [JsonConstructor] + public Tag(Option id = default, Option name = default) + { + IdOption = id; + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Tag {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TagJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); + + return new Tag(id, name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, tag, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) + { + if (tag.NameOption.IsSet && tag.Name == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + + if (tag.IdOption.IsSet) + writer.WriteNumber("id", tag.IdOption.Value!.Value); + + if (tag.NameOption.IsSet) + writer.WriteString("name", tag.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs new file mode 100644 index 000000000000..f1a1940574ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestCollectionEndingWithWordList + /// + public partial class TestCollectionEndingWithWordList : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// value + [JsonConstructor] + public TestCollectionEndingWithWordList(Option value = default) + { + ValueOption = value; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Value + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ValueOption { get; private set; } + + /// + /// Gets or Sets Value + /// + [JsonPropertyName("value")] + public string? Value { get { return this.ValueOption; } set { this.ValueOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestCollectionEndingWithWordList {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestCollectionEndingWithWordListJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option value = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "value": + value = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (value.IsSet && value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); + + return new TestCollectionEndingWithWordList(value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testCollectionEndingWithWordList, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) + { + if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + + if (testCollectionEndingWithWordList.ValueOption.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs new file mode 100644 index 000000000000..ed3d3f74081b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -0,0 +1,180 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestCollectionEndingWithWordListObject + /// + public partial class TestCollectionEndingWithWordListObject : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// testCollectionEndingWithWordList + [JsonConstructor] + public TestCollectionEndingWithWordListObject(Option?> testCollectionEndingWithWordList = default) + { + TestCollectionEndingWithWordListOption = testCollectionEndingWithWordList; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of TestCollectionEndingWithWordList + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> TestCollectionEndingWithWordListOption { get; private set; } + + /// + /// Gets or Sets TestCollectionEndingWithWordList + /// + [JsonPropertyName("TestCollectionEndingWithWordList")] + public List? TestCollectionEndingWithWordList { get { return this.TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestCollectionEndingWithWordListObject {\n"); + sb.Append(" TestCollectionEndingWithWordList: ").Append(TestCollectionEndingWithWordList).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestCollectionEndingWithWordListObjectJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> testCollectionEndingWithWordList = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "TestCollectionEndingWithWordList": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); + + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testCollectionEndingWithWordListObject, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) + { + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) + { + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs new file mode 100644 index 000000000000..102413449b18 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestInlineFreeformAdditionalPropertiesRequest + /// + public partial class TestInlineFreeformAdditionalPropertiesRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// someProperty + [JsonConstructor] + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) + { + SomePropertyOption = someProperty; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of SomeProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SomePropertyOption { get; private set; } + + /// + /// Gets or Sets SomeProperty + /// + [JsonPropertyName("someProperty")] + public string? SomeProperty { get { return this.SomePropertyOption; } set { this.SomePropertyOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.Append(" SomeProperty: ").Append(SomeProperty).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestInlineFreeformAdditionalPropertiesRequestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option someProperty = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "someProperty": + someProperty = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (someProperty.IsSet && someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); + + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testInlineFreeformAdditionalPropertiesRequest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) + { + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Triangle.cs new file mode 100644 index 000000000000..f34f2cf60139 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Triangle.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Triangle + /// + public partial class Triangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(EquilateralTriangle equilateralTriangle) + { + EquilateralTriangle = equilateralTriangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(IsoscelesTriangle isoscelesTriangle) + { + IsoscelesTriangle = isoscelesTriangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(ScaleneTriangle scaleneTriangle) + { + ScaleneTriangle = scaleneTriangle; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets EquilateralTriangle + /// + public EquilateralTriangle? EquilateralTriangle { get; set; } + + /// + /// Gets or Sets IsoscelesTriangle + /// + public IsoscelesTriangle? IsoscelesTriangle { get; set; } + + /// + /// Gets or Sets ScaleneTriangle + /// + public ScaleneTriangle? ScaleneTriangle { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Triangle {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option triangleType = default; + + EquilateralTriangle? equilateralTriangle = null; + IsoscelesTriangle? isoscelesTriangle = null; + ScaleneTriangle? scaleneTriangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("triangleType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("EquilateralTriangle") ?? false) + { + Utf8JsonReader utf8JsonReaderEquilateralTriangle = utf8JsonReader; + equilateralTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderEquilateralTriangle, jsonSerializerOptions); + } + if (discriminator?.Equals("IsoscelesTriangle") ?? false) + { + Utf8JsonReader utf8JsonReaderIsoscelesTriangle = utf8JsonReader; + isoscelesTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderIsoscelesTriangle, jsonSerializerOptions); + } + if (discriminator?.Equals("ScaleneTriangle") ?? false) + { + Utf8JsonReader utf8JsonReaderScaleneTriangle = utf8JsonReader; + scaleneTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderScaleneTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); + + if (equilateralTriangle != null) + return new Triangle(equilateralTriangle); + + if (isoscelesTriangle != null) + return new Triangle(isoscelesTriangle); + + if (scaleneTriangle != null) + return new Triangle(scaleneTriangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (triangle.EquilateralTriangle != null) + { + EquilateralTriangleJsonConverter equilateralTriangleJsonConverter = (EquilateralTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.EquilateralTriangle.GetType())); + equilateralTriangleJsonConverter.WriteProperties(writer, triangle.EquilateralTriangle, jsonSerializerOptions); + } + + if (triangle.IsoscelesTriangle != null) + { + IsoscelesTriangleJsonConverter isoscelesTriangleJsonConverter = (IsoscelesTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.IsoscelesTriangle.GetType())); + isoscelesTriangleJsonConverter.WriteProperties(writer, triangle.IsoscelesTriangle, jsonSerializerOptions); + } + + if (triangle.ScaleneTriangle != null) + { + ScaleneTriangleJsonConverter scaleneTriangleJsonConverter = (ScaleneTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.ScaleneTriangle.GetType())); + scaleneTriangleJsonConverter.WriteProperties(writer, triangle.ScaleneTriangle, jsonSerializerOptions); + } + + WriteProperties(writer, triangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs new file mode 100644 index 000000000000..6ccbe196f3d4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -0,0 +1,171 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TriangleInterface + /// + public partial class TriangleInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// triangleType + [JsonConstructor] + public TriangleInterface(string triangleType) + { + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TriangleInterface {\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TriangleInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + return new TriangleInterface(triangleType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, triangleInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + + writer.WriteString("triangleType", triangleInterface.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs new file mode 100644 index 000000000000..7b55e2baf5bc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/User.cs @@ -0,0 +1,499 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// User + /// + public partial class User : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// 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 + /// 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. + /// email + /// firstName + /// id + /// lastName + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// password + /// phone + /// User Status + /// username + [JsonConstructor] + public User(Option anyTypeProp = default, Option anyTypePropNullable = default, Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option objectWithNoDeclaredPropsNullable = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default) + { + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; + EmailOption = email; + FirstNameOption = firstName; + IdOption = id; + LastNameOption = lastName; + ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; + PasswordOption = password; + PhoneOption = phone; + UserStatusOption = userStatus; + UsernameOption = username; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropOption { get; private set; } + + /// + /// 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 + /// + /// 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 + [JsonPropertyName("anyTypeProp")] + public Object? AnyTypeProp { get { return this.AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropNullableOption { get; private set; } + + /// + /// 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. + /// + /// 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. + [JsonPropertyName("anyTypePropNullable")] + public Object? AnyTypePropNullable { get { return this.AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } + + /// + /// Used to track the state of Email + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EmailOption { get; private set; } + + /// + /// Gets or Sets Email + /// + [JsonPropertyName("email")] + public string? Email { get { return this.EmailOption; } set { this.EmailOption = new(value); } } + + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FirstNameOption { get; private set; } + + /// + /// Gets or Sets FirstName + /// + [JsonPropertyName("firstName")] + public string? FirstName { get { return this.FirstNameOption; } set { this.FirstNameOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option LastNameOption { get; private set; } + + /// + /// Gets or Sets LastName + /// + [JsonPropertyName("lastName")] + public string? LastName { get { return this.LastNameOption; } set { this.LastNameOption = new(value); } } + + /// + /// Used to track the state of ObjectWithNoDeclaredProps + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsOption { get; private set; } + + /// + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + [JsonPropertyName("objectWithNoDeclaredProps")] + public Object? ObjectWithNoDeclaredProps { get { return this.ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } + + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } + + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + [JsonPropertyName("objectWithNoDeclaredPropsNullable")] + public Object? ObjectWithNoDeclaredPropsNullable { get { return this.ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } + + /// + /// Used to track the state of Password + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PasswordOption { get; private set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string? Password { get { return this.PasswordOption; } set { this.PasswordOption = new(value); } } + + /// + /// Used to track the state of Phone + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PhoneOption { get; private set; } + + /// + /// Gets or Sets Phone + /// + [JsonPropertyName("phone")] + public string? Phone { get { return this.PhoneOption; } set { this.PhoneOption = new(value); } } + + /// + /// Used to track the state of UserStatus + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UserStatusOption { get; private set; } + + /// + /// User Status + /// + /// User Status + [JsonPropertyName("userStatus")] + public int? UserStatus { get { return this.UserStatusOption; } set { this.UserStatusOption = new(value); } } + + /// + /// Used to track the state of Username + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UsernameOption { get; private set; } + + /// + /// Gets or Sets Username + /// + [JsonPropertyName("username")] + public string? Username { get { return this.UsernameOption; } set { this.UsernameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class User {\n"); + sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); + sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append("\n"); + sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); + sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class UserJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option objectWithNoDeclaredPropsNullable = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "anyTypeProp": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "anyTypePropNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "email": + email = new Option(utf8JsonReader.GetString()!); + break; + case "firstName": + firstName = new Option(utf8JsonReader.GetString()!); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "lastName": + lastName = new Option(utf8JsonReader.GetString()!); + break; + case "objectWithNoDeclaredProps": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "objectWithNoDeclaredPropsNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "password": + password = new Option(utf8JsonReader.GetString()!); + break; + case "phone": + phone = new Option(utf8JsonReader.GetString()!); + break; + case "userStatus": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + userStatus = new Option(utf8JsonReader.GetInt32()); + break; + case "username": + username = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (email.IsSet && email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); + + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); + + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); + + if (objectWithNoDeclaredProps.IsSet && objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); + + if (phone.IsSet && phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); + + if (userStatus.IsSet && userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); + + if (username.IsSet && username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); + + return new User(anyTypeProp, anyTypePropNullable, email, firstName, id, lastName, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, password, phone, userStatus, username); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, user, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) + { + if (user.EmailOption.IsSet && user.Email == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstNameOption.IsSet && user.FirstName == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastNameOption.IsSet && user.LastName == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.PasswordOption.IsSet && user.Password == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.PhoneOption.IsSet && user.Phone == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.UsernameOption.IsSet && user.Username == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + + if (user.AnyTypePropOption.IsSet) + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.EmailOption.IsSet) + writer.WriteString("email", user.Email); + + if (user.FirstNameOption.IsSet) + writer.WriteString("firstName", user.FirstName); + + if (user.IdOption.IsSet) + writer.WriteNumber("id", user.IdOption.Value!.Value); + + if (user.LastNameOption.IsSet) + writer.WriteString("lastName", user.LastName); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet) + { + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + } + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); + if (user.PasswordOption.IsSet) + writer.WriteString("password", user.Password); + + if (user.PhoneOption.IsSet) + writer.WriteString("phone", user.Phone); + + if (user.UserStatusOption.IsSet) + writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); + + if (user.UsernameOption.IsSet) + writer.WriteString("username", user.Username); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs new file mode 100644 index 000000000000..a655c0d30e99 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Whale.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Whale + /// + public partial class Whale : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + /// hasBaleen + /// hasTeeth + [JsonConstructor] + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) + { + ClassName = className; + HasBaleenOption = hasBaleen; + HasTeethOption = hasTeeth; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Used to track the state of HasBaleen + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option HasBaleenOption { get; private set; } + + /// + /// Gets or Sets HasBaleen + /// + [JsonPropertyName("hasBaleen")] + public bool? HasBaleen { get { return this.HasBaleenOption; } set { this.HasBaleenOption = new(value); } } + + /// + /// Used to track the state of HasTeeth + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option HasTeethOption { get; private set; } + + /// + /// Gets or Sets HasTeeth + /// + [JsonPropertyName("hasTeeth")] + public bool? HasTeeth { get { return this.HasTeethOption; } set { this.HasTeethOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Whale {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" HasBaleen: ").Append(HasBaleen).Append("\n"); + sb.Append(" HasTeeth: ").Append(HasTeeth).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class WhaleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "hasBaleen": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + hasBaleen = new Option(utf8JsonReader.GetBoolean()); + break; + case "hasTeeth": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + hasTeeth = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Whale.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); + + if (hasBaleen.IsSet && hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); + + if (hasTeeth.IsSet && hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); + + return new Whale(className.Value!, hasBaleen, hasTeeth); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, whale, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) + { + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + + writer.WriteString("className", whale.ClassName); + + if (whale.HasBaleenOption.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); + + if (whale.HasTeethOption.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs new file mode 100644 index 000000000000..4ca12a36d096 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/Zebra.cs @@ -0,0 +1,279 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Zebra + /// + public partial class Zebra : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + /// type + [JsonConstructor] + public Zebra(string className, Option type = default) + { + ClassName = className; + TypeOption = type; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines Type + /// + public enum TypeEnum + { + /// + /// Enum Plains for value: plains + /// + Plains = 1, + + /// + /// Enum Mountain for value: mountain + /// + Mountain = 2, + + /// + /// Enum Grevys for value: grevys + /// + Grevys = 3 + } + + /// + /// Returns a + /// + /// + /// + /// + public static TypeEnum TypeEnumFromString(string value) + { + if (value.Equals("plains")) + return TypeEnum.Plains; + + if (value.Equals("mountain")) + return TypeEnum.Mountain; + + if (value.Equals("grevys")) + return TypeEnum.Grevys; + + throw new NotImplementedException($"Could not convert value to type TypeEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static TypeEnum? TypeEnumFromStringOrDefault(string value) + { + if (value.Equals("plains")) + return TypeEnum.Plains; + + if (value.Equals("mountain")) + return TypeEnum.Mountain; + + if (value.Equals("grevys")) + return TypeEnum.Grevys; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string TypeEnumToJsonValue(TypeEnum? value) + { + if (value == TypeEnum.Plains) + return "plains"; + + if (value == TypeEnum.Mountain) + return "mountain"; + + if (value == TypeEnum.Grevys) + return "grevys"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TypeOption { get; private set; } + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Zebra {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ZebraJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option type = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "type": + string? typeRawValue = utf8JsonReader.GetString(); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + + return new Zebra(className.Value!, type); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, zebra, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) + { + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + + writer.WriteString("className", zebra.ClassName); + + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); + writer.WriteString("type", typeRawValue); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs new file mode 100644 index 000000000000..1db14d35a9e5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -0,0 +1,176 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + } + + /// + /// Converts to and from the JSON value + /// + public static class ZeroBasedEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnum FromString(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnum? FromStringOrDefault(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnum.NotUnknown; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(ZeroBasedEnum value) + { + if (value == ZeroBasedEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class ZeroBasedEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + ZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the ZeroBasedEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnum zeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnum.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class ZeroBasedEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a ZeroBasedEnum from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + ZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnum? zeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnum?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 000000000000..dfb395124397 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + public partial class ZeroBasedEnumClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum + [JsonConstructor] + public ZeroBasedEnumClass(Option zeroBasedEnum = default) + { + ZeroBasedEnumOption = zeroBasedEnum; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + } + + /// + /// Returns a + /// + /// + /// + /// + public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnumEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnumEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnumEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static ZeroBasedEnumEnum? ZeroBasedEnumEnumFromStringOrDefault(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnumEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnumEnum.NotUnknown; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) + { + if (value == ZeroBasedEnumEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnumEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of ZeroBasedEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ZeroBasedEnumOption { get; private set; } + + /// + /// Gets or Sets ZeroBasedEnum + /// + [JsonPropertyName("ZeroBasedEnum")] + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ZeroBasedEnumClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option zeroBasedEnum = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ZeroBasedEnum": + string? zeroBasedEnumRawValue = utf8JsonReader.GetString(); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); + break; + default: + break; + } + } + } + + if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); + + return new ZeroBasedEnumClass(zeroBasedEnum); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, zeroBasedEnumClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); + writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..36cbc4f59ca3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,32 @@ + + + + true + net9.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + enable + false + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..b0c1678a304f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/README.md @@ -0,0 +1,223 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net9.0', + 'validatable=true', + 'nullableReferenceTypes=true', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + Call123TestSpecialTagsApiResponse apiResponse = await api.Call123TestSpecialTagsAsync("todo"); + ModelClient model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + // the type of token here depends on the api security specifications + ApiKeyToken token = new("", ClientUtils.ApiKeyHeader.Authorization); + options.AddTokens(token); + + // optionally choose the method the tokens will be provided with, default is RateLimitProvider + options.UseProvider, ApiKeyToken>(); + + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: +- write:pets: modify pets in your account +- read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api-key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: Bearer Authentication + + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.11.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: OpenAPI Petstore +- appVersion: 1.0.0 +- appDescription: This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: false +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: true +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net9.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/.gitignore b/samples/client/petstore/csharp/generichost/net9/OneOf/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net9/OneOf/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/OneOf/.openapi-generator/FILES new file mode 100644 index 000000000000..dc42a5d47091 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/.openapi-generator/FILES @@ -0,0 +1,42 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/DefaultApi.md +docs/models/Apple.md +docs/models/Banana.md +docs/models/Fruit.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/Apple.cs +src/Org.OpenAPITools/Model/Banana.cs +src/Org.OpenAPITools/Model/Fruit.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net9/OneOf/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net9/OneOf/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/README.md b/samples/client/petstore/csharp/generichost/net9/OneOf/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/OneOf/api/openapi.yaml new file mode 100644 index 000000000000..06fd58be740a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/api/openapi.yaml @@ -0,0 +1,41 @@ +openapi: 3.0.1 +info: + title: fruity + version: 0.0.1 +servers: +- url: / +paths: + /: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/fruit' + description: desc +components: + schemas: + fruit: + example: + color: color + oneOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + properties: + color: + type: string + title: fruit + apple: + properties: + kind: + type: string + title: apple + type: object + banana: + properties: + count: + type: number + title: banana + type: object + diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/appveyor.yml b/samples/client/petstore/csharp/generichost/net9/OneOf/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/apis/DefaultApi.md new file mode 100644 index 000000000000..bccf3af9c516 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/apis/DefaultApi.md @@ -0,0 +1,90 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**RootGet**](DefaultApi.md#rootget) | **GET** / | | + + +# **RootGet** +> Fruit RootGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class RootGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://localhost"; + var apiInstance = new DefaultApi(config); + + try + { + Fruit result = apiInstance.RootGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.RootGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the RootGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.RootGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.RootGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**Fruit**](Fruit.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | desc | - | + +[[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/csharp/generichost/net9/OneOf/docs/models/Apple.md b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/models/Apple.md new file mode 100644 index 000000000000..95f575834399 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/models/Apple.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Kind** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/docs/models/Banana.md b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/models/Banana.md new file mode 100644 index 000000000000..c9aea6fb56c8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/models/Banana.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Count** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/docs/models/Fruit.md b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/models/Fruit.md new file mode 100644 index 000000000000..b3bee18f7ba0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/models/Fruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Fruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..5a82cd6c99de --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,58 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 000000000000..b7bcc281037a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,64 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing DefaultApi + /// + public sealed class DefaultApiTests : ApiTestsBase + { + private readonly IDefaultApi _instance; + + public DefaultApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test RootGet + /// + [Fact (Skip = "not implemented")] + public async Task RootGetAsyncTest() + { + var response = await _instance.RootGetAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..4006d2fc6ba6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,103 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Model/AppleTests.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Model/AppleTests.cs new file mode 100644 index 000000000000..483628b6a4a0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Model/AppleTests.cs @@ -0,0 +1,65 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Apple + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Apple + //private Apple instance; + + public AppleTests() + { + // TODO uncomment below to create an instance of Apple + //instance = new Apple(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Apple + /// + [Fact] + public void AppleInstanceTest() + { + // TODO uncomment below to test "IsType" Apple + //Assert.IsType(instance); + } + + /// + /// Test the property 'Kind' + /// + [Fact] + public void KindTest() + { + // TODO unit test for the property 'Kind' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Model/BananaTests.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Model/BananaTests.cs new file mode 100644 index 000000000000..5befec8d7e5f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Model/BananaTests.cs @@ -0,0 +1,65 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Banana + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Banana + //private Banana instance; + + public BananaTests() + { + // TODO uncomment below to create an instance of Banana + //instance = new Banana(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Banana + /// + [Fact] + public void BananaInstanceTest() + { + // TODO uncomment below to test "IsType" Banana + //Assert.IsType(instance); + } + + /// + /// Test the property 'Count' + /// + [Fact] + public void CountTest() + { + // TODO unit test for the property 'Count' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Model/FruitTests.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Model/FruitTests.cs new file mode 100644 index 000000000000..a6607ae5d56d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Model/FruitTests.cs @@ -0,0 +1,65 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Fruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Fruit + //private Fruit instance; + + public FruitTests() + { + // TODO uncomment below to create an instance of Fruit + //instance = new Fruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Fruit + /// + [Fact] + public void FruitInstanceTest() + { + // TODO uncomment below to test "IsType" Fruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..a4e283f2d333 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net9.0 + false + enable + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..030cc3bf12e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,332 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IDefaultApi : IApi + { + /// + /// The class containing the events + /// + DefaultApiEvents Events { get; } + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task RootGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task RootGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IRootGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class DefaultApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnRootGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorRootGet; + + internal void ExecuteOnRootGet(DefaultApi.RootGetApiResponse apiResponse) + { + OnRootGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorRootGet(Exception exception) + { + OnErrorRootGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class DefaultApi : IDefaultApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public DefaultApiEvents Events { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = defaultApiEvents; + } + + /// + /// Processes the server response + /// + /// + private void AfterRootGetDefaultImplementation(IRootGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterRootGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterRootGet(ref bool suppressDefaultLog, IRootGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorRootGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorRootGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorRootGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task RootGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await RootGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task RootGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + RootGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/", requestedAtLocalVar, _jsonSerializerOptions); + + AfterRootGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnRootGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorRootGetDefaultImplementation(e, "/", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorRootGet(e); + throw; + } + } + + /// + /// The + /// + public partial class RootGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IRootGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public RootGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Fruit? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Fruit? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..6ca1d86d4a35 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,52 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string? ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..2675478b8b4f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,172 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string? ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri? RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string? ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri? RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk([NotNullWhen(true)]out TType? result); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..17060612c0b4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,333 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using KellermanSoftware.CompareNetObjects; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// An instance of CompareLogic. + /// + public static CompareLogic compareLogic; + + /// + /// Static constructor to initialise compareLogic. + /// + static ClientUtils() + { + ComparisonConfig comparisonConfig = new(); + comparisonConfig.UseHashCodeIdentifier = true; + compareLogic = new(comparisonConfig); + } + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string? SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// 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) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string? SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://localhost"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = ""; + + /// + /// The host of the API + /// + public const string HOST = "localhost"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..85093b0c1fee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,20 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..5009ae5304f7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -0,0 +1,61 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..02dda463ab26 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -0,0 +1,66 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..4be8e3a725e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,75 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..06d46536f037 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,80 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..f711f9f3c7ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..0cffc3195908 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,135 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new AppleJsonConverter()); + _jsonOptions.Converters.Add(new BananaJsonConverter()); + _jsonOptions.Converters.Add(new FruitJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action? client = null, Action? builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..0184d9ad9446 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,27 @@ +// + +#nullable enable + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..6f4db75a4454 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,53 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..b10d5ac58f56 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -0,0 +1,57 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..3f713a2ef4bb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,71 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..7b0f23d28a4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,37 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..db3ce767d4af --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,44 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..f0f8143d7f5e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,59 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..d6540c10a71f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -0,0 +1,79 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..387a17e202fc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -0,0 +1,73 @@ +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static void AddApi(this IServiceCollection services) + { + HostConfiguration config = new(services); + AddApi(services, config); + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Apple.cs new file mode 100644 index 000000000000..dd3528fa42a4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -0,0 +1,176 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Apple + /// + public partial class Apple : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// kind + [JsonConstructor] + public Apple(Option kind = default) + { + KindOption = kind; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Kind + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option KindOption { get; private set; } + + /// + /// Gets or Sets Kind + /// + [JsonPropertyName("kind")] + public string? Kind { get { return this.KindOption; } set { this.KindOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Apple {\n"); + sb.Append(" Kind: ").Append(Kind).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option kind = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "kind": + kind = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (kind.IsSet && kind.Value == null) + throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); + + return new Apple(kind); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apple, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + if (apple.KindOption.IsSet && apple.Kind == null) + throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + + if (apple.KindOption.IsSet) + writer.WriteString("kind", apple.Kind); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs new file mode 100644 index 000000000000..66a33723aebc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -0,0 +1,174 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Banana + /// + public partial class Banana : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// count + [JsonConstructor] + public Banana(Option count = default) + { + CountOption = count; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Count + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CountOption { get; private set; } + + /// + /// Gets or Sets Count + /// + [JsonPropertyName("count")] + public decimal? Count { get { return this.CountOption; } set { this.CountOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Banana {\n"); + sb.Append(" Count: ").Append(Count).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option count = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "count": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + count = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (count.IsSet && count.Value == null) + throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); + + return new Banana(count); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, banana, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + if (banana.CountOption.IsSet) + writer.WriteNumber("count", banana.CountOption.Value!.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Fruit.cs new file mode 100644 index 000000000000..d58b2b4db1dd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -0,0 +1,227 @@ +// +/* + * fruity + * + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 0.0.1 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Fruit + /// + public partial class Fruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Apple apple, Option color = default) + { + Apple = apple; + ColorOption = color; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Banana banana, Option color = default) + { + Banana = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Apple + /// + public Apple? Apple { get; set; } + + /// + /// Gets or Sets Banana + /// + public Banana? Banana { get; set; } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Fruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple? apple = default; + Banana? banana = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + if (apple != null) + return new Fruit(apple, color); + + if (banana != null) + return new Fruit(banana, color); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..36cbc4f59ca3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,32 @@ + + + + true + net9.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + enable + false + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..0c161ca9de17 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/OneOf/src/Org.OpenAPITools/README.md @@ -0,0 +1,177 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net9.0', + 'validatable=true', + 'nullableReferenceTypes=true', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + RootGetApiResponse apiResponse = await api.RootGetAsync("todo"); + Fruit model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.11.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: fruity +- appVersion: 0.0.1 +- appDescription: No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: false +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: true +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net9.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/.gitignore b/samples/client/petstore/csharp/generichost/net9/Petstore/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/FILES new file mode 100644 index 000000000000..afb25a1c17e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/FILES @@ -0,0 +1,246 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/AnotherFakeApi.md +docs/apis/DefaultApi.md +docs/apis/FakeApi.md +docs/apis/FakeClassnameTags123Api.md +docs/apis/PetApi.md +docs/apis/StoreApi.md +docs/apis/UserApi.md +docs/models/Activity.md +docs/models/ActivityOutputElementRepresentation.md +docs/models/AdditionalPropertiesClass.md +docs/models/Animal.md +docs/models/ApiResponse.md +docs/models/Apple.md +docs/models/AppleReq.md +docs/models/ArrayOfArrayOfNumberOnly.md +docs/models/ArrayOfNumberOnly.md +docs/models/ArrayTest.md +docs/models/Banana.md +docs/models/BananaReq.md +docs/models/BasquePig.md +docs/models/Capitalization.md +docs/models/Cat.md +docs/models/Category.md +docs/models/ChildCat.md +docs/models/ClassModel.md +docs/models/ComplexQuadrilateral.md +docs/models/DanishPig.md +docs/models/DateOnlyClass.md +docs/models/DeprecatedObject.md +docs/models/Dog.md +docs/models/Drawing.md +docs/models/EnumArrays.md +docs/models/EnumClass.md +docs/models/EnumTest.md +docs/models/EquilateralTriangle.md +docs/models/File.md +docs/models/FileSchemaTestClass.md +docs/models/Foo.md +docs/models/FooGetDefaultResponse.md +docs/models/FormatTest.md +docs/models/Fruit.md +docs/models/FruitReq.md +docs/models/GmFruit.md +docs/models/GrandparentAnimal.md +docs/models/HasOnlyReadOnly.md +docs/models/HealthCheckResult.md +docs/models/IsoscelesTriangle.md +docs/models/List.md +docs/models/LiteralStringClass.md +docs/models/Mammal.md +docs/models/MapTest.md +docs/models/MixLog.md +docs/models/MixedAnyOf.md +docs/models/MixedAnyOfContent.md +docs/models/MixedOneOf.md +docs/models/MixedOneOfContent.md +docs/models/MixedPropertiesAndAdditionalPropertiesClass.md +docs/models/MixedSubId.md +docs/models/Model200Response.md +docs/models/ModelClient.md +docs/models/Name.md +docs/models/NotificationtestGetElementsV1ResponseMPayload.md +docs/models/NullableClass.md +docs/models/NullableGuidClass.md +docs/models/NullableShape.md +docs/models/NumberOnly.md +docs/models/ObjectWithDeprecatedFields.md +docs/models/OneOfString.md +docs/models/Order.md +docs/models/OuterComposite.md +docs/models/OuterEnum.md +docs/models/OuterEnumDefaultValue.md +docs/models/OuterEnumInteger.md +docs/models/OuterEnumIntegerDefaultValue.md +docs/models/OuterEnumTest.md +docs/models/ParentPet.md +docs/models/Pet.md +docs/models/Pig.md +docs/models/PolymorphicProperty.md +docs/models/Quadrilateral.md +docs/models/QuadrilateralInterface.md +docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md +docs/models/Return.md +docs/models/RolesReportsHash.md +docs/models/RolesReportsHashRole.md +docs/models/ScaleneTriangle.md +docs/models/Shape.md +docs/models/ShapeInterface.md +docs/models/ShapeOrNull.md +docs/models/SimpleQuadrilateral.md +docs/models/SpecialModelName.md +docs/models/Tag.md +docs/models/TestCollectionEndingWithWordList.md +docs/models/TestCollectionEndingWithWordListObject.md +docs/models/TestInlineFreeformAdditionalPropertiesRequest.md +docs/models/Triangle.md +docs/models/TriangleInterface.md +docs/models/User.md +docs/models/Whale.md +docs/models/Zebra.md +docs/models/ZeroBasedEnum.md +docs/models/ZeroBasedEnumClass.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/AnotherFakeApi.cs +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/FakeApi.cs +src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Api/PetApi.cs +src/Org.OpenAPITools/Api/StoreApi.cs +src/Org.OpenAPITools/Api/UserApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiKeyToken.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/BasicToken.cs +src/Org.OpenAPITools/Client/BearerToken.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +src/Org.OpenAPITools/Client/HttpSigningToken.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/OAuthToken.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/Activity.cs +src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/Animal.cs +src/Org.OpenAPITools/Model/ApiResponse.cs +src/Org.OpenAPITools/Model/Apple.cs +src/Org.OpenAPITools/Model/AppleReq.cs +src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayTest.cs +src/Org.OpenAPITools/Model/Banana.cs +src/Org.OpenAPITools/Model/BananaReq.cs +src/Org.OpenAPITools/Model/BasquePig.cs +src/Org.OpenAPITools/Model/Capitalization.cs +src/Org.OpenAPITools/Model/Cat.cs +src/Org.OpenAPITools/Model/Category.cs +src/Org.OpenAPITools/Model/ChildCat.cs +src/Org.OpenAPITools/Model/ClassModel.cs +src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +src/Org.OpenAPITools/Model/DanishPig.cs +src/Org.OpenAPITools/Model/DateOnlyClass.cs +src/Org.OpenAPITools/Model/DeprecatedObject.cs +src/Org.OpenAPITools/Model/Dog.cs +src/Org.OpenAPITools/Model/Drawing.cs +src/Org.OpenAPITools/Model/EnumArrays.cs +src/Org.OpenAPITools/Model/EnumClass.cs +src/Org.OpenAPITools/Model/EnumTest.cs +src/Org.OpenAPITools/Model/EquilateralTriangle.cs +src/Org.OpenAPITools/Model/File.cs +src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +src/Org.OpenAPITools/Model/FormatTest.cs +src/Org.OpenAPITools/Model/Fruit.cs +src/Org.OpenAPITools/Model/FruitReq.cs +src/Org.OpenAPITools/Model/GmFruit.cs +src/Org.OpenAPITools/Model/GrandparentAnimal.cs +src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +src/Org.OpenAPITools/Model/HealthCheckResult.cs +src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs +src/Org.OpenAPITools/Model/Mammal.cs +src/Org.OpenAPITools/Model/MapTest.cs +src/Org.OpenAPITools/Model/MixLog.cs +src/Org.OpenAPITools/Model/MixedAnyOf.cs +src/Org.OpenAPITools/Model/MixedAnyOfContent.cs +src/Org.OpenAPITools/Model/MixedOneOf.cs +src/Org.OpenAPITools/Model/MixedOneOfContent.cs +src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/MixedSubId.cs +src/Org.OpenAPITools/Model/Model200Response.cs +src/Org.OpenAPITools/Model/ModelClient.cs +src/Org.OpenAPITools/Model/Name.cs +src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +src/Org.OpenAPITools/Model/NullableClass.cs +src/Org.OpenAPITools/Model/NullableGuidClass.cs +src/Org.OpenAPITools/Model/NullableShape.cs +src/Org.OpenAPITools/Model/NumberOnly.cs +src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +src/Org.OpenAPITools/Model/OneOfString.cs +src/Org.OpenAPITools/Model/Order.cs +src/Org.OpenAPITools/Model/OuterComposite.cs +src/Org.OpenAPITools/Model/OuterEnum.cs +src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumInteger.cs +src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumTest.cs +src/Org.OpenAPITools/Model/ParentPet.cs +src/Org.OpenAPITools/Model/Pet.cs +src/Org.OpenAPITools/Model/Pig.cs +src/Org.OpenAPITools/Model/PolymorphicProperty.cs +src/Org.OpenAPITools/Model/Quadrilateral.cs +src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs +src/Org.OpenAPITools/Model/Return.cs +src/Org.OpenAPITools/Model/RolesReportsHash.cs +src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +src/Org.OpenAPITools/Model/ScaleneTriangle.cs +src/Org.OpenAPITools/Model/Shape.cs +src/Org.OpenAPITools/Model/ShapeInterface.cs +src/Org.OpenAPITools/Model/ShapeOrNull.cs +src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +src/Org.OpenAPITools/Model/SpecialModelName.cs +src/Org.OpenAPITools/Model/Tag.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +src/Org.OpenAPITools/Model/Triangle.cs +src/Org.OpenAPITools/Model/TriangleInterface.cs +src/Org.OpenAPITools/Model/User.cs +src/Org.OpenAPITools/Model/Whale.cs +src/Org.OpenAPITools/Model/Zebra.cs +src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net9/Petstore/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/README.md b/samples/client/petstore/csharp/generichost/net9/Petstore/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml new file mode 100644 index 000000000000..780d21e19bfa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml @@ -0,0 +1,3088 @@ +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: + /roles/report: + get: + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/RolesReport' + type: array + description: returns report + /hello: + get: + description: Hello + operationId: Hello + responses: + "200": + content: + application/json: + schema: + items: + format: uuid + type: string + type: array + description: UUIDs + summary: Hello + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/_foo_get_default_response' + description: response + /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 + 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 + 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: + "2XX": + description: Anything within 200-299 + "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 + "4XX": + description: Anything within 400-499 + security: + - http_signature_test: [] + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /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 + /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 + 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: [] + - api_key_query: [] + summary: Find pet by ID + tags: + - pet + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/updatePetWithForm_request' + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + 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 + /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 + /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 + /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 + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate 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 + /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 + /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 + /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 + /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: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + 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 + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /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 + 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 + "598": + description: Not a real HTTP status code + "599": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Not a real HTTP status code with a return object + summary: Get user by user name + tags: + - user + 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 + /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#$%^ + /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: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + 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: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEnumParameters_request' + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + 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 + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEndpointParameters_request' + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + /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 + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + parameters: + - description: Required UUID String + explode: true + in: query + name: required_string_uuid + required: true + schema: + format: uuid + type: string + style: form + 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 + /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 + /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 + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testJsonFormData_request' + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MapOfString' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + /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 + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/testInlineFreeformAdditionalProperties_request' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + /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 + /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? + /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 + /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 + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form + responses: + "200": + description: Success + tags: + - fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFileWithRequiredFile_request' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + /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 + /fake/mixed/anyOf: + get: + operationId: getMixedAnyOf + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MixedAnyOf' + description: Got mixed anyOf + summary: Test mixed type anyOf deserialization + tags: + - fake + /fake/mixed/oneOf: + get: + operationId: getMixedOneOf + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MixedOneOf' + description: Got mixed oneOf + summary: Test mixed type oneOf deserialization + tags: + - fake + /country: + post: + operationId: getCountry + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/getCountry_request' + responses: + "200": + description: OK + /test: + get: + operationId: Test + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/notificationtest-getElements-v1-Response-mPayload' + description: Successful response + summary: Retrieve an existing Notificationtest's Elements +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 + schemas: + RolesReport: + description: Roles report + items: + $ref: '#/components/schemas/RolesReportsHash' + type: array + RolesReportsHash: + description: Role report Hash + example: + role: + name: name + role_uuid: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + role_uuid: + format: uuid + type: string + role: + $ref: '#/components/schemas/RolesReportsHash_role' + type: object + 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 + lock: + type: string + abstract: + nullable: true + type: string + unsafe: + type: string + required: + - abstract + - lock + 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' + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' + - properties: + declawed: + type: boolean + type: object + 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 + int32Range: + maximum: 2147483647 + minimum: -2147483648 + type: integer + int64Positive: + minimum: 2147483648 + type: integer + int64Negative: + maximum: -2147483649 + type: integer + int64PositiveExclusive: + exclusiveMinimum: true + minimum: 2147483647 + type: integer + int64NegativeExclusive: + exclusiveMaximum: true + maximum: -2147483648 + type: integer + unsigned_integer: + format: int32 + maximum: 200 + minimum: 20 + type: integer + x-unsigned: true + int64: + format: int64 + type: integer + unsigned_long: + format: int64 + type: integer + x-unsigned: true + 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 + pattern_with_backslash: + description: None + pattern: "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\\\ + /([0-9]|[1-2][0-9]|3[0-2]))$" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Outer_Enum_Test: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + 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_with_pattern: + format: uuid + pattern: "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + type: string + 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 + x-cls-compliant: true + x-com-visible: true + 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 + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + 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 + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + 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 + color_code: + pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$" + 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 + nullable: true + oneOf: + - $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 + nullable: true + oneOf: + - $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' + - properties: + name: + type: string + pet_type: + default: ChildCat + enum: + - ChildCat + type: string + x-enum-as-string: true + required: + - pet_type + type: object + 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 + PolymorphicProperty: + oneOf: + - type: boolean + - type: string + - type: object + - items: + $ref: '#/components/schemas/StringArrayItem' + type: array + StringArrayItem: + format: string + type: string + Activity: + description: test map of maps + properties: + activity_outputs: + additionalProperties: + $ref: '#/components/schemas/ActivityOutputRepresentation' + type: object + type: object + ActivityOutputRepresentation: + items: + $ref: '#/components/schemas/ActivityOutputElementRepresentation' + type: array + ActivityOutputElementRepresentation: + properties: + prop1: + type: string + prop2: + type: object + type: object + NullableGuidClass: + properties: + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + type: object + DateOnlyClass: + properties: + dateOnlyProperty: + example: 2017-07-21 + format: date + type: string + type: object + TestCollectionEndingWithWordListObject: + properties: + TestCollectionEndingWithWordList: + items: + $ref: '#/components/schemas/TestCollectionEndingWithWordList' + type: array + type: object + TestCollectionEndingWithWordList: + properties: + value: + type: string + type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object + OneOfString: + oneOf: + - pattern: ^a + type: string + - pattern: ^b + type: string + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object + Custom-Variableobject-Response: + additionalProperties: true + description: A Variable object without predefined property names + type: object + Field-pkiNotificationtestID: + type: integer + notificationtest-getElements-v1-Response-mPayload: + example: + a_objVariableobject: + - null + - null + pkiNotificationtestID: 0 + properties: + pkiNotificationtestID: + type: integer + a_objVariableobject: + items: + $ref: '#/components/schemas/Custom-Variableobject-Response' + type: array + required: + - a_objVariableobject + - pkiNotificationtestID + type: object + MixedOneOf: + example: + content: MixedOneOf_content + properties: + content: + $ref: '#/components/schemas/MixedOneOf_content' + MixedAnyOf: + example: + content: MixedAnyOf_content + properties: + content: + $ref: '#/components/schemas/MixedAnyOf_content' + MixedSubId: + properties: + id: + type: string + MixLog: + properties: + id: + format: uuid + type: string + description: + type: string + mixDate: + format: date-time + type: string + shopId: + format: uuid + type: string + totalPrice: + format: float + nullable: true + type: number + totalRecalculations: + format: int32 + type: integer + totalOverPoors: + format: int32 + type: integer + totalSkips: + format: int32 + type: integer + totalUnderPours: + format: int32 + type: integer + formulaVersionDate: + format: date-time + type: string + someCode: + description: SomeCode is only required for color mixes + nullable: true + type: string + batchNumber: + type: string + brandCode: + description: BrandCode is only required for non-color mixes + type: string + brandId: + description: BrandId is only required for color mixes + type: string + brandName: + description: BrandName is only required for color mixes + type: string + categoryCode: + description: CategoryCode is not used anymore + type: string + color: + description: Color is only required for color mixes + type: string + colorDescription: + type: string + comment: + type: string + commercialProductCode: + type: string + productLineCode: + description: ProductLineCode is only required for color mixes + type: string + country: + type: string + createdBy: + type: string + createdByFirstName: + type: string + createdByLastName: + type: string + deltaECalculationRepaired: + type: string + deltaECalculationSprayout: + type: string + ownColorVariantNumber: + format: int32 + nullable: true + type: integer + primerProductId: + type: string + productId: + description: ProductId is only required for color mixes + type: string + productName: + description: ProductName is only required for color mixes + type: string + selectedVersionIndex: + format: int32 + type: integer + required: + - description + - formulaVersionDate + - id + - mixDate + - totalOverPoors + - totalRecalculations + - totalSkips + - totalUnderPours + type: object + uuid: + format: uuid + type: string + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + 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 + testEndpointParameters_request: + 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 + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + getCountry_request: + allOf: + - properties: + country: + type: string + required: + - country + type: object + RolesReportsHash_role: + example: + name: name + properties: + name: + type: string + type: object + MixedOneOf_content: + description: Mixed oneOf types for testing + oneOf: + - type: string + - type: boolean + - format: uint8 + type: integer + - format: float32 + type: number + - $ref: '#/components/schemas/MixedSubId' + MixedAnyOf_content: + anyOf: + - type: string + - type: boolean + - format: uint8 + type: integer + - format: float32 + type: number + - $ref: '#/components/schemas/MixedSubId' + description: Mixed anyOf types for testing + 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/csharp/generichost/net9/Petstore/appveyor.yml b/samples/client/petstore/csharp/generichost/net9/Petstore/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/AnotherFakeApi.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/AnotherFakeApi.md new file mode 100644 index 000000000000..369488986579 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/AnotherFakeApi.md @@ -0,0 +1,99 @@ +# Org.OpenAPITools.Api.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** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class Call123TestSpecialTagsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new AnotherFakeApi(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test special tags + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the Call123TestSpecialTagsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test special tags + ApiResponse response = apiInstance.Call123TestSpecialTagsWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTagsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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/csharp/generichost/net9/Petstore/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/DefaultApi.md new file mode 100644 index 000000000000..0bdfd6af3474 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/DefaultApi.md @@ -0,0 +1,429 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | | +| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | | +| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello | +| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | | +| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements | + + +# **FooGet** +> FooGetDefaultResponse FooGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FooGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + FooGetDefaultResponse result = apiInstance.FooGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.FooGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FooGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FooGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.FooGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.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 | - | + +[[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) + + +# **GetCountry** +> void GetCountry (string country) + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetCountryExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + var country = "country_example"; // string | + + try + { + apiInstance.GetCountry(country); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.GetCountry: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetCountryWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.GetCountryWithHttpInfo(country); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.GetCountryWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **country** | **string** | | | + +### Return type + +void (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** | OK | - | + +[[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) + + +# **Hello** +> List<Guid> Hello () + +Hello + +Hello + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class HelloExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + // Hello + List result = apiInstance.Hello(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.Hello: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the HelloWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Hello + ApiResponse> response = apiInstance.HelloWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.HelloWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**List** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | UUIDs | - | + +[[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) + + +# **RolesReportGet** +> List<List<RolesReportsHash>> RolesReportGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class RolesReportGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + List> result = apiInstance.RolesReportGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.RolesReportGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the RolesReportGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse>> response = apiInstance.RolesReportGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.RolesReportGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**List>** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | returns report | - | + +[[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** +> NotificationtestGetElementsV1ResponseMPayload Test () + +Retrieve an existing Notificationtest's Elements + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + // Retrieve an existing Notificationtest's Elements + NotificationtestGetElementsV1ResponseMPayload result = apiInstance.Test(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.Test: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Retrieve an existing Notificationtest's Elements + ApiResponse response = apiInstance.TestWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.TestWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**NotificationtestGetElementsV1ResponseMPayload**](NotificationtestGetElementsV1ResponseMPayload.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful response | - | + +[[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/csharp/generichost/net9/Petstore/docs/apis/FakeApi.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/FakeApi.md new file mode 100644 index 000000000000..ba7ed134222e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/FakeApi.md @@ -0,0 +1,1830 @@ +# Org.OpenAPITools.Api.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 | +| [**GetMixedAnyOf**](FakeApi.md#getmixedanyof) | **GET** /fake/mixed/anyOf | Test mixed type anyOf deserialization | +| [**GetMixedOneOf**](FakeApi.md#getmixedoneof) | **GET** /fake/mixed/oneOf | Test mixed type oneOf deserialization | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**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 | +| [**TestInlineFreeformAdditionalProperties**](FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**TestQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | | +| [**TestStringMapReference**](FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map | + + +# **FakeHealthGet** +> HealthCheckResult FakeHealthGet () + +Health check endpoint + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeHealthGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Health check endpoint + HealthCheckResult result = apiInstance.FakeHealthGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeHealthGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeHealthGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Health check endpoint + ApiResponse response = apiInstance.FakeHealthGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeHealthGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **FakeOuterBooleanSerialize** +> bool FakeOuterBooleanSerialize (bool body = null) + + + +Test serialization of outer boolean types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterBooleanSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var body = true; // bool | Input boolean as post body (optional) + + try + { + bool result = apiInstance.FakeOuterBooleanSerialize(body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterBooleanSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterBooleanSerializeWithHttpInfo(body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **body** | **bool** | Input boolean as post body | [optional] | + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + +[[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) + + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize (OuterComposite outerComposite = null) + + + +Test serialization of object with outer number type + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterCompositeSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body (optional) + + try + { + OuterComposite result = apiInstance.FakeOuterCompositeSerialize(outerComposite); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterCompositeSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterCompositeSerializeWithHttpInfo(outerComposite); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **FakeOuterNumberSerialize** +> decimal FakeOuterNumberSerialize (decimal body = null) + + + +Test serialization of outer number types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterNumberSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var body = 8.14D; // decimal | Input number as post body (optional) + + try + { + decimal result = apiInstance.FakeOuterNumberSerialize(body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterNumberSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterNumberSerializeWithHttpInfo(body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + +[[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) + + +# **FakeOuterStringSerialize** +> string FakeOuterStringSerialize (Guid requiredStringUuid, string body = null) + + + +Test serialization of outer string types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterStringSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requiredStringUuid = "requiredStringUuid_example"; // Guid | Required UUID String + var body = "body_example"; // string | Input string as post body (optional) + + try + { + string result = apiInstance.FakeOuterStringSerialize(requiredStringUuid, body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterStringSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterStringSerializeWithHttpInfo(requiredStringUuid, body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requiredStringUuid** | **Guid** | Required UUID String | | +| **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 | - | + +[[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) + + +# **GetArrayOfEnums** +> List<OuterEnum> GetArrayOfEnums () + +Array of Enums + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetArrayOfEnumsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Array of Enums + List result = apiInstance.GetArrayOfEnums(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetArrayOfEnums: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetArrayOfEnumsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Array of Enums + ApiResponse> response = apiInstance.GetArrayOfEnumsWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetArrayOfEnumsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **GetMixedAnyOf** +> MixedAnyOf GetMixedAnyOf () + +Test mixed type anyOf deserialization + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetMixedAnyOfExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Test mixed type anyOf deserialization + MixedAnyOf result = apiInstance.GetMixedAnyOf(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetMixedAnyOf: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetMixedAnyOfWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Test mixed type anyOf deserialization + ApiResponse response = apiInstance.GetMixedAnyOfWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetMixedAnyOfWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**MixedAnyOf**](MixedAnyOf.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 mixed anyOf | - | + +[[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) + + +# **GetMixedOneOf** +> MixedOneOf GetMixedOneOf () + +Test mixed type oneOf deserialization + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetMixedOneOfExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Test mixed type oneOf deserialization + MixedOneOf result = apiInstance.GetMixedOneOf(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetMixedOneOf: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetMixedOneOfWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Test mixed type oneOf deserialization + ApiResponse response = apiInstance.GetMixedOneOfWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetMixedOneOfWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**MixedOneOf**](MixedOneOf.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 mixed oneOf | - | + +[[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) + + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestBodyWithFileSchema** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestBodyWithFileSchemaWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchemaWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestBodyWithQueryParams** +> void TestBodyWithQueryParams (string query, User user) + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithQueryParamsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var query = "query_example"; // string | + var user = new User(); // User | + + try + { + apiInstance.TestBodyWithQueryParams(query, user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParams: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestBodyWithQueryParamsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestBodyWithQueryParamsWithHttpInfo(query, user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParamsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestClientModel** +> ModelClient TestClientModel (ModelClient modelClient) + +To test \"client\" model + +To test \"client\" model + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClientModelExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test \"client\" model + ModelClient result = apiInstance.TestClientModel(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestClientModelWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test \"client\" model + ApiResponse response = apiInstance.TestClientModelWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestClientModelWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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) + + +# **TestEndpointParameters** +> void TestEndpointParameters (decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, System.IO.Stream binary = null, string callback = null, DateOnly date = null, DateTime dateTime = null, int int32 = null, long int64 = null, int integer = null, string password = null, float varFloat = null, string varString = null) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEndpointParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure HTTP basic authorization: http_basic_test + config.Username = "YOUR_USERNAME"; + config.Password = "YOUR_PASSWORD"; + + var apiInstance = new FakeApi(config); + var number = 8.14D; // decimal | None + var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // string | None + var varByte = System.Text.Encoding.ASCII.GetBytes("BYTE_ARRAY_DATA_HERE"); // byte[] | None + var varDouble = 1.2D; // double | None + var binary = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | None (optional) + var callback = "callback_example"; // string | None (optional) + var date = DateOnly.Parse("2013-10-20"); // DateOnly | None (optional) + var dateTime = DateTime.Parse(""2010-02-01T10:20:10.111110+01:00""); // DateTime | None (optional) (default to "2010-02-01T10:20:10.111110+01:00") + var int32 = 56; // int | None (optional) + var int64 = 789L; // long | None (optional) + var integer = 56; // int | None (optional) + var password = "password_example"; // string | None (optional) + var varFloat = 3.4F; // float | None (optional) + var varString = "varString_example"; // string | None (optional) + + try + { + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + apiInstance.TestEndpointParameters(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestEndpointParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + apiInstance.TestEndpointParametersWithHttpInfo(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestEndpointParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **number** | **decimal** | None | | +| **patternWithoutDelimiter** | **string** | None | | +| **varByte** | **byte[]** | None | | +| **varDouble** | **double** | None | | +| **binary** | **System.IO.Stream****System.IO.Stream** | None | [optional] | +| **callback** | **string** | None | [optional] | +| **date** | **DateOnly** | None | [optional] | +| **dateTime** | **DateTime** | None | [optional] [default to "2010-02-01T10:20:10.111110+01:00"] | +| **int32** | **int** | None | [optional] | +| **int64** | **long** | None | [optional] | +| **integer** | **int** | None | [optional] | +| **password** | **string** | None | [optional] | +| **varFloat** | **float** | None | [optional] | +| **varString** | **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 + + +### 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) + + +# **TestEnumParameters** +> void TestEnumParameters (string enumFormString = null, List enumFormStringArray = null, string enumHeaderString = null, List enumHeaderStringArray = null, double enumQueryDouble = null, int enumQueryInteger = null, string enumQueryString = null, List enumQueryStringArray = null) + +To test enum parameters + +To test enum parameters + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEnumParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var enumFormString = "_abc"; // string | Form parameter enum test (string) (optional) (default to -efg) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) + var enumHeaderString = "_abc"; // string | Header parameter enum test (string) (optional) (default to -efg) + var enumHeaderStringArray = new List(); // List | Header parameter enum test (string array) (optional) + var enumQueryDouble = 1.1D; // double | Query parameter enum test (double) (optional) + var enumQueryInteger = 1; // int | Query parameter enum test (double) (optional) + var enumQueryString = "_abc"; // string | Query parameter enum test (string) (optional) (default to -efg) + var enumQueryStringArray = new List(); // List | Query parameter enum test (string array) (optional) + + try + { + // To test enum parameters + apiInstance.TestEnumParameters(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestEnumParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test enum parameters + apiInstance.TestEnumParametersWithHttpInfo(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestEnumParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **enumFormString** | **string** | Form parameter enum test (string) | [optional] [default to -efg] | +| **enumFormStringArray** | [**List<string>**](string.md) | Form parameter enum test (string array) | [optional] [default to $] | +| **enumHeaderString** | **string** | Header parameter enum test (string) | [optional] [default to -efg] | +| **enumHeaderStringArray** | [**List<string>**](string.md) | Header parameter enum test (string array) | [optional] | +| **enumQueryDouble** | **double** | Query parameter enum test (double) | [optional] | +| **enumQueryInteger** | **int** | Query parameter enum test (double) | [optional] | +| **enumQueryString** | **string** | Query parameter enum test (string) | [optional] [default to -efg] | +| **enumQueryStringArray** | [**List<string>**](string.md) | Query parameter enum test (string array) | [optional] | + +### Return type + +void (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 | - | + +[[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) + + +# **TestGroupParameters** +> void TestGroupParameters (bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, bool booleanGroup = null, long int64Group = null, int stringGroup = null) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestGroupParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure Bearer token for authorization: bearer_test + config.AccessToken = "YOUR_BEARER_TOKEN"; + + var apiInstance = new FakeApi(config); + var requiredBooleanGroup = true; // bool | Required Boolean in group parameters + var requiredInt64Group = 789L; // long | Required Integer in group parameters + var requiredStringGroup = 56; // int | Required String in group parameters + var booleanGroup = true; // bool | Boolean in group parameters (optional) + var int64Group = 789L; // long | Integer in group parameters (optional) + var stringGroup = 56; // int | String in group parameters (optional) + + try + { + // Fake endpoint to test group parameters (optional) + apiInstance.TestGroupParameters(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestGroupParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestGroupParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Fake endpoint to test group parameters (optional) + apiInstance.TestGroupParametersWithHttpInfo(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestGroupParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requiredBooleanGroup** | **bool** | Required Boolean in group parameters | | +| **requiredInt64Group** | **long** | Required Integer in group parameters | | +| **requiredStringGroup** | **int** | Required String in group parameters | | +| **booleanGroup** | **bool** | Boolean in group parameters | [optional] | +| **int64Group** | **long** | Integer in group parameters | [optional] | +| **stringGroup** | **int** | String 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + +[[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) + + +# **TestInlineAdditionalProperties** +> void TestInlineAdditionalProperties (Dictionary requestBody) + +test inline additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestInlineAdditionalPropertiesExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test inline additionalProperties + apiInstance.TestInlineAdditionalProperties(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestInlineAdditionalPropertiesWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test inline additionalProperties + apiInstance.TestInlineAdditionalPropertiesWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalPropertiesWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, string>**](string.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestInlineFreeformAdditionalProperties** +> void TestInlineFreeformAdditionalProperties (TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestInlineFreeformAdditionalPropertiesExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + + try + { + // test inline free-form additionalProperties + apiInstance.TestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalProperties: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestInlineFreeformAdditionalPropertiesWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test inline free-form additionalProperties + apiInstance.TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalPropertiesWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestJsonFormData** +> void TestJsonFormData (string param, string param2) + +test json serialization of form data + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestJsonFormDataExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var param = "param_example"; // string | field1 + var param2 = "param2_example"; // string | field2 + + try + { + // test json serialization of form data + apiInstance.TestJsonFormData(param, param2); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestJsonFormDataWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test json serialization of form data + apiInstance.TestJsonFormDataWithHttpInfo(param, param2); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestJsonFormDataWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### 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) + + +# **TestQueryParameterCollectionFormat** +> void TestQueryParameterCollectionFormat (List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, string notRequiredNotNullable = null, string notRequiredNullable = null, string requiredNullable) + + + +To test the collection format in query parameters + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestQueryParameterCollectionFormatExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var context = new List(); // List | + var http = new List(); // List | + var ioutil = new List(); // List | + var pipe = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var url = new List(); // List | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) + var requiredNullable = "requiredNullable_example"; // string | + + try + { + apiInstance.TestQueryParameterCollectionFormat(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestQueryParameterCollectionFormat: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestQueryParameterCollectionFormatWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestQueryParameterCollectionFormatWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **context** | [**List<string>**](string.md) | | | +| **http** | [**List<string>**](string.md) | | | +| **ioutil** | [**List<string>**](string.md) | | | +| **pipe** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **url** | [**List<string>**](string.md) | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | +| **requiredNullable** | **string** | | | + +### 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 | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestStringMapReference** +> void TestStringMapReference (Dictionary requestBody) + +test referenced string map + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestStringMapReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced string map + apiInstance.TestStringMapReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestStringMapReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestStringMapReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced string map + apiInstance.TestStringMapReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestStringMapReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, string>**](string.md) | request body | | + +### Return type + +void (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 | - | + +[[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/csharp/generichost/net9/Petstore/docs/apis/FakeClassnameTags123Api.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..dfe1adefd0a7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/FakeClassnameTags123Api.md @@ -0,0 +1,104 @@ +# Org.OpenAPITools.Api.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** +> ModelClient TestClassname (ModelClient modelClient) + +To test class name in snake case + +To test class name in snake case + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClassnameExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key_query + config.AddApiKey("api_key_query", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key_query", "Bearer"); + + var apiInstance = new FakeClassnameTags123Api(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test class name in snake case + ModelClient result = apiInstance.TestClassname(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestClassnameWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test class name in snake case + ApiResponse response = apiInstance.TestClassnameWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassnameWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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/csharp/generichost/net9/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/PetApi.md new file mode 100644 index 000000000000..92e5a48277df --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/PetApi.md @@ -0,0 +1,862 @@ +# Org.OpenAPITools.Api.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** +> void AddPet (Pet pet) + +Add a new pet to the store + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class AddPetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(pet); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the AddPetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Add a new pet to the store + apiInstance.AddPetWithHttpInfo(pet); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.AddPetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **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) + + +# **DeletePet** +> void DeletePet (long petId, string apiKey = null) + +Deletes a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeletePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | Pet id to delete + var apiKey = "apiKey_example"; // string | (optional) + + try + { + // Deletes a pet + apiInstance.DeletePet(petId, apiKey); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeletePetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Deletes a pet + apiInstance.DeletePetWithHttpInfo(petId, apiKey); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.DeletePetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | Pet id to delete | | +| **apiKey** | **string** | | [optional] | + +### 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** +> List<Pet> FindPetsByStatus (List status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByStatusExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var status = new List(); // List | Status values that need to be considered for filter + + try + { + // Finds Pets by status + List result = apiInstance.FindPetsByStatus(status); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FindPetsByStatusWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Finds Pets by status + ApiResponse> response = apiInstance.FindPetsByStatusWithHttpInfo(status); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.FindPetsByStatusWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **status** | [**List<string>**](string.md) | Status values that need to be considered for filter | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | + +[[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** +> List<Pet> FindPetsByTags (List tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByTagsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var tags = new List(); // List | Tags to filter by + + try + { + // Finds Pets by tags + List result = apiInstance.FindPetsByTags(tags); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FindPetsByTagsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Finds Pets by tags + ApiResponse> response = apiInstance.FindPetsByTagsWithHttpInfo(tags); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.FindPetsByTagsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **tags** | [**List<string>**](string.md) | Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 (long petId) + +Find pet by ID + +Returns a single pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetPetByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api-key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api-key", "Bearer"); + // Configure API key authorization: api_key_query + config.AddApiKey("api_key_query", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key_query", "Bearer"); + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to return + + try + { + // Find pet by ID + Pet result = apiInstance.GetPetById(petId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetPetByIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Find pet by ID + ApiResponse response = apiInstance.GetPetByIdWithHttpInfo(petId); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.GetPetByIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key), [api_key_query](../README.md#api_key_query) + +### 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** +> void UpdatePet (Pet pet) + +Update an existing pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + apiInstance.UpdatePet(pet); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdatePetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Update an existing pet + apiInstance.UpdatePetWithHttpInfo(pet); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UpdatePetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 | - | + +[[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** +> void UpdatePetWithForm (long petId, string name = null, string status = null) + +Updates a pet in the store with form data + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetWithFormExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet that needs to be updated + var name = "name_example"; // string | Updated name of the pet (optional) + var status = "status_example"; // string | Updated status of the pet (optional) + + try + { + // Updates a pet in the store with form data + apiInstance.UpdatePetWithForm(petId, name, status); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdatePetWithFormWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Updates a pet in the store with form data + apiInstance.UpdatePetWithFormWithHttpInfo(petId, name, status); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UpdatePetWithFormWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet that needs to be updated | | +| **name** | **string** | Updated name of the pet | [optional] | +| **status** | **string** | Updated status of the pet | [optional] | + +### Return type + +void (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 (long petId, string additionalMetadata = null, System.IO.Stream file = null) + +uploads an image + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to update + var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional) + var file = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload (optional) + + try + { + // uploads an image + ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UploadFileWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // uploads an image + ApiResponse response = apiInstance.UploadFileWithHttpInfo(petId, additionalMetadata, file); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UploadFileWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to update | | +| **additionalMetadata** | **string** | Additional data to pass to server | [optional] | +| **file** | **System.IO.Stream****System.IO.Stream** | file to upload | [optional] | + +### Return type + +[**ApiResponse**](ApiResponse.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 | - | + +[[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) + + +# **UploadFileWithRequiredFile** +> ApiResponse UploadFileWithRequiredFile (long petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to update + var requiredFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload + var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UploadFileWithRequiredFileWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // uploads an image (required) + ApiResponse response = apiInstance.UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFileWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to update | | +| **requiredFile** | **System.IO.Stream****System.IO.Stream** | file to upload | | +| **additionalMetadata** | **string** | Additional data to pass to server | [optional] | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + +### 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/client/petstore/csharp/generichost/net9/Petstore/docs/apis/StoreApi.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/StoreApi.md new file mode 100644 index 000000000000..e169ad74f907 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/StoreApi.md @@ -0,0 +1,373 @@ +# Org.OpenAPITools.Api.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** +> void DeleteOrder (string 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 +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var orderId = "orderId_example"; // string | ID of the order that needs to be deleted + + try + { + // Delete purchase order by ID + apiInstance.DeleteOrder(orderId); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeleteOrderWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Delete purchase order by ID + apiInstance.DeleteOrderWithHttpInfo(orderId); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.DeleteOrderWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **orderId** | **string** | ID of the order that needs to be deleted | | + +### 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** +> Dictionary<string, int> GetInventory () + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetInventoryExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api-key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api-key", "Bearer"); + + var apiInstance = new StoreApi(config); + + try + { + // Returns pet inventories by status + Dictionary result = apiInstance.GetInventory(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetInventoryWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Returns pet inventories by status + ApiResponse> response = apiInstance.GetInventoryWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.GetInventoryWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**Dictionary** + +### 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 (long orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetOrderByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var orderId = 789L; // long | ID of pet that needs to be fetched + + try + { + // Find purchase order by ID + Order result = apiInstance.GetOrderById(orderId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetOrderByIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Find purchase order by ID + ApiResponse response = apiInstance.GetOrderByIdWithHttpInfo(orderId); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.GetOrderByIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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 order) + +Place an order for a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class PlaceOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var order = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + Order result = apiInstance.PlaceOrder(order); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the PlaceOrderWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Place an order for a pet + ApiResponse response = apiInstance.PlaceOrderWithHttpInfo(order); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.PlaceOrderWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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/csharp/generichost/net9/Petstore/docs/apis/UserApi.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/UserApi.md new file mode 100644 index 000000000000..34064e25c4a8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/UserApi.md @@ -0,0 +1,715 @@ +# Org.OpenAPITools.Api.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** +> void CreateUser (User user) + +Create user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Create user + apiInstance.CreateUserWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**User**](User.md) | Created user object | | + +### Return type + +void (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 | - | + +[[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** +> void CreateUsersWithArrayInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithArrayInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUsersWithArrayInputWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInputWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInputWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**List<User>**](User.md) | List of user object | | + +### Return type + +void (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 | - | + +[[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** +> void CreateUsersWithListInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithListInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUsersWithListInputWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Creates list of users with given input array + apiInstance.CreateUsersWithListInputWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUsersWithListInputWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**List<User>**](User.md) | List of user object | | + +### Return type + +void (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 | - | + +[[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** +> void DeleteUser (string username) + +Delete user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var username = "username_example"; // string | The name that needs to be deleted + + try + { + // Delete user + apiInstance.DeleteUser(username); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeleteUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Delete user + apiInstance.DeleteUserWithHttpInfo(username); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.DeleteUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **username** | **string** | The name that needs to be deleted | | + +### 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 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 (string username) + +Get user by user name + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetUserByNameExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var username = "username_example"; // string | The name that needs to be fetched. Use user1 for testing. + + try + { + // Get user by user name + User result = apiInstance.GetUserByName(username); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetUserByNameWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Get user by user name + ApiResponse response = apiInstance.GetUserByNameWithHttpInfo(username); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.GetUserByNameWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | +| **598** | Not a real HTTP status code | - | +| **599** | Not a real HTTP status code with a return object | - | + +[[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 (string password, string username) + +Logs user into the system + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LoginUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var password = "password_example"; // string | The password for login in clear text + var username = "username_example"; // string | The user name for login + + try + { + // Logs user into the system + string result = apiInstance.LoginUser(password, username); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the LoginUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Logs user into the system + ApiResponse response = apiInstance.LoginUserWithHttpInfo(password, username); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.LoginUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **password** | **string** | The password for login in clear text | | +| **username** | **string** | The user name for login | | + +### 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** +> void LogoutUser () + +Logs out current logged in user session + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LogoutUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + + try + { + // Logs out current logged in user session + apiInstance.LogoutUser(); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the LogoutUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Logs out current logged in user session + apiInstance.LogoutUserWithHttpInfo(); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.LogoutUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### 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 | +|-------------|-------------|------------------| +| **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** +> void UpdateUser (User user, string username) + +Updated user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new User(); // User | Updated user object + var username = "username_example"; // string | name that need to be deleted + + try + { + // Updated user + apiInstance.UpdateUser(user, username); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdateUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Updated user + apiInstance.UpdateUserWithHttpInfo(user, username); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.UpdateUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**User**](User.md) | Updated user object | | +| **username** | **string** | name that need to be deleted | | + +### Return type + +void (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 | - | + +[[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/csharp/generichost/net9/Petstore/docs/models/Activity.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Activity.md new file mode 100644 index 000000000000..6f69ec32545d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Activity.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Activity +test map of maps + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ActivityOutputs** | **Dictionary<string, List<ActivityOutputElementRepresentation>>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ActivityOutputElementRepresentation.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ActivityOutputElementRepresentation.md new file mode 100644 index 000000000000..33d79a27692f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ActivityOutputElementRepresentation.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ActivityOutputElementRepresentation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Prop1** | **string** | | [optional] +**Prop2** | **Object** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..2bbe882fcfcc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/AdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# Org.OpenAPITools.Model.AdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Anytype1** | **Object** | | [optional] +**EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] +**MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MapProperty** | **Dictionary<string, string>** | | [optional] +**MapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] +**MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] +**MapWithUndeclaredPropertiesAnytype3** | **Dictionary<string, Object>** | | [optional] +**MapWithUndeclaredPropertiesString** | **Dictionary<string, string>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Animal.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Animal.md new file mode 100644 index 000000000000..1a1760bd8697 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Animal.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Animal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] + +[[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/csharp/generichost/net9/Petstore/docs/models/ApiResponse.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ApiResponse.md new file mode 100644 index 000000000000..d89ed1a25dc7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ApiResponse.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.ApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int** | | [optional] +**Message** | **string** | | [optional] +**Type** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Apple.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Apple.md new file mode 100644 index 000000000000..9ad1da8cd688 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Apple.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ColorCode** | **string** | | [optional] +**Cultivar** | **string** | | [optional] +**Origin** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/AppleReq.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/AppleReq.md new file mode 100644 index 000000000000..325521123f12 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/AppleReq.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.AppleReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | **string** | | +**Mealy** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..a23ba59e609c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ArrayOfArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | **List<List<decimal>>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ArrayOfNumberOnly.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..10b8413439b8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | **List<decimal>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ArrayTest.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ArrayTest.md new file mode 100644 index 000000000000..ed572120cd6d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ArrayTest.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.ArrayTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayOfInteger** | **List<List<long>>** | | [optional] +**ArrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] +**ArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Banana.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Banana.md new file mode 100644 index 000000000000..d32e90cf2985 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Banana.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/BananaReq.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/BananaReq.md new file mode 100644 index 000000000000..c8372b73c5f7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/BananaReq.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.BananaReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **decimal** | | +**Sweet** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/BasquePig.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/BasquePig.md new file mode 100644 index 000000000000..db4f7a362268 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/BasquePig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.BasquePig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/Capitalization.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Capitalization.md new file mode 100644 index 000000000000..9e225c17232a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Capitalization.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Capitalization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ATT_NAME** | **string** | Name of the pet | [optional] +**CapitalCamel** | **string** | | [optional] +**CapitalSnake** | **string** | | [optional] +**SCAETHFlowPoints** | **string** | | [optional] +**SmallCamel** | **string** | | [optional] +**SmallSnake** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Cat.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Cat.md new file mode 100644 index 000000000000..310a5e6575ec --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Cat.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Cat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Declawed** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Category.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Category.md new file mode 100644 index 000000000000..6eb0a2e13eaa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Category.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] + +[[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/csharp/generichost/net9/Petstore/docs/models/ChildCat.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ChildCat.md new file mode 100644 index 000000000000..88fe8f7a7fdd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ChildCat.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ChildCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] +**PetType** | **string** | | [default to PetTypeEnum.ChildCat] + +[[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/csharp/generichost/net9/Petstore/docs/models/ClassModel.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ClassModel.md new file mode 100644 index 000000000000..bb35816c9148 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ClassModel.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ClassModel +Model for testing model with \"_class\" property + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ComplexQuadrilateral.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ComplexQuadrilateral.md new file mode 100644 index 000000000000..fb00d4ebf089 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ComplexQuadrilateral.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ComplexQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/DanishPig.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/DanishPig.md new file mode 100644 index 000000000000..4d6ec1400a7e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/DanishPig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DanishPig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/DateOnlyClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/DateOnlyClass.md new file mode 100644 index 000000000000..4fc3775ed87d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/DateOnlyClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DateOnlyClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateOnlyProperty** | **DateOnly** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/DeprecatedObject.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/DeprecatedObject.md new file mode 100644 index 000000000000..e90c59555a0d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/DeprecatedObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DeprecatedObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Dog.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Dog.md new file mode 100644 index 000000000000..70cdc80e83e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Dog.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Dog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Breed** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Drawing.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Drawing.md new file mode 100644 index 000000000000..95f49b2ed600 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Drawing.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.Drawing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MainShape** | [**Shape**](Shape.md) | | [optional] +**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional] +**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**Shapes** | [**List<Shape>**](Shape.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumArrays.md new file mode 100644 index 000000000000..7467f67978c5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumArrays.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.EnumArrays + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**JustSymbol** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumClass.md new file mode 100644 index 000000000000..d259f0f46968 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumClass.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.EnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/EnumTest.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumTest.md new file mode 100644 index 000000000000..ebd7ccf2c864 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EnumTest.md @@ -0,0 +1,18 @@ +# Org.OpenAPITools.Model.EnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | +**EnumInteger** | **int** | | [optional] +**EnumIntegerOnly** | **int** | | [optional] +**EnumNumber** | **double** | | [optional] +**EnumString** | **string** | | [optional] +**OuterEnum** | **OuterEnum** | | [optional] +**OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**OuterEnumInteger** | **OuterEnumInteger** | | [optional] +**OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EquilateralTriangle.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EquilateralTriangle.md new file mode 100644 index 000000000000..8360b5c16a5b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/EquilateralTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.EquilateralTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/File.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/File.md new file mode 100644 index 000000000000..58b9c2fc3698 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/File.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.File +Must be named `File` for test. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **string** | Test capitalization | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FileSchemaTestClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FileSchemaTestClass.md new file mode 100644 index 000000000000..a47efad77d8a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | [**File**](File.md) | | [optional] +**Files** | [**List<File>**](File.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Foo.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Foo.md new file mode 100644 index 000000000000..b9e7d261736f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Foo.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Foo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to "bar"] + +[[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/csharp/generichost/net9/Petstore/docs/models/FooGetDefaultResponse.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FooGetDefaultResponse.md new file mode 100644 index 000000000000..47e50daca3e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FormatTest.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FormatTest.md new file mode 100644 index 000000000000..1009f35198fb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FormatTest.md @@ -0,0 +1,33 @@ +# Org.OpenAPITools.Model.FormatTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Byte** | **byte[]** | | +**Date** | **DateOnly** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] +**DateTime** | **DateTime** | | [optional] +**Decimal** | **decimal** | | [optional] +**Double** | **double** | | [optional] +**Float** | **float** | | [optional] +**Int32** | **int** | | [optional] +**Int32Range** | **int** | | [optional] +**Int64** | **long** | | [optional] +**Int64Negative** | **long** | | [optional] +**Int64NegativeExclusive** | **long** | | [optional] +**Int64Positive** | **long** | | [optional] +**Int64PositiveExclusive** | **long** | | [optional] +**Integer** | **int** | | [optional] +**PatternWithBackslash** | **string** | None | [optional] +**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] +**String** | **string** | | [optional] +**UnsignedInteger** | **uint** | | [optional] +**UnsignedLong** | **ulong** | | [optional] +**Uuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Fruit.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Fruit.md new file mode 100644 index 000000000000..b3bee18f7ba0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Fruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Fruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FruitReq.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FruitReq.md new file mode 100644 index 000000000000..38ab0c1a6caa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/FruitReq.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.FruitReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/GmFruit.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/GmFruit.md new file mode 100644 index 000000000000..584c4fd323d8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/GmFruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.GmFruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/GrandparentAnimal.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/GrandparentAnimal.md new file mode 100644 index 000000000000..eca96162b6f8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/GrandparentAnimal.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.GrandparentAnimal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/HasOnlyReadOnly.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/HasOnlyReadOnly.md new file mode 100644 index 000000000000..060a614a6981 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.HasOnlyReadOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [readonly] +**Foo** | **string** | | [optional] [readonly] + +[[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/csharp/generichost/net9/Petstore/docs/models/HealthCheckResult.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/HealthCheckResult.md new file mode 100644 index 000000000000..682cfc50e3a4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/HealthCheckResult.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.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] + +[[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/csharp/generichost/net9/Petstore/docs/models/IsoscelesTriangle.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/IsoscelesTriangle.md new file mode 100644 index 000000000000..07c62ac93382 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/IsoscelesTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.IsoscelesTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/List.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/List.md new file mode 100644 index 000000000000..0b54858ac247 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/List.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.List + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Var123List** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/LiteralStringClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/LiteralStringClass.md new file mode 100644 index 000000000000..782021909655 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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/csharp/generichost/net9/Petstore/docs/models/Mammal.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Mammal.md new file mode 100644 index 000000000000..ac14f00c0ff0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Mammal.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Mammal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/MapTest.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MapTest.md new file mode 100644 index 000000000000..5dd27228bb06 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MapTest.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.MapTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DirectMap** | **Dictionary<string, bool>** | | [optional] +**IndirectMap** | **Dictionary<string, bool>** | | [optional] +**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MapOfEnumString** | **Dictionary<string, MapTest.InnerEnum>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixLog.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixLog.md new file mode 100644 index 000000000000..5184c03bea97 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixLog.md @@ -0,0 +1,41 @@ +# Org.OpenAPITools.Model.MixLog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Description** | **string** | | +**FormulaVersionDate** | **DateTime** | | +**Id** | **Guid** | | +**MixDate** | **DateTime** | | +**TotalOverPoors** | **int** | | +**TotalRecalculations** | **int** | | +**TotalSkips** | **int** | | +**TotalUnderPours** | **int** | | +**BatchNumber** | **string** | | [optional] +**BrandCode** | **string** | BrandCode is only required for non-color mixes | [optional] +**BrandId** | **string** | BrandId is only required for color mixes | [optional] +**BrandName** | **string** | BrandName is only required for color mixes | [optional] +**CategoryCode** | **string** | CategoryCode is not used anymore | [optional] +**Color** | **string** | Color is only required for color mixes | [optional] +**ColorDescription** | **string** | | [optional] +**Comment** | **string** | | [optional] +**CommercialProductCode** | **string** | | [optional] +**Country** | **string** | | [optional] +**CreatedBy** | **string** | | [optional] +**CreatedByFirstName** | **string** | | [optional] +**CreatedByLastName** | **string** | | [optional] +**DeltaECalculationRepaired** | **string** | | [optional] +**DeltaECalculationSprayout** | **string** | | [optional] +**OwnColorVariantNumber** | **int** | | [optional] +**PrimerProductId** | **string** | | [optional] +**ProductId** | **string** | ProductId is only required for color mixes | [optional] +**ProductLineCode** | **string** | ProductLineCode is only required for color mixes | [optional] +**ProductName** | **string** | ProductName is only required for color mixes | [optional] +**SelectedVersionIndex** | **int** | | [optional] +**ShopId** | **Guid** | | [optional] +**SomeCode** | **string** | SomeCode is only required for color mixes | [optional] +**TotalPrice** | **float** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedAnyOf.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedAnyOf.md new file mode 100644 index 000000000000..2e9a2ca23f67 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedAnyOf.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedAnyOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Content** | [**MixedAnyOfContent**](MixedAnyOfContent.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedAnyOfContent.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedAnyOfContent.md new file mode 100644 index 000000000000..141ffe5a41dc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedAnyOfContent.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedAnyOfContent +Mixed anyOf types for testing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/MixedOneOf.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedOneOf.md new file mode 100644 index 000000000000..6cb1d5adff01 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedOneOf.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Content** | [**MixedOneOfContent**](MixedOneOfContent.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedOneOfContent.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedOneOfContent.md new file mode 100644 index 000000000000..168d5ee83628 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedOneOfContent.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedOneOfContent +Mixed oneOf types for testing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..1bc0740add9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.MixedPropertiesAndAdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateTime** | **DateTime** | | [optional] +**Map** | [**Dictionary<string, Animal>**](Animal.md) | | [optional] +**Uuid** | **Guid** | | [optional] +**UuidWithPattern** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedSubId.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedSubId.md new file mode 100644 index 000000000000..1df3d4002bf5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/MixedSubId.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedSubId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Model200Response.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Model200Response.md new file mode 100644 index 000000000000..2752a0d87c82 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Model200Response.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Model200Response +Model for testing model name starting with number + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **string** | | [optional] +**Name** | **int** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ModelClient.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ModelClient.md new file mode 100644 index 000000000000..c658e84ef57e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ModelClient.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ModelClient + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarClient** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Name.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Name.md new file mode 100644 index 000000000000..ffe61a31d61b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Name.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Name +Model for testing model name same as property name + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarName** | **int** | | +**Property** | **string** | | [optional] +**SnakeCase** | **int** | | [optional] [readonly] +**Var123Number** | **int** | | [optional] [readonly] + +[[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/csharp/generichost/net9/Petstore/docs/models/NotificationtestGetElementsV1ResponseMPayload.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NotificationtestGetElementsV1ResponseMPayload.md new file mode 100644 index 000000000000..25f223a8360a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NotificationtestGetElementsV1ResponseMPayload.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AObjVariableobject** | **List<Dictionary<string, Object>>** | | +**PkiNotificationtestID** | **int** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/NullableClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NullableClass.md new file mode 100644 index 000000000000..c9afe86510da --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NullableClass.md @@ -0,0 +1,21 @@ +# Org.OpenAPITools.Model.NullableClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayAndItemsNullableProp** | **List<Object>** | | [optional] +**ArrayItemsNullable** | **List<Object>** | | [optional] +**ArrayNullableProp** | **List<Object>** | | [optional] +**BooleanProp** | **bool** | | [optional] +**DateProp** | **DateOnly** | | [optional] +**DatetimeProp** | **DateTime** | | [optional] +**IntegerProp** | **int** | | [optional] +**NumberProp** | **decimal** | | [optional] +**ObjectAndItemsNullableProp** | **Dictionary<string, Object>** | | [optional] +**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] +**ObjectNullableProp** | **Dictionary<string, Object>** | | [optional] +**StringProp** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NullableGuidClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NullableGuidClass.md new file mode 100644 index 000000000000..8d939afe9984 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NullableGuidClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.NullableGuidClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NullableShape.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NullableShape.md new file mode 100644 index 000000000000..2720167ccaaa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NullableShape.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.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. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/NumberOnly.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NumberOnly.md new file mode 100644 index 000000000000..1b83cce764d3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/NumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.NumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ObjectWithDeprecatedFields.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..9f44c24d19ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ObjectWithDeprecatedFields.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.ObjectWithDeprecatedFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bars** | **List<string>** | | [optional] +**DeprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**Id** | **decimal** | | [optional] +**Uuid** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OneOfString.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OneOfString.md new file mode 100644 index 000000000000..54caf618776c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OneOfString.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OneOfString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/Order.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Order.md new file mode 100644 index 000000000000..f7d6827ed5c9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Order.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Complete** | **bool** | | [optional] [default to false] +**Id** | **long** | | [optional] +**PetId** | **long** | | [optional] +**Quantity** | **int** | | [optional] +**ShipDate** | **DateTime** | | [optional] +**Status** | **string** | Order Status | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterComposite.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterComposite.md new file mode 100644 index 000000000000..8985c59d094f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterComposite.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.OuterComposite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyBoolean** | **bool** | | [optional] +**MyNumber** | **decimal** | | [optional] +**MyString** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnum.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnum.md new file mode 100644 index 000000000000..36844bc4b175 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnum.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/OuterEnumDefaultValue.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..351383f0aeae --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnumDefaultValue.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/OuterEnumInteger.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnumInteger.md new file mode 100644 index 000000000000..1013b5b19565 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnumInteger.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..55e314e3102d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumIntegerDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/OuterEnumTest.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnumTest.md new file mode 100644 index 000000000000..b99d27c2c2e7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/OuterEnumTest.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/ParentPet.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ParentPet.md new file mode 100644 index 000000000000..bdf570056372 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ParentPet.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ParentPet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/Pet.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Pet.md new file mode 100644 index 000000000000..4f019b613bd7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Pet.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Pet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] +**Status** | **string** | pet status in the store | [optional] +**Tags** | [**List<Tag>**](Tag.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Pig.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Pig.md new file mode 100644 index 000000000000..fd7bb9359ac4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Pig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Pig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/PolymorphicProperty.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/PolymorphicProperty.md new file mode 100644 index 000000000000..4507ec41cd51 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/PolymorphicProperty.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.PolymorphicProperty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/Quadrilateral.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Quadrilateral.md new file mode 100644 index 000000000000..fbbf4f81cec6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Quadrilateral.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Quadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/QuadrilateralInterface.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/QuadrilateralInterface.md new file mode 100644 index 000000000000..756ba09c6ddf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/QuadrilateralInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.QuadrilateralInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/ReadOnlyFirst.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ReadOnlyFirst.md new file mode 100644 index 000000000000..afaf2ee4fb6c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ReadOnlyFirst + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [readonly] +**Baz** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/RequiredClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/RequiredClass.md new file mode 100644 index 000000000000..990aeb5de3d7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateOnly** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateOnly** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotRequiredNullableDateProp** | **DateOnly** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateOnly** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/Return.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Return.md new file mode 100644 index 000000000000..ad96a170bbbb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Return.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Return +Model for testing reserved words + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Lock** | **string** | | +**Abstract** | **string** | | +**VarReturn** | **int** | | [optional] +**Unsafe** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/RolesReportsHash.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/RolesReportsHash.md new file mode 100644 index 000000000000..d92c01de9ef7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/RolesReportsHash.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.RolesReportsHash +Role report Hash + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Role** | [**RolesReportsHashRole**](RolesReportsHashRole.md) | | [optional] +**RoleUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/RolesReportsHashRole.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/RolesReportsHashRole.md new file mode 100644 index 000000000000..760f77b30e78 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/RolesReportsHashRole.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.RolesReportsHashRole + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ScaleneTriangle.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ScaleneTriangle.md new file mode 100644 index 000000000000..d3f15354bccc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ScaleneTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ScaleneTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/Shape.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Shape.md new file mode 100644 index 000000000000..ae75c5925401 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Shape.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Shape + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/ShapeInterface.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ShapeInterface.md new file mode 100644 index 000000000000..882d31868305 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ShapeInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ShapeInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/ShapeOrNull.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ShapeOrNull.md new file mode 100644 index 000000000000..7fcd31a3a5e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ShapeOrNull.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ShapeOrNull +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/SimpleQuadrilateral.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/SimpleQuadrilateral.md new file mode 100644 index 000000000000..a9c7f93b67ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/SimpleQuadrilateral.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.SimpleQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/SpecialModelName.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/SpecialModelName.md new file mode 100644 index 000000000000..890bcd923dee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/SpecialModelName.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.SpecialModelName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarSpecialModelName** | **string** | | [optional] +**SpecialPropertyName** | **long** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Tag.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Tag.md new file mode 100644 index 000000000000..2b2d9674d619 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Tag.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TestCollectionEndingWithWordList.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TestCollectionEndingWithWordList.md new file mode 100644 index 000000000000..5c5eb22d9a8a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TestCollectionEndingWithWordList.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestCollectionEndingWithWordList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Value** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TestCollectionEndingWithWordListObject.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TestCollectionEndingWithWordListObject.md new file mode 100644 index 000000000000..cfa933cc576e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TestCollectionEndingWithWordListObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestCollectionEndingWithWordListObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TestCollectionEndingWithWordList** | [**List<TestCollectionEndingWithWordList>**](TestCollectionEndingWithWordList.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..b6f9fc948474 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestInlineFreeformAdditionalPropertiesRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SomeProperty** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Triangle.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Triangle.md new file mode 100644 index 000000000000..e15109911958 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Triangle.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Triangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/TriangleInterface.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TriangleInterface.md new file mode 100644 index 000000000000..4127c08b14f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/TriangleInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TriangleInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/Petstore/docs/models/User.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/User.md new file mode 100644 index 000000000000..b5700f1c75d9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/User.md @@ -0,0 +1,21 @@ +# Org.OpenAPITools.Model.User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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] +**Email** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**Id** | **long** | | [optional] +**LastName** | **string** | | [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] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int** | User Status | [optional] +**Username** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Whale.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Whale.md new file mode 100644 index 000000000000..1c633fdce61b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Whale.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Whale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**HasBaleen** | **bool** | | [optional] +**HasTeeth** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Zebra.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Zebra.md new file mode 100644 index 000000000000..aef3866b92c9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/Zebra.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Zebra + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Type** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ZeroBasedEnum.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ZeroBasedEnum.md new file mode 100644 index 000000000000..cb71966c4c81 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ZeroBasedEnum.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ZeroBasedEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/Petstore/docs/models/ZeroBasedEnumClass.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ZeroBasedEnumClass.md new file mode 100644 index 000000000000..614d00cbe878 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/models/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs new file mode 100644 index 000000000000..cf82a3e39bd6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing AnotherFakeApi + /// + public sealed class AnotherFakeApiTests : ApiTestsBase + { + private readonly IAnotherFakeApi _instance; + + public AnotherFakeApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test Call123TestSpecialTags + /// + [Fact (Skip = "not implemented")] + public async Task Call123TestSpecialTagsAsyncTest() + { + ModelClient modelClient = default; + var response = await _instance.Call123TestSpecialTagsAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..03ad026fa146 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,81 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + string apiKeyTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken2 = new(apiKeyTokenValue2, ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + string bearerTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + BearerToken bearerToken1 = new(bearerTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + string basicTokenUsername1 = context.Configuration[""] ?? throw new Exception("Username not found."); + string basicTokenPassword1 = context.Configuration[""] ?? throw new Exception("Password not found."); + BasicToken basicToken1 = new(basicTokenUsername1, basicTokenPassword1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 000000000000..88cf05ba9ed8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing DefaultApi + /// + public sealed class DefaultApiTests : ApiTestsBase + { + private readonly IDefaultApi _instance; + + public DefaultApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test FooGet + /// + [Fact (Skip = "not implemented")] + public async Task FooGetAsyncTest() + { + var response = await _instance.FooGetAsync(); + var model = response.Default(); + Assert.IsType(model); + } + + /// + /// Test GetCountry + /// + [Fact (Skip = "not implemented")] + public async Task GetCountryAsyncTest() + { + string country = default; + await _instance.GetCountryAsync(country); + } + + /// + /// Test Hello + /// + [Fact (Skip = "not implemented")] + public async Task HelloAsyncTest() + { + var response = await _instance.HelloAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test RolesReportGet + /// + [Fact (Skip = "not implemented")] + public async Task RolesReportGetAsyncTest() + { + var response = await _instance.RolesReportGetAsync(); + var model = response.Ok(); + Assert.IsType>>(model); + } + + /// + /// Test Test + /// + [Fact (Skip = "not implemented")] + public async Task TestAsyncTest() + { + var response = await _instance.TestAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..028d71f43359 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,243 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var anotherFakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var anotherFakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var anotherFakeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var anotherFakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs new file mode 100644 index 000000000000..66769b3aee6a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -0,0 +1,303 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing FakeApi + /// + public sealed class FakeApiTests : ApiTestsBase + { + private readonly IFakeApi _instance; + + public FakeApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test FakeHealthGet + /// + [Fact (Skip = "not implemented")] + public async Task FakeHealthGetAsyncTest() + { + var response = await _instance.FakeHealthGetAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterBooleanSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterBooleanSerializeAsyncTest() + { + Client.Option body = default; + var response = await _instance.FakeOuterBooleanSerializeAsync(body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterCompositeSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterCompositeSerializeAsyncTest() + { + Client.Option outerComposite = default; + var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterNumberSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterNumberSerializeAsyncTest() + { + Client.Option body = default; + var response = await _instance.FakeOuterNumberSerializeAsync(body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterStringSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterStringSerializeAsyncTest() + { + Guid requiredStringUuid = default; + Client.Option body = default; + var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test GetArrayOfEnums + /// + [Fact (Skip = "not implemented")] + public async Task GetArrayOfEnumsAsyncTest() + { + var response = await _instance.GetArrayOfEnumsAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetMixedAnyOf + /// + [Fact (Skip = "not implemented")] + public async Task GetMixedAnyOfAsyncTest() + { + var response = await _instance.GetMixedAnyOfAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test GetMixedOneOf + /// + [Fact (Skip = "not implemented")] + public async Task GetMixedOneOfAsyncTest() + { + var response = await _instance.GetMixedOneOfAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test TestAdditionalPropertiesReference + /// + [Fact (Skip = "not implemented")] + public async Task TestAdditionalPropertiesReferenceAsyncTest() + { + Dictionary requestBody = default; + await _instance.TestAdditionalPropertiesReferenceAsync(requestBody); + } + + /// + /// Test TestBodyWithFileSchema + /// + [Fact (Skip = "not implemented")] + public async Task TestBodyWithFileSchemaAsyncTest() + { + FileSchemaTestClass fileSchemaTestClass = default; + await _instance.TestBodyWithFileSchemaAsync(fileSchemaTestClass); + } + + /// + /// Test TestBodyWithQueryParams + /// + [Fact (Skip = "not implemented")] + public async Task TestBodyWithQueryParamsAsyncTest() + { + string query = default; + User user = default; + await _instance.TestBodyWithQueryParamsAsync(query, user); + } + + /// + /// Test TestClientModel + /// + [Fact (Skip = "not implemented")] + public async Task TestClientModelAsyncTest() + { + ModelClient modelClient = default; + var response = await _instance.TestClientModelAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test TestEndpointParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestEndpointParametersAsyncTest() + { + decimal number = default; + string patternWithoutDelimiter = default; + byte[] varByte = default; + double varDouble = default; + Client.Option binary = default; + Client.Option callback = default; + Client.Option date = default; + Client.Option dateTime = default; + Client.Option int32 = default; + Client.Option int64 = default; + Client.Option integer = default; + Client.Option password = default; + Client.Option varFloat = default; + Client.Option varString = default; + await _instance.TestEndpointParametersAsync(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + } + + /// + /// Test TestEnumParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestEnumParametersAsyncTest() + { + Client.Option enumFormString = default; + Client.Option> enumFormStringArray = default; + Client.Option enumHeaderString = default; + Client.Option> enumHeaderStringArray = default; + Client.Option enumQueryDouble = default; + Client.Option enumQueryInteger = default; + Client.Option enumQueryString = default; + Client.Option> enumQueryStringArray = default; + await _instance.TestEnumParametersAsync(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + } + + /// + /// Test TestGroupParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestGroupParametersAsyncTest() + { + bool requiredBooleanGroup = default; + long requiredInt64Group = default; + int requiredStringGroup = default; + Client.Option booleanGroup = default; + Client.Option int64Group = default; + Client.Option stringGroup = default; + await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + } + + /// + /// Test TestInlineAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineAdditionalPropertiesAsyncTest() + { + Dictionary requestBody = default; + await _instance.TestInlineAdditionalPropertiesAsync(requestBody); + } + + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + + /// + /// Test TestJsonFormData + /// + [Fact (Skip = "not implemented")] + public async Task TestJsonFormDataAsyncTest() + { + string param = default; + string param2 = default; + await _instance.TestJsonFormDataAsync(param, param2); + } + + /// + /// Test TestQueryParameterCollectionFormat + /// + [Fact (Skip = "not implemented")] + public async Task TestQueryParameterCollectionFormatAsyncTest() + { + List context = default; + List http = default; + List ioutil = default; + List pipe = default; + string requiredNotNullable = default; + List url = default; + Client.Option notRequiredNotNullable = default; + Client.Option notRequiredNullable = default; + string requiredNullable = default; + await _instance.TestQueryParameterCollectionFormatAsync(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + } + + /// + /// Test TestStringMapReference + /// + [Fact (Skip = "not implemented")] + public async Task TestStringMapReferenceAsyncTest() + { + Dictionary requestBody = default; + await _instance.TestStringMapReferenceAsync(requestBody); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs new file mode 100644 index 000000000000..5964bf6e51d6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing FakeClassnameTags123Api + /// + public sealed class FakeClassnameTags123ApiTests : ApiTestsBase + { + private readonly IFakeClassnameTags123Api _instance; + + public FakeClassnameTags123ApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test TestClassname + /// + [Fact (Skip = "not implemented")] + public async Task TestClassnameAsyncTest() + { + ModelClient modelClient = default; + var response = await _instance.TestClassnameAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs new file mode 100644 index 000000000000..215e88093797 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -0,0 +1,160 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing PetApi + /// + public sealed class PetApiTests : ApiTestsBase + { + private readonly IPetApi _instance; + + public PetApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test AddPet + /// + [Fact (Skip = "not implemented")] + public async Task AddPetAsyncTest() + { + Pet pet = default; + await _instance.AddPetAsync(pet); + } + + /// + /// Test DeletePet + /// + [Fact (Skip = "not implemented")] + public async Task DeletePetAsyncTest() + { + long petId = default; + Client.Option apiKey = default; + await _instance.DeletePetAsync(petId, apiKey); + } + + /// + /// Test FindPetsByStatus + /// + [Fact (Skip = "not implemented")] + public async Task FindPetsByStatusAsyncTest() + { + List status = default; + var response = await _instance.FindPetsByStatusAsync(status); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test FindPetsByTags + /// + [Fact (Skip = "not implemented")] + public async Task FindPetsByTagsAsyncTest() + { + List tags = default; + var response = await _instance.FindPetsByTagsAsync(tags); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetPetById + /// + [Fact (Skip = "not implemented")] + public async Task GetPetByIdAsyncTest() + { + long petId = default; + var response = await _instance.GetPetByIdAsync(petId); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test UpdatePet + /// + [Fact (Skip = "not implemented")] + public async Task UpdatePetAsyncTest() + { + Pet pet = default; + await _instance.UpdatePetAsync(pet); + } + + /// + /// Test UpdatePetWithForm + /// + [Fact (Skip = "not implemented")] + public async Task UpdatePetWithFormAsyncTest() + { + long petId = default; + Client.Option name = default; + Client.Option status = default; + await _instance.UpdatePetWithFormAsync(petId, name, status); + } + + /// + /// Test UploadFile + /// + [Fact (Skip = "not implemented")] + public async Task UploadFileAsyncTest() + { + long petId = default; + Client.Option additionalMetadata = default; + Client.Option file = default; + var response = await _instance.UploadFileAsync(petId, additionalMetadata, file); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test UploadFileWithRequiredFile + /// + [Fact (Skip = "not implemented")] + public async Task UploadFileWithRequiredFileAsyncTest() + { + long petId = default; + System.IO.Stream requiredFile = default; + Client.Option additionalMetadata = default; + var response = await _instance.UploadFileWithRequiredFileAsync(petId, requiredFile, additionalMetadata); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs new file mode 100644 index 000000000000..1b75e3417005 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing StoreApi + /// + public sealed class StoreApiTests : ApiTestsBase + { + private readonly IStoreApi _instance; + + public StoreApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test DeleteOrder + /// + [Fact (Skip = "not implemented")] + public async Task DeleteOrderAsyncTest() + { + string orderId = default; + await _instance.DeleteOrderAsync(orderId); + } + + /// + /// Test GetInventory + /// + [Fact (Skip = "not implemented")] + public async Task GetInventoryAsyncTest() + { + var response = await _instance.GetInventoryAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetOrderById + /// + [Fact (Skip = "not implemented")] + public async Task GetOrderByIdAsyncTest() + { + long orderId = default; + var response = await _instance.GetOrderByIdAsync(orderId); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test PlaceOrder + /// + [Fact (Skip = "not implemented")] + public async Task PlaceOrderAsyncTest() + { + Order order = default; + var response = await _instance.PlaceOrderAsync(order); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs new file mode 100644 index 000000000000..5a655797609e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs @@ -0,0 +1,138 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing UserApi + /// + public sealed class UserApiTests : ApiTestsBase + { + private readonly IUserApi _instance; + + public UserApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test CreateUser + /// + [Fact (Skip = "not implemented")] + public async Task CreateUserAsyncTest() + { + User user = default; + await _instance.CreateUserAsync(user); + } + + /// + /// Test CreateUsersWithArrayInput + /// + [Fact (Skip = "not implemented")] + public async Task CreateUsersWithArrayInputAsyncTest() + { + List user = default; + await _instance.CreateUsersWithArrayInputAsync(user); + } + + /// + /// Test CreateUsersWithListInput + /// + [Fact (Skip = "not implemented")] + public async Task CreateUsersWithListInputAsyncTest() + { + List user = default; + await _instance.CreateUsersWithListInputAsync(user); + } + + /// + /// Test DeleteUser + /// + [Fact (Skip = "not implemented")] + public async Task DeleteUserAsyncTest() + { + string username = default; + await _instance.DeleteUserAsync(username); + } + + /// + /// Test GetUserByName + /// + [Fact (Skip = "not implemented")] + public async Task GetUserByNameAsyncTest() + { + string username = default; + var response = await _instance.GetUserByNameAsync(username); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test LoginUser + /// + [Fact (Skip = "not implemented")] + public async Task LoginUserAsyncTest() + { + string password = default; + string username = default; + var response = await _instance.LoginUserAsync(password, username); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test LogoutUser + /// + [Fact (Skip = "not implemented")] + public async Task LogoutUserAsyncTest() + { + await _instance.LogoutUserAsync(); + } + + /// + /// Test UpdateUser + /// + [Fact (Skip = "not implemented")] + public async Task UpdateUserAsyncTest() + { + User user = default; + string username = default; + await _instance.UpdateUserAsync(user, username); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs new file mode 100644 index 000000000000..adbf639fd720 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ActivityOutputElementRepresentation + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActivityOutputElementRepresentationTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ActivityOutputElementRepresentation + //private ActivityOutputElementRepresentation instance; + + public ActivityOutputElementRepresentationTests() + { + // TODO uncomment below to create an instance of ActivityOutputElementRepresentation + //instance = new ActivityOutputElementRepresentation(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ActivityOutputElementRepresentation + /// + [Fact] + public void ActivityOutputElementRepresentationInstanceTest() + { + // TODO uncomment below to test "IsType" ActivityOutputElementRepresentation + //Assert.IsType(instance); + } + + /// + /// Test the property 'Prop1' + /// + [Fact] + public void Prop1Test() + { + // TODO unit test for the property 'Prop1' + } + + /// + /// Test the property 'Prop2' + /// + [Fact] + public void Prop2Test() + { + // TODO unit test for the property 'Prop2' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ActivityTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ActivityTests.cs new file mode 100644 index 000000000000..6cc2927eaaf3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ActivityTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Activity + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActivityTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Activity + //private Activity instance; + + public ActivityTests() + { + // TODO uncomment below to create an instance of Activity + //instance = new Activity(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Activity + /// + [Fact] + public void ActivityInstanceTest() + { + // TODO uncomment below to test "IsType" Activity + //Assert.IsType(instance); + } + + /// + /// Test the property 'ActivityOutputs' + /// + [Fact] + public void ActivityOutputsTest() + { + // TODO unit test for the property 'ActivityOutputs' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs new file mode 100644 index 000000000000..e157b477193e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -0,0 +1,128 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing AdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for AdditionalPropertiesClass + //private AdditionalPropertiesClass instance; + + public AdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of AdditionalPropertiesClass + //instance = new AdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AdditionalPropertiesClass + /// + [Fact] + public void AdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsType" AdditionalPropertiesClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'Anytype1' + /// + [Fact] + public void Anytype1Test() + { + // TODO unit test for the property 'Anytype1' + } + + /// + /// Test the property 'EmptyMap' + /// + [Fact] + public void EmptyMapTest() + { + // TODO unit test for the property 'EmptyMap' + } + + /// + /// Test the property 'MapOfMapProperty' + /// + [Fact] + public void MapOfMapPropertyTest() + { + // TODO unit test for the property 'MapOfMapProperty' + } + + /// + /// Test the property 'MapProperty' + /// + [Fact] + public void MapPropertyTest() + { + // TODO unit test for the property 'MapProperty' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype1' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype1Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype1' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype2' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype2Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype2' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype3' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype3Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype3' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesString' + /// + [Fact] + public void MapWithUndeclaredPropertiesStringTest() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs new file mode 100644 index 000000000000..1db9725afb85 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Animal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AnimalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Animal + //private Animal instance; + + public AnimalTests() + { + // TODO uncomment below to create an instance of Animal + //instance = new Animal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Animal + /// + [Fact] + public void AnimalInstanceTest() + { + // TODO uncomment below to test "IsType" Animal + //Assert.IsType(instance); + } + + /// + /// Test deserialize a Cat from type Animal + /// + [Fact] + public void CatDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Cat from type Animal + //Assert.IsType(JsonConvert.DeserializeObject(new Cat().ToJson())); + } + + /// + /// Test deserialize a Dog from type Animal + /// + [Fact] + public void DogDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Dog from type Animal + //Assert.IsType(JsonConvert.DeserializeObject(new Dog().ToJson())); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs new file mode 100644 index 000000000000..c296a82116a7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ApiResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ApiResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ApiResponse + //private ApiResponse instance; + + public ApiResponseTests() + { + // TODO uncomment below to create an instance of ApiResponse + //instance = new ApiResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ApiResponse + /// + [Fact] + public void ApiResponseInstanceTest() + { + // TODO uncomment below to test "IsType" ApiResponse + //Assert.IsType(instance); + } + + /// + /// Test the property 'Code' + /// + [Fact] + public void CodeTest() + { + // TODO unit test for the property 'Code' + } + + /// + /// Test the property 'Message' + /// + [Fact] + public void MessageTest() + { + // TODO unit test for the property 'Message' + } + + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs new file mode 100644 index 000000000000..d698ee445048 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing AppleReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for AppleReq + //private AppleReq instance; + + public AppleReqTests() + { + // TODO uncomment below to create an instance of AppleReq + //instance = new AppleReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AppleReq + /// + [Fact] + public void AppleReqInstanceTest() + { + // TODO uncomment below to test "IsType" AppleReq + //Assert.IsType(instance); + } + + /// + /// Test the property 'Cultivar' + /// + [Fact] + public void CultivarTest() + { + // TODO unit test for the property 'Cultivar' + } + + /// + /// Test the property 'Mealy' + /// + [Fact] + public void MealyTest() + { + // TODO unit test for the property 'Mealy' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AppleTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AppleTests.cs new file mode 100644 index 000000000000..c7c8ccd47c11 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/AppleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Apple + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Apple + //private Apple instance; + + public AppleTests() + { + // TODO uncomment below to create an instance of Apple + //instance = new Apple(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Apple + /// + [Fact] + public void AppleInstanceTest() + { + // TODO uncomment below to test "IsType" Apple + //Assert.IsType(instance); + } + + /// + /// Test the property 'ColorCode' + /// + [Fact] + public void ColorCodeTest() + { + // TODO unit test for the property 'ColorCode' + } + + /// + /// Test the property 'Cultivar' + /// + [Fact] + public void CultivarTest() + { + // TODO unit test for the property 'Cultivar' + } + + /// + /// Test the property 'Origin' + /// + [Fact] + public void OriginTest() + { + // TODO unit test for the property 'Origin' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs new file mode 100644 index 000000000000..29fe9cfb1d47 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayOfArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfArrayOfNumberOnly + //private ArrayOfArrayOfNumberOnly instance; + + public ArrayOfArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfArrayOfNumberOnly + //instance = new ArrayOfArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfArrayOfNumberOnly + /// + [Fact] + public void ArrayOfArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayOfArrayOfNumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayArrayNumber' + /// + [Fact] + public void ArrayArrayNumberTest() + { + // TODO unit test for the property 'ArrayArrayNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs new file mode 100644 index 000000000000..2b0956c0b984 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfNumberOnly + //private ArrayOfNumberOnly instance; + + public ArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfNumberOnly + //instance = new ArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfNumberOnly + /// + [Fact] + public void ArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayOfNumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayNumber' + /// + [Fact] + public void ArrayNumberTest() + { + // TODO unit test for the property 'ArrayNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs new file mode 100644 index 000000000000..3b01d0b7abbc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayTest + //private ArrayTest instance; + + public ArrayTestTests() + { + // TODO uncomment below to create an instance of ArrayTest + //instance = new ArrayTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayTest + /// + [Fact] + public void ArrayTestInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayArrayOfInteger' + /// + [Fact] + public void ArrayArrayOfIntegerTest() + { + // TODO unit test for the property 'ArrayArrayOfInteger' + } + + /// + /// Test the property 'ArrayArrayOfModel' + /// + [Fact] + public void ArrayArrayOfModelTest() + { + // TODO unit test for the property 'ArrayArrayOfModel' + } + + /// + /// Test the property 'ArrayOfString' + /// + [Fact] + public void ArrayOfStringTest() + { + // TODO unit test for the property 'ArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs new file mode 100644 index 000000000000..1e54c1f3e41d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing BananaReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for BananaReq + //private BananaReq instance; + + public BananaReqTests() + { + // TODO uncomment below to create an instance of BananaReq + //instance = new BananaReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of BananaReq + /// + [Fact] + public void BananaReqInstanceTest() + { + // TODO uncomment below to test "IsType" BananaReq + //Assert.IsType(instance); + } + + /// + /// Test the property 'LengthCm' + /// + [Fact] + public void LengthCmTest() + { + // TODO unit test for the property 'LengthCm' + } + + /// + /// Test the property 'Sweet' + /// + [Fact] + public void SweetTest() + { + // TODO unit test for the property 'Sweet' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/BananaTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/BananaTests.cs new file mode 100644 index 000000000000..5a88e9dabbdf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/BananaTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Banana + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Banana + //private Banana instance; + + public BananaTests() + { + // TODO uncomment below to create an instance of Banana + //instance = new Banana(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Banana + /// + [Fact] + public void BananaInstanceTest() + { + // TODO uncomment below to test "IsType" Banana + //Assert.IsType(instance); + } + + /// + /// Test the property 'LengthCm' + /// + [Fact] + public void LengthCmTest() + { + // TODO unit test for the property 'LengthCm' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs new file mode 100644 index 000000000000..4ffd6c2c0c87 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing BasquePig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BasquePigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for BasquePig + //private BasquePig instance; + + public BasquePigTests() + { + // TODO uncomment below to create an instance of BasquePig + //instance = new BasquePig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of BasquePig + /// + [Fact] + public void BasquePigInstanceTest() + { + // TODO uncomment below to test "IsType" BasquePig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs new file mode 100644 index 000000000000..d0391fb47f8f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Capitalization + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CapitalizationTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Capitalization + //private Capitalization instance; + + public CapitalizationTests() + { + // TODO uncomment below to create an instance of Capitalization + //instance = new Capitalization(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Capitalization + /// + [Fact] + public void CapitalizationInstanceTest() + { + // TODO uncomment below to test "IsType" Capitalization + //Assert.IsType(instance); + } + + /// + /// Test the property 'ATT_NAME' + /// + [Fact] + public void ATT_NAMETest() + { + // TODO unit test for the property 'ATT_NAME' + } + + /// + /// Test the property 'CapitalCamel' + /// + [Fact] + public void CapitalCamelTest() + { + // TODO unit test for the property 'CapitalCamel' + } + + /// + /// Test the property 'CapitalSnake' + /// + [Fact] + public void CapitalSnakeTest() + { + // TODO unit test for the property 'CapitalSnake' + } + + /// + /// Test the property 'SCAETHFlowPoints' + /// + [Fact] + public void SCAETHFlowPointsTest() + { + // TODO unit test for the property 'SCAETHFlowPoints' + } + + /// + /// Test the property 'SmallCamel' + /// + [Fact] + public void SmallCamelTest() + { + // TODO unit test for the property 'SmallCamel' + } + + /// + /// Test the property 'SmallSnake' + /// + [Fact] + public void SmallSnakeTest() + { + // TODO unit test for the property 'SmallSnake' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CatTests.cs new file mode 100644 index 000000000000..a5d4bf43bbfd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CatTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Cat + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CatTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Cat + //private Cat instance; + + public CatTests() + { + // TODO uncomment below to create an instance of Cat + //instance = new Cat(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Cat + /// + [Fact] + public void CatInstanceTest() + { + // TODO uncomment below to test "IsType" Cat + //Assert.IsType(instance); + } + + /// + /// Test the property 'Declawed' + /// + [Fact] + public void DeclawedTest() + { + // TODO unit test for the property 'Declawed' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs new file mode 100644 index 000000000000..7fe8f333c81a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Category + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CategoryTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Category + //private Category instance; + + public CategoryTests() + { + // TODO uncomment below to create an instance of Category + //instance = new Category(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Category + /// + [Fact] + public void CategoryInstanceTest() + { + // TODO uncomment below to test "IsType" Category + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs new file mode 100644 index 000000000000..2c02364a9f76 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ChildCat + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ChildCatTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ChildCat + //private ChildCat instance; + + public ChildCatTests() + { + // TODO uncomment below to create an instance of ChildCat + //instance = new ChildCat(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ChildCat + /// + [Fact] + public void ChildCatInstanceTest() + { + // TODO uncomment below to test "IsType" ChildCat + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + /// + /// Test the property 'PetType' + /// + [Fact] + public void PetTypeTest() + { + // TODO unit test for the property 'PetType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs new file mode 100644 index 000000000000..a866bfbe242d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ClassModel + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ClassModelTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ClassModel + //private ClassModel instance; + + public ClassModelTests() + { + // TODO uncomment below to create an instance of ClassModel + //instance = new ClassModel(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ClassModel + /// + [Fact] + public void ClassModelInstanceTest() + { + // TODO uncomment below to test "IsType" ClassModel + //Assert.IsType(instance); + } + + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs new file mode 100644 index 000000000000..a7a864154acf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ComplexQuadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ComplexQuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ComplexQuadrilateral + //private ComplexQuadrilateral instance; + + public ComplexQuadrilateralTests() + { + // TODO uncomment below to create an instance of ComplexQuadrilateral + //instance = new ComplexQuadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ComplexQuadrilateral + /// + [Fact] + public void ComplexQuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" ComplexQuadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs new file mode 100644 index 000000000000..e7c505b5136d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DanishPig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DanishPigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DanishPig + //private DanishPig instance; + + public DanishPigTests() + { + // TODO uncomment below to create an instance of DanishPig + //instance = new DanishPig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DanishPig + /// + [Fact] + public void DanishPigInstanceTest() + { + // TODO uncomment below to test "IsType" DanishPig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs new file mode 100644 index 000000000000..83a4185e53d2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DateOnlyClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DateOnlyClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DateOnlyClass + //private DateOnlyClass instance; + + public DateOnlyClassTests() + { + // TODO uncomment below to create an instance of DateOnlyClass + //instance = new DateOnlyClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DateOnlyClass + /// + [Fact] + public void DateOnlyClassInstanceTest() + { + // TODO uncomment below to test "IsType" DateOnlyClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'DateOnlyProperty' + /// + [Fact] + public void DateOnlyPropertyTest() + { + // TODO unit test for the property 'DateOnlyProperty' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs new file mode 100644 index 000000000000..95e56f782da3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DeprecatedObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DeprecatedObjectTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DeprecatedObject + //private DeprecatedObject instance; + + public DeprecatedObjectTests() + { + // TODO uncomment below to create an instance of DeprecatedObject + //instance = new DeprecatedObject(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DeprecatedObject + /// + [Fact] + public void DeprecatedObjectInstanceTest() + { + // TODO uncomment below to test "IsType" DeprecatedObject + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DogTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DogTests.cs new file mode 100644 index 000000000000..b8e8bca05384 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DogTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Dog + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DogTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Dog + //private Dog instance; + + public DogTests() + { + // TODO uncomment below to create an instance of Dog + //instance = new Dog(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Dog + /// + [Fact] + public void DogInstanceTest() + { + // TODO uncomment below to test "IsType" Dog + //Assert.IsType(instance); + } + + /// + /// Test the property 'Breed' + /// + [Fact] + public void BreedTest() + { + // TODO unit test for the property 'Breed' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DrawingTests.cs new file mode 100644 index 000000000000..a2de4a1b97b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/DrawingTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Drawing + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DrawingTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Drawing + //private Drawing instance; + + public DrawingTests() + { + // TODO uncomment below to create an instance of Drawing + //instance = new Drawing(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Drawing + /// + [Fact] + public void DrawingInstanceTest() + { + // TODO uncomment below to test "IsType" Drawing + //Assert.IsType(instance); + } + + /// + /// Test the property 'MainShape' + /// + [Fact] + public void MainShapeTest() + { + // TODO unit test for the property 'MainShape' + } + + /// + /// Test the property 'NullableShape' + /// + [Fact] + public void NullableShapeTest() + { + // TODO unit test for the property 'NullableShape' + } + + /// + /// Test the property 'ShapeOrNull' + /// + [Fact] + public void ShapeOrNullTest() + { + // TODO unit test for the property 'ShapeOrNull' + } + + /// + /// Test the property 'Shapes' + /// + [Fact] + public void ShapesTest() + { + // TODO unit test for the property 'Shapes' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs new file mode 100644 index 000000000000..c6fee27690b7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumArrays + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumArraysTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumArrays + //private EnumArrays instance; + + public EnumArraysTests() + { + // TODO uncomment below to create an instance of EnumArrays + //instance = new EnumArrays(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumArrays + /// + [Fact] + public void EnumArraysInstanceTest() + { + // TODO uncomment below to test "IsType" EnumArrays + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayEnum' + /// + [Fact] + public void ArrayEnumTest() + { + // TODO unit test for the property 'ArrayEnum' + } + + /// + /// Test the property 'JustSymbol' + /// + [Fact] + public void JustSymbolTest() + { + // TODO unit test for the property 'JustSymbol' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs new file mode 100644 index 000000000000..44dbbe4d324a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumClass + //private EnumClass instance; + + public EnumClassTests() + { + // TODO uncomment below to create an instance of EnumClass + //instance = new EnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumClass + /// + [Fact] + public void EnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" EnumClass + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs new file mode 100644 index 000000000000..3781eebbfcf2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumTest + //private EnumTest instance; + + public EnumTestTests() + { + // TODO uncomment below to create an instance of EnumTest + //instance = new EnumTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumTest + /// + [Fact] + public void EnumTestInstanceTest() + { + // TODO uncomment below to test "IsType" EnumTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + + /// + /// Test the property 'EnumInteger' + /// + [Fact] + public void EnumIntegerTest() + { + // TODO unit test for the property 'EnumInteger' + } + + /// + /// Test the property 'EnumIntegerOnly' + /// + [Fact] + public void EnumIntegerOnlyTest() + { + // TODO unit test for the property 'EnumIntegerOnly' + } + + /// + /// Test the property 'EnumNumber' + /// + [Fact] + public void EnumNumberTest() + { + // TODO unit test for the property 'EnumNumber' + } + + /// + /// Test the property 'EnumString' + /// + [Fact] + public void EnumStringTest() + { + // TODO unit test for the property 'EnumString' + } + + /// + /// Test the property 'OuterEnum' + /// + [Fact] + public void OuterEnumTest() + { + // TODO unit test for the property 'OuterEnum' + } + + /// + /// Test the property 'OuterEnumDefaultValue' + /// + [Fact] + public void OuterEnumDefaultValueTest() + { + // TODO unit test for the property 'OuterEnumDefaultValue' + } + + /// + /// Test the property 'OuterEnumInteger' + /// + [Fact] + public void OuterEnumIntegerTest() + { + // TODO unit test for the property 'OuterEnumInteger' + } + + /// + /// Test the property 'OuterEnumIntegerDefaultValue' + /// + [Fact] + public void OuterEnumIntegerDefaultValueTest() + { + // TODO unit test for the property 'OuterEnumIntegerDefaultValue' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs new file mode 100644 index 000000000000..f8d3daec3fe1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EquilateralTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EquilateralTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EquilateralTriangle + //private EquilateralTriangle instance; + + public EquilateralTriangleTests() + { + // TODO uncomment below to create an instance of EquilateralTriangle + //instance = new EquilateralTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EquilateralTriangle + /// + [Fact] + public void EquilateralTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" EquilateralTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 000000000000..e2685848d5ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FileSchemaTestClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + public FileSchemaTestClassTests() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Fact] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsType" FileSchemaTestClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'File' + /// + [Fact] + public void FileTest() + { + // TODO unit test for the property 'File' + } + + /// + /// Test the property 'Files' + /// + [Fact] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 000000000000..c305c5356b05 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FileTests : IDisposable + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + public FileTests() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of File + /// + [Fact] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsType" File + //Assert.IsType(instance); + } + + /// + /// Test the property 'SourceURI' + /// + [Fact] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 000000000000..55086a7cf24b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FooTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FooTests.cs new file mode 100644 index 000000000000..871506eeaac5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FooTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Foo + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Foo + //private Foo instance; + + public FooTests() + { + // TODO uncomment below to create an instance of Foo + //instance = new Foo(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Foo + /// + [Fact] + public void FooInstanceTest() + { + // TODO uncomment below to test "IsType" Foo + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs new file mode 100644 index 000000000000..7dad1b08bc02 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FormatTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FormatTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FormatTest + //private FormatTest instance; + + public FormatTestTests() + { + // TODO uncomment below to create an instance of FormatTest + //instance = new FormatTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FormatTest + /// + [Fact] + public void FormatTestInstanceTest() + { + // TODO uncomment below to test "IsType" FormatTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'Byte' + /// + [Fact] + public void ByteTest() + { + // TODO unit test for the property 'Byte' + } + + /// + /// Test the property 'Date' + /// + [Fact] + public void DateTest() + { + // TODO unit test for the property 'Date' + } + + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + + /// + /// Test the property 'Decimal' + /// + [Fact] + public void DecimalTest() + { + // TODO unit test for the property 'Decimal' + } + + /// + /// Test the property 'Double' + /// + [Fact] + public void DoubleTest() + { + // TODO unit test for the property 'Double' + } + + /// + /// Test the property 'Float' + /// + [Fact] + public void FloatTest() + { + // TODO unit test for the property 'Float' + } + + /// + /// Test the property 'Int32' + /// + [Fact] + public void Int32Test() + { + // TODO unit test for the property 'Int32' + } + + /// + /// Test the property 'Int32Range' + /// + [Fact] + public void Int32RangeTest() + { + // TODO unit test for the property 'Int32Range' + } + + /// + /// Test the property 'Int64' + /// + [Fact] + public void Int64Test() + { + // TODO unit test for the property 'Int64' + } + + /// + /// Test the property 'Int64Negative' + /// + [Fact] + public void Int64NegativeTest() + { + // TODO unit test for the property 'Int64Negative' + } + + /// + /// Test the property 'Int64NegativeExclusive' + /// + [Fact] + public void Int64NegativeExclusiveTest() + { + // TODO unit test for the property 'Int64NegativeExclusive' + } + + /// + /// Test the property 'Int64Positive' + /// + [Fact] + public void Int64PositiveTest() + { + // TODO unit test for the property 'Int64Positive' + } + + /// + /// Test the property 'Int64PositiveExclusive' + /// + [Fact] + public void Int64PositiveExclusiveTest() + { + // TODO unit test for the property 'Int64PositiveExclusive' + } + + /// + /// Test the property 'Integer' + /// + [Fact] + public void IntegerTest() + { + // TODO unit test for the property 'Integer' + } + + /// + /// Test the property 'PatternWithBackslash' + /// + [Fact] + public void PatternWithBackslashTest() + { + // TODO unit test for the property 'PatternWithBackslash' + } + + /// + /// Test the property 'PatternWithDigits' + /// + [Fact] + public void PatternWithDigitsTest() + { + // TODO unit test for the property 'PatternWithDigits' + } + + /// + /// Test the property 'PatternWithDigitsAndDelimiter' + /// + [Fact] + public void PatternWithDigitsAndDelimiterTest() + { + // TODO unit test for the property 'PatternWithDigitsAndDelimiter' + } + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + /// + /// Test the property 'UnsignedInteger' + /// + [Fact] + public void UnsignedIntegerTest() + { + // TODO unit test for the property 'UnsignedInteger' + } + + /// + /// Test the property 'UnsignedLong' + /// + [Fact] + public void UnsignedLongTest() + { + // TODO unit test for the property 'UnsignedLong' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs new file mode 100644 index 000000000000..a33c55ae4875 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FruitReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FruitReq + //private FruitReq instance; + + public FruitReqTests() + { + // TODO uncomment below to create an instance of FruitReq + //instance = new FruitReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FruitReq + /// + [Fact] + public void FruitReqInstanceTest() + { + // TODO uncomment below to test "IsType" FruitReq + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FruitTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FruitTests.cs new file mode 100644 index 000000000000..46448efc62f4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/FruitTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Fruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Fruit + //private Fruit instance; + + public FruitTests() + { + // TODO uncomment below to create an instance of Fruit + //instance = new Fruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Fruit + /// + [Fact] + public void FruitInstanceTest() + { + // TODO uncomment below to test "IsType" Fruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs new file mode 100644 index 000000000000..7e79cd067925 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing GmFruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class GmFruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for GmFruit + //private GmFruit instance; + + public GmFruitTests() + { + // TODO uncomment below to create an instance of GmFruit + //instance = new GmFruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of GmFruit + /// + [Fact] + public void GmFruitInstanceTest() + { + // TODO uncomment below to test "IsType" GmFruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs new file mode 100644 index 000000000000..5f0e8672ed5f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing GrandparentAnimal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class GrandparentAnimalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for GrandparentAnimal + //private GrandparentAnimal instance; + + public GrandparentAnimalTests() + { + // TODO uncomment below to create an instance of GrandparentAnimal + //instance = new GrandparentAnimal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of GrandparentAnimal + /// + [Fact] + public void GrandparentAnimalInstanceTest() + { + // TODO uncomment below to test "IsType" GrandparentAnimal + //Assert.IsType(instance); + } + + /// + /// Test deserialize a ChildCat from type ParentPet + /// + [Fact] + public void ChildCatDeserializeFromParentPetTest() + { + // TODO uncomment below to test deserialize a ChildCat from type ParentPet + //Assert.IsType(JsonConvert.DeserializeObject(new ChildCat().ToJson())); + } + + /// + /// Test deserialize a ParentPet from type GrandparentAnimal + /// + [Fact] + public void ParentPetDeserializeFromGrandparentAnimalTest() + { + // TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal + //Assert.IsType(JsonConvert.DeserializeObject(new ParentPet().ToJson())); + } + + /// + /// Test the property 'PetType' + /// + [Fact] + public void PetTypeTest() + { + // TODO unit test for the property 'PetType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs new file mode 100644 index 000000000000..134a7d515ebb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing HasOnlyReadOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class HasOnlyReadOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for HasOnlyReadOnly + //private HasOnlyReadOnly instance; + + public HasOnlyReadOnlyTests() + { + // TODO uncomment below to create an instance of HasOnlyReadOnly + //instance = new HasOnlyReadOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of HasOnlyReadOnly + /// + [Fact] + public void HasOnlyReadOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" HasOnlyReadOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + /// + /// Test the property 'Foo' + /// + [Fact] + public void FooTest() + { + // TODO unit test for the property 'Foo' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs new file mode 100644 index 000000000000..18bb8672e980 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing HealthCheckResult + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class HealthCheckResultTests : IDisposable + { + // TODO uncomment below to declare an instance variable for HealthCheckResult + //private HealthCheckResult instance; + + public HealthCheckResultTests() + { + // TODO uncomment below to create an instance of HealthCheckResult + //instance = new HealthCheckResult(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of HealthCheckResult + /// + [Fact] + public void HealthCheckResultInstanceTest() + { + // TODO uncomment below to test "IsType" HealthCheckResult + //Assert.IsType(instance); + } + + /// + /// Test the property 'NullableMessage' + /// + [Fact] + public void NullableMessageTest() + { + // TODO unit test for the property 'NullableMessage' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs new file mode 100644 index 000000000000..464750233cd2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing IsoscelesTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class IsoscelesTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for IsoscelesTriangle + //private IsoscelesTriangle instance; + + public IsoscelesTriangleTests() + { + // TODO uncomment below to create an instance of IsoscelesTriangle + //instance = new IsoscelesTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of IsoscelesTriangle + /// + [Fact] + public void IsoscelesTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" IsoscelesTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ListTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ListTests.cs new file mode 100644 index 000000000000..d95303d97517 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ListTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing List + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ListTests : IDisposable + { + // TODO uncomment below to declare an instance variable for List + //private List instance; + + public ListTests() + { + // TODO uncomment below to create an instance of List + //instance = new List(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of List + /// + [Fact] + public void ListInstanceTest() + { + // TODO uncomment below to test "IsType" List + //Assert.IsType(instance); + } + + /// + /// Test the property 'Var123List' + /// + [Fact] + public void Var123ListTest() + { + // TODO unit test for the property 'Var123List' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 000000000000..31d21de5b60c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MammalTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MammalTests.cs new file mode 100644 index 000000000000..64bd9e890343 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MammalTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Mammal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MammalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Mammal + //private Mammal instance; + + public MammalTests() + { + // TODO uncomment below to create an instance of Mammal + //instance = new Mammal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Mammal + /// + [Fact] + public void MammalInstanceTest() + { + // TODO uncomment below to test "IsType" Mammal + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs new file mode 100644 index 000000000000..2dc6d8d8e04b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MapTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MapTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MapTest + //private MapTest instance; + + public MapTestTests() + { + // TODO uncomment below to create an instance of MapTest + //instance = new MapTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MapTest + /// + [Fact] + public void MapTestInstanceTest() + { + // TODO uncomment below to test "IsType" MapTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'DirectMap' + /// + [Fact] + public void DirectMapTest() + { + // TODO unit test for the property 'DirectMap' + } + + /// + /// Test the property 'IndirectMap' + /// + [Fact] + public void IndirectMapTest() + { + // TODO unit test for the property 'IndirectMap' + } + + /// + /// Test the property 'MapMapOfString' + /// + [Fact] + public void MapMapOfStringTest() + { + // TODO unit test for the property 'MapMapOfString' + } + + /// + /// Test the property 'MapOfEnumString' + /// + [Fact] + public void MapOfEnumStringTest() + { + // TODO unit test for the property 'MapOfEnumString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixLogTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixLogTests.cs new file mode 100644 index 000000000000..3f108758fd2e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixLogTests.cs @@ -0,0 +1,344 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixLog + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixLogTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixLog + //private MixLog instance; + + public MixLogTests() + { + // TODO uncomment below to create an instance of MixLog + //instance = new MixLog(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixLog + /// + [Fact] + public void MixLogInstanceTest() + { + // TODO uncomment below to test "IsType" MixLog + //Assert.IsType(instance); + } + + /// + /// Test the property 'Description' + /// + [Fact] + public void DescriptionTest() + { + // TODO unit test for the property 'Description' + } + + /// + /// Test the property 'FormulaVersionDate' + /// + [Fact] + public void FormulaVersionDateTest() + { + // TODO unit test for the property 'FormulaVersionDate' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'MixDate' + /// + [Fact] + public void MixDateTest() + { + // TODO unit test for the property 'MixDate' + } + + /// + /// Test the property 'TotalOverPoors' + /// + [Fact] + public void TotalOverPoorsTest() + { + // TODO unit test for the property 'TotalOverPoors' + } + + /// + /// Test the property 'TotalRecalculations' + /// + [Fact] + public void TotalRecalculationsTest() + { + // TODO unit test for the property 'TotalRecalculations' + } + + /// + /// Test the property 'TotalSkips' + /// + [Fact] + public void TotalSkipsTest() + { + // TODO unit test for the property 'TotalSkips' + } + + /// + /// Test the property 'TotalUnderPours' + /// + [Fact] + public void TotalUnderPoursTest() + { + // TODO unit test for the property 'TotalUnderPours' + } + + /// + /// Test the property 'BatchNumber' + /// + [Fact] + public void BatchNumberTest() + { + // TODO unit test for the property 'BatchNumber' + } + + /// + /// Test the property 'BrandCode' + /// + [Fact] + public void BrandCodeTest() + { + // TODO unit test for the property 'BrandCode' + } + + /// + /// Test the property 'BrandId' + /// + [Fact] + public void BrandIdTest() + { + // TODO unit test for the property 'BrandId' + } + + /// + /// Test the property 'BrandName' + /// + [Fact] + public void BrandNameTest() + { + // TODO unit test for the property 'BrandName' + } + + /// + /// Test the property 'CategoryCode' + /// + [Fact] + public void CategoryCodeTest() + { + // TODO unit test for the property 'CategoryCode' + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + + /// + /// Test the property 'ColorDescription' + /// + [Fact] + public void ColorDescriptionTest() + { + // TODO unit test for the property 'ColorDescription' + } + + /// + /// Test the property 'Comment' + /// + [Fact] + public void CommentTest() + { + // TODO unit test for the property 'Comment' + } + + /// + /// Test the property 'CommercialProductCode' + /// + [Fact] + public void CommercialProductCodeTest() + { + // TODO unit test for the property 'CommercialProductCode' + } + + /// + /// Test the property 'Country' + /// + [Fact] + public void CountryTest() + { + // TODO unit test for the property 'Country' + } + + /// + /// Test the property 'CreatedBy' + /// + [Fact] + public void CreatedByTest() + { + // TODO unit test for the property 'CreatedBy' + } + + /// + /// Test the property 'CreatedByFirstName' + /// + [Fact] + public void CreatedByFirstNameTest() + { + // TODO unit test for the property 'CreatedByFirstName' + } + + /// + /// Test the property 'CreatedByLastName' + /// + [Fact] + public void CreatedByLastNameTest() + { + // TODO unit test for the property 'CreatedByLastName' + } + + /// + /// Test the property 'DeltaECalculationRepaired' + /// + [Fact] + public void DeltaECalculationRepairedTest() + { + // TODO unit test for the property 'DeltaECalculationRepaired' + } + + /// + /// Test the property 'DeltaECalculationSprayout' + /// + [Fact] + public void DeltaECalculationSprayoutTest() + { + // TODO unit test for the property 'DeltaECalculationSprayout' + } + + /// + /// Test the property 'OwnColorVariantNumber' + /// + [Fact] + public void OwnColorVariantNumberTest() + { + // TODO unit test for the property 'OwnColorVariantNumber' + } + + /// + /// Test the property 'PrimerProductId' + /// + [Fact] + public void PrimerProductIdTest() + { + // TODO unit test for the property 'PrimerProductId' + } + + /// + /// Test the property 'ProductId' + /// + [Fact] + public void ProductIdTest() + { + // TODO unit test for the property 'ProductId' + } + + /// + /// Test the property 'ProductLineCode' + /// + [Fact] + public void ProductLineCodeTest() + { + // TODO unit test for the property 'ProductLineCode' + } + + /// + /// Test the property 'ProductName' + /// + [Fact] + public void ProductNameTest() + { + // TODO unit test for the property 'ProductName' + } + + /// + /// Test the property 'SelectedVersionIndex' + /// + [Fact] + public void SelectedVersionIndexTest() + { + // TODO unit test for the property 'SelectedVersionIndex' + } + + /// + /// Test the property 'ShopId' + /// + [Fact] + public void ShopIdTest() + { + // TODO unit test for the property 'ShopId' + } + + /// + /// Test the property 'SomeCode' + /// + [Fact] + public void SomeCodeTest() + { + // TODO unit test for the property 'SomeCode' + } + + /// + /// Test the property 'TotalPrice' + /// + [Fact] + public void TotalPriceTest() + { + // TODO unit test for the property 'TotalPrice' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs new file mode 100644 index 000000000000..4ce302d1d047 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedAnyOfContent + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedAnyOfContentTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedAnyOfContent + //private MixedAnyOfContent instance; + + public MixedAnyOfContentTests() + { + // TODO uncomment below to create an instance of MixedAnyOfContent + //instance = new MixedAnyOfContent(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedAnyOfContent + /// + [Fact] + public void MixedAnyOfContentInstanceTest() + { + // TODO uncomment below to test "IsType" MixedAnyOfContent + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs new file mode 100644 index 000000000000..53b28cc0658d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedAnyOf + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedAnyOfTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedAnyOf + //private MixedAnyOf instance; + + public MixedAnyOfTests() + { + // TODO uncomment below to create an instance of MixedAnyOf + //instance = new MixedAnyOf(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedAnyOf + /// + [Fact] + public void MixedAnyOfInstanceTest() + { + // TODO uncomment below to test "IsType" MixedAnyOf + //Assert.IsType(instance); + } + + /// + /// Test the property 'Content' + /// + [Fact] + public void ContentTest() + { + // TODO unit test for the property 'Content' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs new file mode 100644 index 000000000000..781b72025008 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedOneOfContent + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedOneOfContentTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedOneOfContent + //private MixedOneOfContent instance; + + public MixedOneOfContentTests() + { + // TODO uncomment below to create an instance of MixedOneOfContent + //instance = new MixedOneOfContent(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedOneOfContent + /// + [Fact] + public void MixedOneOfContentInstanceTest() + { + // TODO uncomment below to test "IsType" MixedOneOfContent + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs new file mode 100644 index 000000000000..ee8b73d44f24 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedOneOf + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedOneOfTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedOneOf + //private MixedOneOf instance; + + public MixedOneOfTests() + { + // TODO uncomment below to create an instance of MixedOneOf + //instance = new MixedOneOf(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedOneOf + /// + [Fact] + public void MixedOneOfInstanceTest() + { + // TODO uncomment below to test "IsType" MixedOneOf + //Assert.IsType(instance); + } + + /// + /// Test the property 'Content' + /// + [Fact] + public void ContentTest() + { + // TODO unit test for the property 'Content' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs new file mode 100644 index 000000000000..d3689c15f401 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedPropertiesAndAdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedPropertiesAndAdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedPropertiesAndAdditionalPropertiesClass + //private MixedPropertiesAndAdditionalPropertiesClass instance; + + public MixedPropertiesAndAdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of MixedPropertiesAndAdditionalPropertiesClass + //instance = new MixedPropertiesAndAdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedPropertiesAndAdditionalPropertiesClass + /// + [Fact] + public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsType" MixedPropertiesAndAdditionalPropertiesClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + + /// + /// Test the property 'Map' + /// + [Fact] + public void MapTest() + { + // TODO unit test for the property 'Map' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + + /// + /// Test the property 'UuidWithPattern' + /// + [Fact] + public void UuidWithPatternTest() + { + // TODO unit test for the property 'UuidWithPattern' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs new file mode 100644 index 000000000000..2ed728a41b84 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedSubId + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedSubIdTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedSubId + //private MixedSubId instance; + + public MixedSubIdTests() + { + // TODO uncomment below to create an instance of MixedSubId + //instance = new MixedSubId(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedSubId + /// + [Fact] + public void MixedSubIdInstanceTest() + { + // TODO uncomment below to test "IsType" MixedSubId + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs new file mode 100644 index 000000000000..3b5e94c5f8f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Model200Response + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class Model200ResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Model200Response + //private Model200Response instance; + + public Model200ResponseTests() + { + // TODO uncomment below to create an instance of Model200Response + //instance = new Model200Response(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Model200Response + /// + [Fact] + public void Model200ResponseInstanceTest() + { + // TODO uncomment below to test "IsType" Model200Response + //Assert.IsType(instance); + } + + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs new file mode 100644 index 000000000000..5a986cfdc6c2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ModelClient + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ModelClientTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ModelClient + //private ModelClient instance; + + public ModelClientTests() + { + // TODO uncomment below to create an instance of ModelClient + //instance = new ModelClient(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ModelClient + /// + [Fact] + public void ModelClientInstanceTest() + { + // TODO uncomment below to test "IsType" ModelClient + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarClient' + /// + [Fact] + public void VarClientTest() + { + // TODO unit test for the property 'VarClient' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NameTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NameTests.cs new file mode 100644 index 000000000000..3aac92ae4683 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NameTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Name + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Name + //private Name instance; + + public NameTests() + { + // TODO uncomment below to create an instance of Name + //instance = new Name(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Name + /// + [Fact] + public void NameInstanceTest() + { + // TODO uncomment below to test "IsType" Name + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarName' + /// + [Fact] + public void VarNameTest() + { + // TODO unit test for the property 'VarName' + } + + /// + /// Test the property 'Property' + /// + [Fact] + public void PropertyTest() + { + // TODO unit test for the property 'Property' + } + + /// + /// Test the property 'SnakeCase' + /// + [Fact] + public void SnakeCaseTest() + { + // TODO unit test for the property 'SnakeCase' + } + + /// + /// Test the property 'Var123Number' + /// + [Fact] + public void Var123NumberTest() + { + // TODO unit test for the property 'Var123Number' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs new file mode 100644 index 000000000000..dd3b74e33061 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NotificationtestGetElementsV1ResponseMPayload + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NotificationtestGetElementsV1ResponseMPayloadTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NotificationtestGetElementsV1ResponseMPayload + //private NotificationtestGetElementsV1ResponseMPayload instance; + + public NotificationtestGetElementsV1ResponseMPayloadTests() + { + // TODO uncomment below to create an instance of NotificationtestGetElementsV1ResponseMPayload + //instance = new NotificationtestGetElementsV1ResponseMPayload(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NotificationtestGetElementsV1ResponseMPayload + /// + [Fact] + public void NotificationtestGetElementsV1ResponseMPayloadInstanceTest() + { + // TODO uncomment below to test "IsType" NotificationtestGetElementsV1ResponseMPayload + //Assert.IsType(instance); + } + + /// + /// Test the property 'AObjVariableobject' + /// + [Fact] + public void AObjVariableobjectTest() + { + // TODO unit test for the property 'AObjVariableobject' + } + + /// + /// Test the property 'PkiNotificationtestID' + /// + [Fact] + public void PkiNotificationtestIDTest() + { + // TODO unit test for the property 'PkiNotificationtestID' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs new file mode 100644 index 000000000000..1e19aa6b8231 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableClass + //private NullableClass instance; + + public NullableClassTests() + { + // TODO uncomment below to create an instance of NullableClass + //instance = new NullableClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableClass + /// + [Fact] + public void NullableClassInstanceTest() + { + // TODO uncomment below to test "IsType" NullableClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayAndItemsNullableProp' + /// + [Fact] + public void ArrayAndItemsNullablePropTest() + { + // TODO unit test for the property 'ArrayAndItemsNullableProp' + } + + /// + /// Test the property 'ArrayItemsNullable' + /// + [Fact] + public void ArrayItemsNullableTest() + { + // TODO unit test for the property 'ArrayItemsNullable' + } + + /// + /// Test the property 'ArrayNullableProp' + /// + [Fact] + public void ArrayNullablePropTest() + { + // TODO unit test for the property 'ArrayNullableProp' + } + + /// + /// Test the property 'BooleanProp' + /// + [Fact] + public void BooleanPropTest() + { + // TODO unit test for the property 'BooleanProp' + } + + /// + /// Test the property 'DateProp' + /// + [Fact] + public void DatePropTest() + { + // TODO unit test for the property 'DateProp' + } + + /// + /// Test the property 'DatetimeProp' + /// + [Fact] + public void DatetimePropTest() + { + // TODO unit test for the property 'DatetimeProp' + } + + /// + /// Test the property 'IntegerProp' + /// + [Fact] + public void IntegerPropTest() + { + // TODO unit test for the property 'IntegerProp' + } + + /// + /// Test the property 'NumberProp' + /// + [Fact] + public void NumberPropTest() + { + // TODO unit test for the property 'NumberProp' + } + + /// + /// Test the property 'ObjectAndItemsNullableProp' + /// + [Fact] + public void ObjectAndItemsNullablePropTest() + { + // TODO unit test for the property 'ObjectAndItemsNullableProp' + } + + /// + /// Test the property 'ObjectItemsNullable' + /// + [Fact] + public void ObjectItemsNullableTest() + { + // TODO unit test for the property 'ObjectItemsNullable' + } + + /// + /// Test the property 'ObjectNullableProp' + /// + [Fact] + public void ObjectNullablePropTest() + { + // TODO unit test for the property 'ObjectNullableProp' + } + + /// + /// Test the property 'StringProp' + /// + [Fact] + public void StringPropTest() + { + // TODO unit test for the property 'StringProp' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs new file mode 100644 index 000000000000..db8c9aa09568 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableGuidClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableGuidClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableGuidClass + //private NullableGuidClass instance; + + public NullableGuidClassTests() + { + // TODO uncomment below to create an instance of NullableGuidClass + //instance = new NullableGuidClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableGuidClass + /// + [Fact] + public void NullableGuidClassInstanceTest() + { + // TODO uncomment below to test "IsType" NullableGuidClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs new file mode 100644 index 000000000000..e65ba44efa2e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableShape + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableShapeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableShape + //private NullableShape instance; + + public NullableShapeTests() + { + // TODO uncomment below to create an instance of NullableShape + //instance = new NullableShape(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableShape + /// + [Fact] + public void NullableShapeInstanceTest() + { + // TODO uncomment below to test "IsType" NullableShape + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs new file mode 100644 index 000000000000..2b88fb1a609e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NumberOnly + //private NumberOnly instance; + + public NumberOnlyTests() + { + // TODO uncomment below to create an instance of NumberOnly + //instance = new NumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NumberOnly + /// + [Fact] + public void NumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" NumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'JustNumber' + /// + [Fact] + public void JustNumberTest() + { + // TODO unit test for the property 'JustNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs new file mode 100644 index 000000000000..078655aaba70 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ObjectWithDeprecatedFields + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ObjectWithDeprecatedFieldsTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ObjectWithDeprecatedFields + //private ObjectWithDeprecatedFields instance; + + public ObjectWithDeprecatedFieldsTests() + { + // TODO uncomment below to create an instance of ObjectWithDeprecatedFields + //instance = new ObjectWithDeprecatedFields(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ObjectWithDeprecatedFields + /// + [Fact] + public void ObjectWithDeprecatedFieldsInstanceTest() + { + // TODO uncomment below to test "IsType" ObjectWithDeprecatedFields + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bars' + /// + [Fact] + public void BarsTest() + { + // TODO unit test for the property 'Bars' + } + + /// + /// Test the property 'DeprecatedRef' + /// + [Fact] + public void DeprecatedRefTest() + { + // TODO unit test for the property 'DeprecatedRef' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs new file mode 100644 index 000000000000..8ef411a15eb6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OneOfString + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OneOfStringTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OneOfString + //private OneOfString instance; + + public OneOfStringTests() + { + // TODO uncomment below to create an instance of OneOfString + //instance = new OneOfString(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OneOfString + /// + [Fact] + public void OneOfStringInstanceTest() + { + // TODO uncomment below to test "IsType" OneOfString + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OrderTests.cs new file mode 100644 index 000000000000..e7187bbdc92c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Order + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OrderTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Order + //private Order instance; + + public OrderTests() + { + // TODO uncomment below to create an instance of Order + //instance = new Order(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Order + /// + [Fact] + public void OrderInstanceTest() + { + // TODO uncomment below to test "IsType" Order + //Assert.IsType(instance); + } + + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'PetId' + /// + [Fact] + public void PetIdTest() + { + // TODO unit test for the property 'PetId' + } + + /// + /// Test the property 'Quantity' + /// + [Fact] + public void QuantityTest() + { + // TODO unit test for the property 'Quantity' + } + + /// + /// Test the property 'ShipDate' + /// + [Fact] + public void ShipDateTest() + { + // TODO unit test for the property 'ShipDate' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs new file mode 100644 index 000000000000..0bb8ce5e5d9b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterComposite + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterCompositeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterComposite + //private OuterComposite instance; + + public OuterCompositeTests() + { + // TODO uncomment below to create an instance of OuterComposite + //instance = new OuterComposite(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterComposite + /// + [Fact] + public void OuterCompositeInstanceTest() + { + // TODO uncomment below to test "IsType" OuterComposite + //Assert.IsType(instance); + } + + /// + /// Test the property 'MyBoolean' + /// + [Fact] + public void MyBooleanTest() + { + // TODO unit test for the property 'MyBoolean' + } + + /// + /// Test the property 'MyNumber' + /// + [Fact] + public void MyNumberTest() + { + // TODO unit test for the property 'MyNumber' + } + + /// + /// Test the property 'MyString' + /// + [Fact] + public void MyStringTest() + { + // TODO unit test for the property 'MyString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs new file mode 100644 index 000000000000..a1d1e1527771 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumDefaultValue + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumDefaultValueTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumDefaultValue + //private OuterEnumDefaultValue instance; + + public OuterEnumDefaultValueTests() + { + // TODO uncomment below to create an instance of OuterEnumDefaultValue + //instance = new OuterEnumDefaultValue(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumDefaultValue + /// + [Fact] + public void OuterEnumDefaultValueInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumDefaultValue + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs new file mode 100644 index 000000000000..030326d75792 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumIntegerDefaultValue + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumIntegerDefaultValueTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumIntegerDefaultValue + //private OuterEnumIntegerDefaultValue instance; + + public OuterEnumIntegerDefaultValueTests() + { + // TODO uncomment below to create an instance of OuterEnumIntegerDefaultValue + //instance = new OuterEnumIntegerDefaultValue(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumIntegerDefaultValue + /// + [Fact] + public void OuterEnumIntegerDefaultValueInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumIntegerDefaultValue + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs new file mode 100644 index 000000000000..1f3bfe459e76 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumInteger + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumIntegerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumInteger + //private OuterEnumInteger instance; + + public OuterEnumIntegerTests() + { + // TODO uncomment below to create an instance of OuterEnumInteger + //instance = new OuterEnumInteger(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumInteger + /// + [Fact] + public void OuterEnumIntegerInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumInteger + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs new file mode 100644 index 000000000000..c4cb8eeecee8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumTest + //private OuterEnumTest instance; + + public OuterEnumTestTests() + { + // TODO uncomment below to create an instance of OuterEnumTest + //instance = new OuterEnumTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumTest + /// + [Fact] + public void OuterEnumTestInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumTest + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs new file mode 100644 index 000000000000..2859494010b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnum + //private OuterEnum instance; + + public OuterEnumTests() + { + // TODO uncomment below to create an instance of OuterEnum + //instance = new OuterEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnum + /// + [Fact] + public void OuterEnumInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnum + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs new file mode 100644 index 000000000000..b0ebddd374f9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ParentPet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ParentPetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ParentPet + //private ParentPet instance; + + public ParentPetTests() + { + // TODO uncomment below to create an instance of ParentPet + //instance = new ParentPet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ParentPet + /// + [Fact] + public void ParentPetInstanceTest() + { + // TODO uncomment below to test "IsType" ParentPet + //Assert.IsType(instance); + } + + /// + /// Test deserialize a ChildCat from type ParentPet + /// + [Fact] + public void ChildCatDeserializeFromParentPetTest() + { + // TODO uncomment below to test deserialize a ChildCat from type ParentPet + //Assert.IsType(JsonConvert.DeserializeObject(new ChildCat().ToJson())); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/PetTests.cs new file mode 100644 index 000000000000..8485d1213ce6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Pet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pet + //private Pet instance; + + public PetTests() + { + // TODO uncomment below to create an instance of Pet + //instance = new Pet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pet + /// + [Fact] + public void PetInstanceTest() + { + // TODO uncomment below to test "IsType" Pet + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + /// + /// Test the property 'PhotoUrls' + /// + [Fact] + public void PhotoUrlsTest() + { + // TODO unit test for the property 'PhotoUrls' + } + + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + + /// + /// Test the property 'Tags' + /// + [Fact] + public void TagsTest() + { + // TODO unit test for the property 'Tags' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/PigTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/PigTests.cs new file mode 100644 index 000000000000..bd052bc705b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/PigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Pig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pig + //private Pig instance; + + public PigTests() + { + // TODO uncomment below to create an instance of Pig + //instance = new Pig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pig + /// + [Fact] + public void PigInstanceTest() + { + // TODO uncomment below to test "IsType" Pig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs new file mode 100644 index 000000000000..23120ba7bdfa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing PolymorphicProperty + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PolymorphicPropertyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for PolymorphicProperty + //private PolymorphicProperty instance; + + public PolymorphicPropertyTests() + { + // TODO uncomment below to create an instance of PolymorphicProperty + //instance = new PolymorphicProperty(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of PolymorphicProperty + /// + [Fact] + public void PolymorphicPropertyInstanceTest() + { + // TODO uncomment below to test "IsType" PolymorphicProperty + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs new file mode 100644 index 000000000000..2ddd31cfcbba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing QuadrilateralInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class QuadrilateralInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for QuadrilateralInterface + //private QuadrilateralInterface instance; + + public QuadrilateralInterfaceTests() + { + // TODO uncomment below to create an instance of QuadrilateralInterface + //instance = new QuadrilateralInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of QuadrilateralInterface + /// + [Fact] + public void QuadrilateralInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" QuadrilateralInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs new file mode 100644 index 000000000000..65673847d759 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Quadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class QuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Quadrilateral + //private Quadrilateral instance; + + public QuadrilateralTests() + { + // TODO uncomment below to create an instance of Quadrilateral + //instance = new Quadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Quadrilateral + /// + [Fact] + public void QuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" Quadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs new file mode 100644 index 000000000000..a4c91cf44a57 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ReadOnlyFirst + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReadOnlyFirstTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ReadOnlyFirst + //private ReadOnlyFirst instance; + + public ReadOnlyFirstTests() + { + // TODO uncomment below to create an instance of ReadOnlyFirst + //instance = new ReadOnlyFirst(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ReadOnlyFirst + /// + [Fact] + public void ReadOnlyFirstInstanceTest() + { + // TODO uncomment below to test "IsType" ReadOnlyFirst + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + /// + /// Test the property 'Baz' + /// + [Fact] + public void BazTest() + { + // TODO unit test for the property 'Baz' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..d1da68281ff0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs new file mode 100644 index 000000000000..bbea79ed9511 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Return + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReturnTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Return + //private Return instance; + + public ReturnTests() + { + // TODO uncomment below to create an instance of Return + //instance = new Return(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Return + /// + [Fact] + public void ReturnInstanceTest() + { + // TODO uncomment below to test "IsType" Return + //Assert.IsType(instance); + } + + /// + /// Test the property 'Lock' + /// + [Fact] + public void LockTest() + { + // TODO unit test for the property 'Lock' + } + + /// + /// Test the property 'Abstract' + /// + [Fact] + public void AbstractTest() + { + // TODO unit test for the property 'Abstract' + } + + /// + /// Test the property 'VarReturn' + /// + [Fact] + public void VarReturnTest() + { + // TODO unit test for the property 'VarReturn' + } + + /// + /// Test the property 'Unsafe' + /// + [Fact] + public void UnsafeTest() + { + // TODO unit test for the property 'Unsafe' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs new file mode 100644 index 000000000000..5f21a874c4f0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RolesReportsHashRole + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RolesReportsHashRoleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RolesReportsHashRole + //private RolesReportsHashRole instance; + + public RolesReportsHashRoleTests() + { + // TODO uncomment below to create an instance of RolesReportsHashRole + //instance = new RolesReportsHashRole(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RolesReportsHashRole + /// + [Fact] + public void RolesReportsHashRoleInstanceTest() + { + // TODO uncomment below to test "IsType" RolesReportsHashRole + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs new file mode 100644 index 000000000000..cddb8dc6f0b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RolesReportsHash + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RolesReportsHashTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RolesReportsHash + //private RolesReportsHash instance; + + public RolesReportsHashTests() + { + // TODO uncomment below to create an instance of RolesReportsHash + //instance = new RolesReportsHash(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RolesReportsHash + /// + [Fact] + public void RolesReportsHashInstanceTest() + { + // TODO uncomment below to test "IsType" RolesReportsHash + //Assert.IsType(instance); + } + + /// + /// Test the property 'Role' + /// + [Fact] + public void RoleTest() + { + // TODO unit test for the property 'Role' + } + + /// + /// Test the property 'RoleUuid' + /// + [Fact] + public void RoleUuidTest() + { + // TODO unit test for the property 'RoleUuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs new file mode 100644 index 000000000000..085d3e550a10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ScaleneTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ScaleneTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ScaleneTriangle + //private ScaleneTriangle instance; + + public ScaleneTriangleTests() + { + // TODO uncomment below to create an instance of ScaleneTriangle + //instance = new ScaleneTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ScaleneTriangle + /// + [Fact] + public void ScaleneTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" ScaleneTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs new file mode 100644 index 000000000000..62d6d69ff72d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ShapeInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ShapeInterface + //private ShapeInterface instance; + + public ShapeInterfaceTests() + { + // TODO uncomment below to create an instance of ShapeInterface + //instance = new ShapeInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ShapeInterface + /// + [Fact] + public void ShapeInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" ShapeInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs new file mode 100644 index 000000000000..dc6970b16f15 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ShapeOrNull + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeOrNullTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ShapeOrNull + //private ShapeOrNull instance; + + public ShapeOrNullTests() + { + // TODO uncomment below to create an instance of ShapeOrNull + //instance = new ShapeOrNull(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ShapeOrNull + /// + [Fact] + public void ShapeOrNullInstanceTest() + { + // TODO uncomment below to test "IsType" ShapeOrNull + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ShapeTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ShapeTests.cs new file mode 100644 index 000000000000..dbdf012c5ba4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ShapeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Shape + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Shape + //private Shape instance; + + public ShapeTests() + { + // TODO uncomment below to create an instance of Shape + //instance = new Shape(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Shape + /// + [Fact] + public void ShapeInstanceTest() + { + // TODO uncomment below to test "IsType" Shape + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs new file mode 100644 index 000000000000..baa6e1e9f6fd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing SimpleQuadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class SimpleQuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for SimpleQuadrilateral + //private SimpleQuadrilateral instance; + + public SimpleQuadrilateralTests() + { + // TODO uncomment below to create an instance of SimpleQuadrilateral + //instance = new SimpleQuadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of SimpleQuadrilateral + /// + [Fact] + public void SimpleQuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" SimpleQuadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs new file mode 100644 index 000000000000..23763d9c3af0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing SpecialModelName + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class SpecialModelNameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for SpecialModelName + //private SpecialModelName instance; + + public SpecialModelNameTests() + { + // TODO uncomment below to create an instance of SpecialModelName + //instance = new SpecialModelName(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of SpecialModelName + /// + [Fact] + public void SpecialModelNameInstanceTest() + { + // TODO uncomment below to test "IsType" SpecialModelName + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarSpecialModelName' + /// + [Fact] + public void VarSpecialModelNameTest() + { + // TODO unit test for the property 'VarSpecialModelName' + } + + /// + /// Test the property 'SpecialPropertyName' + /// + [Fact] + public void SpecialPropertyNameTest() + { + // TODO unit test for the property 'SpecialPropertyName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TagTests.cs new file mode 100644 index 000000000000..fe7f3d82baba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TagTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Tag + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TagTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Tag + //private Tag instance; + + public TagTests() + { + // TODO uncomment below to create an instance of Tag + //instance = new Tag(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Tag + /// + [Fact] + public void TagInstanceTest() + { + // TODO uncomment below to test "IsType" Tag + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs new file mode 100644 index 000000000000..eca020ce1fae --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestCollectionEndingWithWordListObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestCollectionEndingWithWordListObjectTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestCollectionEndingWithWordListObject + //private TestCollectionEndingWithWordListObject instance; + + public TestCollectionEndingWithWordListObjectTests() + { + // TODO uncomment below to create an instance of TestCollectionEndingWithWordListObject + //instance = new TestCollectionEndingWithWordListObject(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestCollectionEndingWithWordListObject + /// + [Fact] + public void TestCollectionEndingWithWordListObjectInstanceTest() + { + // TODO uncomment below to test "IsType" TestCollectionEndingWithWordListObject + //Assert.IsType(instance); + } + + /// + /// Test the property 'TestCollectionEndingWithWordList' + /// + [Fact] + public void TestCollectionEndingWithWordListTest() + { + // TODO unit test for the property 'TestCollectionEndingWithWordList' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs new file mode 100644 index 000000000000..e3c86aefabe3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestCollectionEndingWithWordList + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestCollectionEndingWithWordListTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestCollectionEndingWithWordList + //private TestCollectionEndingWithWordList instance; + + public TestCollectionEndingWithWordListTests() + { + // TODO uncomment below to create an instance of TestCollectionEndingWithWordList + //instance = new TestCollectionEndingWithWordList(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestCollectionEndingWithWordList + /// + [Fact] + public void TestCollectionEndingWithWordListInstanceTest() + { + // TODO uncomment below to test "IsType" TestCollectionEndingWithWordList + //Assert.IsType(instance); + } + + /// + /// Test the property 'Value' + /// + [Fact] + public void ValueTest() + { + // TODO unit test for the property 'Value' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs new file mode 100644 index 000000000000..23e08d8e4e9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestInlineFreeformAdditionalPropertiesRequest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestInlineFreeformAdditionalPropertiesRequestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestInlineFreeformAdditionalPropertiesRequest + //private TestInlineFreeformAdditionalPropertiesRequest instance; + + public TestInlineFreeformAdditionalPropertiesRequestTests() + { + // TODO uncomment below to create an instance of TestInlineFreeformAdditionalPropertiesRequest + //instance = new TestInlineFreeformAdditionalPropertiesRequest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestInlineFreeformAdditionalPropertiesRequest + /// + [Fact] + public void TestInlineFreeformAdditionalPropertiesRequestInstanceTest() + { + // TODO uncomment below to test "IsType" TestInlineFreeformAdditionalPropertiesRequest + //Assert.IsType(instance); + } + + /// + /// Test the property 'SomeProperty' + /// + [Fact] + public void SomePropertyTest() + { + // TODO unit test for the property 'SomeProperty' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs new file mode 100644 index 000000000000..1293a2b212ed --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TriangleInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TriangleInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TriangleInterface + //private TriangleInterface instance; + + public TriangleInterfaceTests() + { + // TODO uncomment below to create an instance of TriangleInterface + //instance = new TriangleInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TriangleInterface + /// + [Fact] + public void TriangleInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" TriangleInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TriangleTests.cs new file mode 100644 index 000000000000..4cb535223483 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/TriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Triangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Triangle + //private Triangle instance; + + public TriangleTests() + { + // TODO uncomment below to create an instance of Triangle + //instance = new Triangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Triangle + /// + [Fact] + public void TriangleInstanceTest() + { + // TODO uncomment below to test "IsType" Triangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/UserTests.cs new file mode 100644 index 000000000000..6415f8561f1f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing User + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class UserTests : IDisposable + { + // TODO uncomment below to declare an instance variable for User + //private User instance; + + public UserTests() + { + // TODO uncomment below to create an instance of User + //instance = new User(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of User + /// + [Fact] + public void UserInstanceTest() + { + // TODO uncomment below to test "IsType" User + //Assert.IsType(instance); + } + + /// + /// Test the property 'AnyTypeProp' + /// + [Fact] + public void AnyTypePropTest() + { + // TODO unit test for the property 'AnyTypeProp' + } + + /// + /// Test the property 'AnyTypePropNullable' + /// + [Fact] + public void AnyTypePropNullableTest() + { + // TODO unit test for the property 'AnyTypePropNullable' + } + + /// + /// Test the property 'Email' + /// + [Fact] + public void EmailTest() + { + // TODO unit test for the property 'Email' + } + + /// + /// Test the property 'FirstName' + /// + [Fact] + public void FirstNameTest() + { + // TODO unit test for the property 'FirstName' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'LastName' + /// + [Fact] + public void LastNameTest() + { + // TODO unit test for the property 'LastName' + } + + /// + /// Test the property 'ObjectWithNoDeclaredProps' + /// + [Fact] + public void ObjectWithNoDeclaredPropsTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredProps' + } + + /// + /// Test the property 'ObjectWithNoDeclaredPropsNullable' + /// + [Fact] + public void ObjectWithNoDeclaredPropsNullableTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Phone' + /// + [Fact] + public void PhoneTest() + { + // TODO unit test for the property 'Phone' + } + + /// + /// Test the property 'UserStatus' + /// + [Fact] + public void UserStatusTest() + { + // TODO unit test for the property 'UserStatus' + } + + /// + /// Test the property 'Username' + /// + [Fact] + public void UsernameTest() + { + // TODO unit test for the property 'Username' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/WhaleTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/WhaleTests.cs new file mode 100644 index 000000000000..7d05cc5e59ab --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/WhaleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Whale + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class WhaleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Whale + //private Whale instance; + + public WhaleTests() + { + // TODO uncomment below to create an instance of Whale + //instance = new Whale(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Whale + /// + [Fact] + public void WhaleInstanceTest() + { + // TODO uncomment below to test "IsType" Whale + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'HasBaleen' + /// + [Fact] + public void HasBaleenTest() + { + // TODO unit test for the property 'HasBaleen' + } + + /// + /// Test the property 'HasTeeth' + /// + [Fact] + public void HasTeethTest() + { + // TODO unit test for the property 'HasTeeth' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ZebraTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ZebraTests.cs new file mode 100644 index 000000000000..cd0d1c1c361c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ZebraTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Zebra + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZebraTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Zebra + //private Zebra instance; + + public ZebraTests() + { + // TODO uncomment below to create an instance of Zebra + //instance = new Zebra(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Zebra + /// + [Fact] + public void ZebraInstanceTest() + { + // TODO uncomment below to test "IsType" Zebra + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 000000000000..b432edb28c23 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs new file mode 100644 index 000000000000..3689a873c342 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnum + //private ZeroBasedEnum instance; + + public ZeroBasedEnumTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnum + //instance = new ZeroBasedEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnum + /// + [Fact] + public void ZeroBasedEnumInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnum + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..012d0f37d648 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,19 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net9.0 + false + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs new file mode 100644 index 000000000000..3d7d0c482339 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -0,0 +1,403 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IAnotherFakeApi : IApi + { + /// + /// The class containing the events + /// + AnotherFakeApiEvents Events { get; } + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task Call123TestSpecialTagsOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ICall123TestSpecialTagsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class AnotherFakeApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnCall123TestSpecialTags; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorCall123TestSpecialTags; + + internal void ExecuteOnCall123TestSpecialTags(AnotherFakeApi.Call123TestSpecialTagsApiResponse apiResponse) + { + OnCall123TestSpecialTags?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCall123TestSpecialTags(Exception exception) + { + OnErrorCall123TestSpecialTags?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class AnotherFakeApi : IAnotherFakeApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public AnotherFakeApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, AnotherFakeApiEvents anotherFakeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = anotherFakeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatCall123TestSpecialTags(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCall123TestSpecialTags(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCall123TestSpecialTagsDefaultImplementation(ICall123TestSpecialTagsApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterCall123TestSpecialTags(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCall123TestSpecialTags(ref bool suppressDefaultLog, ICall123TestSpecialTagsApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCall123TestSpecialTagsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCall123TestSpecialTags(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCall123TestSpecialTags(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task Call123TestSpecialTagsOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await Call123TestSpecialTagsAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCall123TestSpecialTags(modelClient); + + FormatCall123TestSpecialTags(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/another-fake/dummy"; + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + Call123TestSpecialTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCall123TestSpecialTagsDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnCall123TestSpecialTags(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCall123TestSpecialTagsDefaultImplementation(e, "/another-fake/dummy", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorCall123TestSpecialTags(e); + throw; + } + } + + /// + /// The + /// + public partial class Call123TestSpecialTagsApiResponse : Org.OpenAPITools.Client.ApiResponse, ICall123TestSpecialTagsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public Call123TestSpecialTagsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..84ec2eff6bff --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,1356 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IDefaultApi : IApi + { + /// + /// The class containing the events + /// + DefaultApiEvents Events { get; } + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task FooGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetCountryAsync(string country, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetCountryOrDefaultAsync(string country, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task HelloAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Cancellation Token to cancel the request. + /// <> + Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task RolesReportGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task TestAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IFooGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IGetCountryApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class DefaultApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnFooGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFooGet; + + internal void ExecuteOnFooGet(DefaultApi.FooGetApiResponse apiResponse) + { + OnFooGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFooGet(Exception exception) + { + OnErrorFooGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetCountry; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetCountry; + + internal void ExecuteOnGetCountry(DefaultApi.GetCountryApiResponse apiResponse) + { + OnGetCountry?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetCountry(Exception exception) + { + OnErrorGetCountry?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnHello; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorHello; + + internal void ExecuteOnHello(DefaultApi.HelloApiResponse apiResponse) + { + OnHello?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorHello(Exception exception) + { + OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnRolesReportGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorRolesReportGet; + + internal void ExecuteOnRolesReportGet(DefaultApi.RolesReportGetApiResponse apiResponse) + { + OnRolesReportGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorRolesReportGet(Exception exception) + { + OnErrorRolesReportGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTest; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTest; + + internal void ExecuteOnTest(DefaultApi.TestApiResponse apiResponse) + { + OnTest?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTest(Exception exception) + { + OnErrorTest?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class DefaultApi : IDefaultApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public DefaultApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = defaultApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + /// + /// Processes the server response + /// + /// + private void AfterFooGetDefaultImplementation(IFooGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterFooGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterFooGet(ref bool suppressDefaultLog, IFooGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorFooGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFooGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorFooGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FooGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/foo"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FooGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFooGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnFooGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFooGetDefaultImplementation(e, "/foo", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorFooGet(e); + throw; + } + } + + /// + /// The + /// + public partial class FooGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IFooGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FooGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + /// + /// Deserializes the response if the response is 0 Default + /// + /// + public Org.OpenAPITools.Model.FooGetDefaultResponse Default() + { + // This logic may be modified with the AsModel.mustache template + return IsDefault + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 0 Default and the deserialized response is not null + /// + /// + /// + public bool TryDefault([NotNullWhen(true)]out Org.OpenAPITools.Model.FooGetDefaultResponse result) + { + result = null; + + try + { + result = Default(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetCountry(ref string country); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateGetCountry(string country) + { + if (country == null) + throw new ArgumentNullException(nameof(country)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetCountryDefaultImplementation(IGetCountryApiResponse apiResponseLocalVar, string country) + { + bool suppressDefaultLog = false; + AfterGetCountry(ref suppressDefaultLog, apiResponseLocalVar, country); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetCountry(ref bool suppressDefaultLog, IGetCountryApiResponse apiResponseLocalVar, string country); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetCountryDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string country) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetCountry(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, country); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetCountry(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string country); + + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetCountryOrDefaultAsync(string country, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetCountryAsync(country, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetCountryAsync(string country, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateGetCountry(country); + + FormatGetCountry(ref country); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/country"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("country", ClientUtils.ParameterToString(country))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetCountryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetCountryDefaultImplementation(apiResponseLocalVar, country); + + Events.ExecuteOnGetCountry(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetCountryDefaultImplementation(e, "/country", uriBuilderLocalVar.Path, country); + Events.ExecuteOnErrorGetCountry(e); + throw; + } + } + + /// + /// The + /// + public partial class GetCountryApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetCountryApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetCountryApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterHelloDefaultImplementation(IHelloApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterHello(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterHello(ref bool suppressDefaultLog, IHelloApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorHelloDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorHello(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorHello(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Hello Hello + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await HelloAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task HelloAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/hello"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + HelloApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); + + AfterHelloDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnHello(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorHelloDefaultImplementation(e, "/hello", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorHello(e); + throw; + } + } + + /// + /// The + /// + public partial class HelloApiResponse : Org.OpenAPITools.Client.ApiResponse, IHelloApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public HelloApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterRolesReportGetDefaultImplementation(IRolesReportGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterRolesReportGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterRolesReportGet(ref bool suppressDefaultLog, IRolesReportGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorRolesReportGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorRolesReportGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorRolesReportGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task RolesReportGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await RolesReportGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/roles/report"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + RolesReportGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); + + AfterRolesReportGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnRolesReportGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorRolesReportGetDefaultImplementation(e, "/roles/report", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorRolesReportGet(e); + throw; + } + } + + /// + /// The + /// + public partial class RolesReportGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IRolesReportGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public RolesReportGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterTestDefaultImplementation(ITestApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterTest(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterTest(ref bool suppressDefaultLog, ITestApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorTestDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTest(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorTest(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/test"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnTest(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestDefaultImplementation(e, "/test", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorTest(e); + throw; + } + } + + /// + /// The + /// + public partial class TestApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs new file mode 100644 index 000000000000..551265024789 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -0,0 +1,5688 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IFakeApi : IApi + { + /// + /// The class containing the events + /// + FakeApiEvents Events { get; } + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task FakeHealthGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task FakeHealthGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetArrayOfEnumsAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithFileSchemaOrDefaultAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithQueryParamsAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithQueryParamsOrDefaultAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClientModelOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEndpointParametersAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEndpointParametersOrDefaultAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEnumParametersAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEnumParametersOrDefaultAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestGroupParametersAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineAdditionalPropertiesOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineFreeformAdditionalPropertiesOrDefaultAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + Task TestJsonFormDataAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + Task TestJsonFormDataOrDefaultAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestQueryParameterCollectionFormatAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string requiredNullable = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestQueryParameterCollectionFormatOrDefaultAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string requiredNullable = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestStringMapReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced string map + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestStringMapReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IFakeHealthGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterBooleanSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterCompositeSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterNumberSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterStringSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetArrayOfEnumsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetMixedAnyOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetMixedOneOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestBodyWithFileSchemaApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestBodyWithQueryParamsApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestClientModelApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestEndpointParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface ITestEnumParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface ITestGroupParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface ITestInlineAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestInlineFreeformAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestJsonFormDataApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestQueryParameterCollectionFormatApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestStringMapReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeHealthGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeHealthGet; + + internal void ExecuteOnFakeHealthGet(FakeApi.FakeHealthGetApiResponse apiResponse) + { + OnFakeHealthGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeHealthGet(Exception exception) + { + OnErrorFakeHealthGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeOuterBooleanSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeOuterBooleanSerialize; + + internal void ExecuteOnFakeOuterBooleanSerialize(FakeApi.FakeOuterBooleanSerializeApiResponse apiResponse) + { + OnFakeOuterBooleanSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterBooleanSerialize(Exception exception) + { + OnErrorFakeOuterBooleanSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeOuterCompositeSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeOuterCompositeSerialize; + + internal void ExecuteOnFakeOuterCompositeSerialize(FakeApi.FakeOuterCompositeSerializeApiResponse apiResponse) + { + OnFakeOuterCompositeSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterCompositeSerialize(Exception exception) + { + OnErrorFakeOuterCompositeSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeOuterNumberSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeOuterNumberSerialize; + + internal void ExecuteOnFakeOuterNumberSerialize(FakeApi.FakeOuterNumberSerializeApiResponse apiResponse) + { + OnFakeOuterNumberSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterNumberSerialize(Exception exception) + { + OnErrorFakeOuterNumberSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFakeOuterStringSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFakeOuterStringSerialize; + + internal void ExecuteOnFakeOuterStringSerialize(FakeApi.FakeOuterStringSerializeApiResponse apiResponse) + { + OnFakeOuterStringSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterStringSerialize(Exception exception) + { + OnErrorFakeOuterStringSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetArrayOfEnums; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetArrayOfEnums; + + internal void ExecuteOnGetArrayOfEnums(FakeApi.GetArrayOfEnumsApiResponse apiResponse) + { + OnGetArrayOfEnums?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetArrayOfEnums(Exception exception) + { + OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetMixedAnyOf; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetMixedAnyOf; + + internal void ExecuteOnGetMixedAnyOf(FakeApi.GetMixedAnyOfApiResponse apiResponse) + { + OnGetMixedAnyOf?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetMixedAnyOf(Exception exception) + { + OnErrorGetMixedAnyOf?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetMixedOneOf; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetMixedOneOf; + + internal void ExecuteOnGetMixedOneOf(FakeApi.GetMixedOneOfApiResponse apiResponse) + { + OnGetMixedOneOf?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetMixedOneOf(Exception exception) + { + OnErrorGetMixedOneOf?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestAdditionalPropertiesReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestAdditionalPropertiesReference; + + internal void ExecuteOnTestAdditionalPropertiesReference(FakeApi.TestAdditionalPropertiesReferenceApiResponse apiResponse) + { + OnTestAdditionalPropertiesReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestAdditionalPropertiesReference(Exception exception) + { + OnErrorTestAdditionalPropertiesReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestBodyWithFileSchema; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestBodyWithFileSchema; + + internal void ExecuteOnTestBodyWithFileSchema(FakeApi.TestBodyWithFileSchemaApiResponse apiResponse) + { + OnTestBodyWithFileSchema?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestBodyWithFileSchema(Exception exception) + { + OnErrorTestBodyWithFileSchema?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestBodyWithQueryParams; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestBodyWithQueryParams; + + internal void ExecuteOnTestBodyWithQueryParams(FakeApi.TestBodyWithQueryParamsApiResponse apiResponse) + { + OnTestBodyWithQueryParams?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestBodyWithQueryParams(Exception exception) + { + OnErrorTestBodyWithQueryParams?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestClientModel; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestClientModel; + + internal void ExecuteOnTestClientModel(FakeApi.TestClientModelApiResponse apiResponse) + { + OnTestClientModel?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestClientModel(Exception exception) + { + OnErrorTestClientModel?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestEndpointParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestEndpointParameters; + + internal void ExecuteOnTestEndpointParameters(FakeApi.TestEndpointParametersApiResponse apiResponse) + { + OnTestEndpointParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestEndpointParameters(Exception exception) + { + OnErrorTestEndpointParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestEnumParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestEnumParameters; + + internal void ExecuteOnTestEnumParameters(FakeApi.TestEnumParametersApiResponse apiResponse) + { + OnTestEnumParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestEnumParameters(Exception exception) + { + OnErrorTestEnumParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestGroupParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestGroupParameters; + + internal void ExecuteOnTestGroupParameters(FakeApi.TestGroupParametersApiResponse apiResponse) + { + OnTestGroupParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestGroupParameters(Exception exception) + { + OnErrorTestGroupParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestInlineAdditionalProperties; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestInlineAdditionalProperties; + + internal void ExecuteOnTestInlineAdditionalProperties(FakeApi.TestInlineAdditionalPropertiesApiResponse apiResponse) + { + OnTestInlineAdditionalProperties?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestInlineAdditionalProperties(Exception exception) + { + OnErrorTestInlineAdditionalProperties?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestInlineFreeformAdditionalProperties; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestInlineFreeformAdditionalProperties; + + internal void ExecuteOnTestInlineFreeformAdditionalProperties(FakeApi.TestInlineFreeformAdditionalPropertiesApiResponse apiResponse) + { + OnTestInlineFreeformAdditionalProperties?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestInlineFreeformAdditionalProperties(Exception exception) + { + OnErrorTestInlineFreeformAdditionalProperties?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestJsonFormData; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestJsonFormData; + + internal void ExecuteOnTestJsonFormData(FakeApi.TestJsonFormDataApiResponse apiResponse) + { + OnTestJsonFormData?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestJsonFormData(Exception exception) + { + OnErrorTestJsonFormData?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestQueryParameterCollectionFormat; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestQueryParameterCollectionFormat; + + internal void ExecuteOnTestQueryParameterCollectionFormat(FakeApi.TestQueryParameterCollectionFormatApiResponse apiResponse) + { + OnTestQueryParameterCollectionFormat?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestQueryParameterCollectionFormat(Exception exception) + { + OnErrorTestQueryParameterCollectionFormat?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnTestStringMapReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestStringMapReference; + + internal void ExecuteOnTestStringMapReference(FakeApi.TestStringMapReferenceApiResponse apiResponse) + { + OnTestStringMapReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestStringMapReference(Exception exception) + { + OnErrorTestStringMapReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class FakeApi : IFakeApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public FakeApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, FakeApiEvents fakeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = fakeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + /// + /// Processes the server response + /// + /// + private void AfterFakeHealthGetDefaultImplementation(IFakeHealthGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterFakeHealthGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterFakeHealthGet(ref bool suppressDefaultLog, IFakeHealthGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorFakeHealthGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeHealthGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorFakeHealthGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Health check endpoint + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeHealthGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeHealthGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeHealthGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/health"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeHealthGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeHealthGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnFakeHealthGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeHealthGetDefaultImplementation(e, "/fake/health", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorFakeHealthGet(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeHealthGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeHealthGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeHealthGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.HealthCheckResult Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.HealthCheckResult result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterBooleanSerialize(ref Option body); + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterBooleanSerializeDefaultImplementation(IFakeOuterBooleanSerializeApiResponse apiResponseLocalVar, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterBooleanSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, IFakeOuterBooleanSerializeApiResponse apiResponseLocalVar, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterBooleanSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterBooleanSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body); + + /// + /// Test serialization of outer boolean types + /// + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterBooleanSerializeAsync(body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatFakeOuterBooleanSerialize(ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/boolean"; + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterBooleanSerializeDefaultImplementation(apiResponseLocalVar, body); + + Events.ExecuteOnFakeOuterBooleanSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterBooleanSerializeDefaultImplementation(e, "/fake/outer/boolean", uriBuilderLocalVar.Path, body); + Events.ExecuteOnErrorFakeOuterBooleanSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterBooleanSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterBooleanSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterBooleanSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public bool? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out bool? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterCompositeSerialize(Option outerComposite); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterCompositeSerialize(Option outerComposite) + { + if (outerComposite.IsSet && outerComposite.Value == null) + throw new ArgumentNullException(nameof(outerComposite)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterCompositeSerializeDefaultImplementation(IFakeOuterCompositeSerializeApiResponse apiResponseLocalVar, Option outerComposite) + { + bool suppressDefaultLog = false; + AfterFakeOuterCompositeSerialize(ref suppressDefaultLog, apiResponseLocalVar, outerComposite); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, IFakeOuterCompositeSerializeApiResponse apiResponseLocalVar, Option outerComposite); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option outerComposite) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterCompositeSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, outerComposite); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterCompositeSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option outerComposite); + + /// + /// Test serialization of object with outer number type + /// + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterCompositeSerializeAsync(outerComposite, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFakeOuterCompositeSerialize(outerComposite); + + FormatFakeOuterCompositeSerialize(outerComposite); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/composite"; + + if (outerComposite.IsSet) + httpRequestMessageLocalVar.Content = (outerComposite.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterCompositeSerializeDefaultImplementation(apiResponseLocalVar, outerComposite); + + Events.ExecuteOnFakeOuterCompositeSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterCompositeSerializeDefaultImplementation(e, "/fake/outer/composite", uriBuilderLocalVar.Path, outerComposite); + Events.ExecuteOnErrorFakeOuterCompositeSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterCompositeSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterCompositeSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterCompositeSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.OuterComposite Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.OuterComposite result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterNumberSerialize(ref Option body); + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterNumberSerializeDefaultImplementation(IFakeOuterNumberSerializeApiResponse apiResponseLocalVar, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterNumberSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, IFakeOuterNumberSerializeApiResponse apiResponseLocalVar, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterNumberSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterNumberSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body); + + /// + /// Test serialization of outer number types + /// + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterNumberSerializeAsync(body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatFakeOuterNumberSerialize(ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/number"; + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterNumberSerializeDefaultImplementation(apiResponseLocalVar, body); + + Events.ExecuteOnFakeOuterNumberSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterNumberSerializeDefaultImplementation(e, "/fake/outer/number", uriBuilderLocalVar.Path, body); + Events.ExecuteOnErrorFakeOuterNumberSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterNumberSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterNumberSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterNumberSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public decimal? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out decimal? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref Option body); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterStringSerialize(Option body) + { + if (body.IsSet && body.Value == null) + throw new ArgumentNullException(nameof(body)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterFakeOuterStringSerializeDefaultImplementation(IFakeOuterStringSerializeApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterStringSerialize(ref suppressDefaultLog, apiResponseLocalVar, requiredStringUuid, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, IFakeOuterStringSerializeApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Guid requiredStringUuid, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterStringSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requiredStringUuid, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterStringSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Guid requiredStringUuid, Option body); + + /// + /// Test serialization of outer string types + /// + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterStringSerializeAsync(requiredStringUuid, body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFakeOuterStringSerialize(body); + + FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/string"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["required_string_uuid"] = ClientUtils.ParameterToString(requiredStringUuid); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterStringSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterStringSerializeDefaultImplementation(apiResponseLocalVar, requiredStringUuid, body); + + Events.ExecuteOnFakeOuterStringSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterStringSerializeDefaultImplementation(e, "/fake/outer/string", uriBuilderLocalVar.Path, requiredStringUuid, body); + Events.ExecuteOnErrorFakeOuterStringSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterStringSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterStringSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterStringSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public string Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out string result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetArrayOfEnumsDefaultImplementation(IGetArrayOfEnumsApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetArrayOfEnums(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetArrayOfEnums(ref bool suppressDefaultLog, IGetArrayOfEnumsApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetArrayOfEnumsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetArrayOfEnums(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetArrayOfEnums(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Array of Enums + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetArrayOfEnumsAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetArrayOfEnumsAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/array-of-enums"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetArrayOfEnumsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetArrayOfEnumsDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetArrayOfEnums(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetArrayOfEnumsDefaultImplementation(e, "/fake/array-of-enums", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetArrayOfEnums(e); + throw; + } + } + + /// + /// The + /// + public partial class GetArrayOfEnumsApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetArrayOfEnumsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetArrayOfEnumsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetMixedAnyOfDefaultImplementation(IGetMixedAnyOfApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetMixedAnyOf(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetMixedAnyOf(ref bool suppressDefaultLog, IGetMixedAnyOfApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetMixedAnyOfDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetMixedAnyOf(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetMixedAnyOf(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Test mixed type anyOf deserialization + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetMixedAnyOfAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/anyOf"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetMixedAnyOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetMixedAnyOf(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetMixedAnyOfDefaultImplementation(e, "/fake/mixed/anyOf", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetMixedAnyOf(e); + throw; + } + } + + /// + /// The + /// + public partial class GetMixedAnyOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedAnyOfApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetMixedAnyOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.MixedAnyOf Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedAnyOf result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetMixedOneOfDefaultImplementation(IGetMixedOneOfApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetMixedOneOf(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetMixedOneOf(ref bool suppressDefaultLog, IGetMixedOneOfApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetMixedOneOfDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetMixedOneOf(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetMixedOneOf(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Test mixed type oneOf deserialization + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetMixedOneOfAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/oneOf"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetMixedOneOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetMixedOneOf(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetMixedOneOfDefaultImplementation(e, "/fake/mixed/oneOf", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetMixedOneOf(e); + throw; + } + } + + /// + /// The + /// + public partial class GetMixedOneOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedOneOfApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetMixedOneOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.MixedOneOf Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedOneOf result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestAdditionalPropertiesReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestAdditionalPropertiesReferenceDefaultImplementation(ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestAdditionalPropertiesReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestAdditionalPropertiesReference(ref bool suppressDefaultLog, ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestAdditionalPropertiesReference(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestAdditionalPropertiesReference(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAdditionalPropertiesReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestAdditionalPropertiesReference(requestBody); + + FormatTestAdditionalPropertiesReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/additionalProperties-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestAdditionalPropertiesReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(e, "/fake/additionalProperties-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestAdditionalPropertiesReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestAdditionalPropertiesReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestAdditionalPropertiesReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) + { + if (fileSchemaTestClass == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestBodyWithFileSchemaDefaultImplementation(ITestBodyWithFileSchemaApiResponse apiResponseLocalVar, FileSchemaTestClass fileSchemaTestClass) + { + bool suppressDefaultLog = false; + AfterTestBodyWithFileSchema(ref suppressDefaultLog, apiResponseLocalVar, fileSchemaTestClass); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestBodyWithFileSchema(ref bool suppressDefaultLog, ITestBodyWithFileSchemaApiResponse apiResponseLocalVar, FileSchemaTestClass fileSchemaTestClass); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestBodyWithFileSchemaDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, FileSchemaTestClass fileSchemaTestClass) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestBodyWithFileSchema(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, fileSchemaTestClass); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestBodyWithFileSchema(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, FileSchemaTestClass fileSchemaTestClass); + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithFileSchemaOrDefaultAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestBodyWithFileSchemaAsync(fileSchemaTestClass, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestBodyWithFileSchema(fileSchemaTestClass); + + FormatTestBodyWithFileSchema(fileSchemaTestClass); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/body-with-file-schema"; + + httpRequestMessageLocalVar.Content = (fileSchemaTestClass as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(fileSchemaTestClass, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestBodyWithFileSchemaDefaultImplementation(apiResponseLocalVar, fileSchemaTestClass); + + Events.ExecuteOnTestBodyWithFileSchema(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestBodyWithFileSchemaDefaultImplementation(e, "/fake/body-with-file-schema", uriBuilderLocalVar.Path, fileSchemaTestClass); + Events.ExecuteOnErrorTestBodyWithFileSchema(e); + throw; + } + } + + /// + /// The + /// + public partial class TestBodyWithFileSchemaApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestBodyWithFileSchemaApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestBodyWithFileSchemaApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestBodyWithQueryParams(ref string query, User user); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateTestBodyWithQueryParams(string query, User user) + { + if (query == null) + throw new ArgumentNullException(nameof(query)); + + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterTestBodyWithQueryParamsDefaultImplementation(ITestBodyWithQueryParamsApiResponse apiResponseLocalVar, string query, User user) + { + bool suppressDefaultLog = false; + AfterTestBodyWithQueryParams(ref suppressDefaultLog, apiResponseLocalVar, query, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterTestBodyWithQueryParams(ref bool suppressDefaultLog, ITestBodyWithQueryParamsApiResponse apiResponseLocalVar, string query, User user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorTestBodyWithQueryParamsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string query, User user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestBodyWithQueryParams(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, query, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestBodyWithQueryParams(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string query, User user); + + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithQueryParamsOrDefaultAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestBodyWithQueryParamsAsync(query, user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithQueryParamsAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestBodyWithQueryParams(query, user); + + FormatTestBodyWithQueryParams(ref query, user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/body-with-query-params"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["query"] = ClientUtils.ParameterToString(query); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestBodyWithQueryParamsDefaultImplementation(apiResponseLocalVar, query, user); + + Events.ExecuteOnTestBodyWithQueryParams(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestBodyWithQueryParamsDefaultImplementation(e, "/fake/body-with-query-params", uriBuilderLocalVar.Path, query, user); + Events.ExecuteOnErrorTestBodyWithQueryParams(e); + throw; + } + } + + /// + /// The + /// + public partial class TestBodyWithQueryParamsApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestBodyWithQueryParamsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestBodyWithQueryParamsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestClientModel(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestClientModel(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestClientModelDefaultImplementation(ITestClientModelApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterTestClientModel(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestClientModel(ref bool suppressDefaultLog, ITestClientModelApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestClientModelDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestClientModel(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestClientModel(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test \"client\" model To test \"client\" model + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClientModelOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestClientModelAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestClientModel(modelClient); + + FormatTestClientModel(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestClientModelApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestClientModelDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnTestClientModel(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestClientModelDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorTestClientModel(e); + throw; + } + } + + /// + /// The + /// + public partial class TestClientModelApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestClientModelApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestClientModelApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestEndpointParameters(ref decimal number, ref string patternWithoutDelimiter, ref byte[] varByte, ref double varDouble, ref Option binary, ref Option callback, ref Option date, ref Option dateTime, ref Option int32, ref Option int64, ref Option integer, ref Option password, ref Option varFloat, ref Option varString); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEndpointParameters(string patternWithoutDelimiter, byte[] varByte, Option binary, Option callback, Option password, Option varString) + { + if (patternWithoutDelimiter == null) + throw new ArgumentNullException(nameof(patternWithoutDelimiter)); + + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); + + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary)); + + if (callback.IsSet && callback.Value == null) + throw new ArgumentNullException(nameof(callback)); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString) + { + bool suppressDefaultLog = false; + AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestEndpointParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestEndpointParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEndpointParametersOrDefaultAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestEndpointParametersAsync(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEndpointParametersAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestEndpointParameters(patternWithoutDelimiter, varByte, binary, callback, password, varString); + + FormatTestEndpointParameters(ref number, ref patternWithoutDelimiter, ref varByte, ref varDouble, ref binary, ref callback, ref date, ref dateTime, ref int32, ref int64, ref integer, ref password, ref varFloat, ref varString); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("number", ClientUtils.ParameterToString(number))); + + formParameterLocalVars.Add(new KeyValuePair("pattern_without_delimiter", ClientUtils.ParameterToString(patternWithoutDelimiter))); + + formParameterLocalVars.Add(new KeyValuePair("byte", ClientUtils.ParameterToString(varByte))); + + formParameterLocalVars.Add(new KeyValuePair("double", ClientUtils.ParameterToString(varDouble))); + + if (binary.IsSet) + multipartContentLocalVar.Add(new StreamContent(binary.Value)); + + if (callback.IsSet) + formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback.Value))); + + if (date.IsSet) + formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date.Value))); + + if (dateTime.IsSet) + formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime.Value))); + + if (int32.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32.Value))); + + if (int64.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64.Value))); + + if (integer.IsSet) + formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer.Value))); + + if (password.IsSet) + formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password.Value))); + + if (varFloat.IsSet) + formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat.Value))); + + if (varString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BasicToken basicTokenLocalVar1 = (BasicToken) await BasicTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(basicTokenLocalVar1); + + basicTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestEndpointParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestEndpointParametersDefaultImplementation(apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + + Events.ExecuteOnTestEndpointParameters(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestEndpointParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + Events.ExecuteOnErrorTestEndpointParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestEndpointParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestEndpointParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestEndpointParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestEnumParameters(ref Option enumFormString, Option> enumFormStringArray, ref Option enumHeaderString, Option> enumHeaderStringArray, ref Option enumQueryDouble, ref Option enumQueryInteger, ref Option enumQueryString, Option> enumQueryStringArray); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEnumParameters(Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryString, Option> enumQueryStringArray) + { + if (enumFormString.IsSet && enumFormString.Value == null) + throw new ArgumentNullException(nameof(enumFormString)); + + if (enumFormStringArray.IsSet && enumFormStringArray.Value == null) + throw new ArgumentNullException(nameof(enumFormStringArray)); + + if (enumHeaderString.IsSet && enumHeaderString.Value == null) + throw new ArgumentNullException(nameof(enumHeaderString)); + + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); + + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); + + if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) + throw new ArgumentNullException(nameof(enumQueryStringArray)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestEnumParametersDefaultImplementation(ITestEnumParametersApiResponse apiResponseLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray) + { + bool suppressDefaultLog = false; + AfterTestEnumParameters(ref suppressDefaultLog, apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ITestEnumParametersApiResponse apiResponseLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestEnumParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestEnumParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestEnumParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray); + + /// + /// To test enum parameters To test enum parameters + /// + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEnumParametersOrDefaultAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestEnumParametersAsync(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEnumParametersAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestEnumParameters(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryString, enumQueryStringArray); + + FormatTestEnumParameters(ref enumFormString, enumFormStringArray, ref enumHeaderString, enumHeaderStringArray, ref enumQueryDouble, ref enumQueryInteger, ref enumQueryString, enumQueryStringArray); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + if (enumQueryDouble.IsSet) + parseQueryStringLocalVar["enum_query_double"] = ClientUtils.ParameterToString(enumQueryDouble.Value); + + if (enumQueryInteger.IsSet) + parseQueryStringLocalVar["enum_query_integer"] = ClientUtils.ParameterToString(enumQueryInteger.Value); + + if (enumQueryString.IsSet) + parseQueryStringLocalVar["enum_query_string"] = ClientUtils.ParameterToString(enumQueryString.Value); + + if (enumQueryStringArray.IsSet) + parseQueryStringLocalVar["enum_query_string_array"] = ClientUtils.ParameterToString(enumQueryStringArray.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + if (enumHeaderString.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString.Value)); + + if (enumHeaderStringArray.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray.Value)); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString.Value))); + + if (enumFormStringArray.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray.Value))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestEnumParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestEnumParametersDefaultImplementation(apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + + Events.ExecuteOnTestEnumParameters(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestEnumParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + Events.ExecuteOnErrorTestEnumParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestEnumParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestEnumParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestEnumParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref long requiredInt64Group, ref int requiredStringGroup, ref Option booleanGroup, ref Option int64Group, ref Option stringGroup); + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestGroupParametersDefaultImplementation(ITestGroupParametersApiResponse apiResponseLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup) + { + bool suppressDefaultLog = false; + AfterTestGroupParameters(ref suppressDefaultLog, apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ITestGroupParametersApiResponse apiResponseLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestGroupParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestGroupParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestGroupParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup); + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestGroupParametersAsync(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestGroupParametersAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredInt64Group, ref requiredStringGroup, ref booleanGroup, ref int64Group, ref stringGroup); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["required_int64_group"] = ClientUtils.ParameterToString(requiredInt64Group); + parseQueryStringLocalVar["required_string_group"] = ClientUtils.ParameterToString(requiredStringGroup); + + if (int64Group.IsSet) + parseQueryStringLocalVar["int64_group"] = ClientUtils.ParameterToString(int64Group.Value); + + if (stringGroup.IsSet) + parseQueryStringLocalVar["string_group"] = ClientUtils.ParameterToString(stringGroup.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.Headers.Add("required_boolean_group", ClientUtils.ParameterToString(requiredBooleanGroup)); + + if (booleanGroup.IsSet) + httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BearerToken bearerTokenLocalVar1 = (BearerToken) await BearerTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(bearerTokenLocalVar1); + + bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestGroupParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestGroupParametersDefaultImplementation(apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + + Events.ExecuteOnTestGroupParameters(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestGroupParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + Events.ExecuteOnErrorTestGroupParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestGroupParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestGroupParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestGroupParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestInlineAdditionalProperties(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestInlineAdditionalProperties(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestInlineAdditionalPropertiesDefaultImplementation(ITestInlineAdditionalPropertiesApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestInlineAdditionalProperties(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestInlineAdditionalProperties(ref bool suppressDefaultLog, ITestInlineAdditionalPropertiesApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestInlineAdditionalPropertiesDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestInlineAdditionalProperties(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestInlineAdditionalProperties(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test inline additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineAdditionalPropertiesOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestInlineAdditionalPropertiesAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestInlineAdditionalProperties(requestBody); + + FormatTestInlineAdditionalProperties(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/inline-additionalProperties"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestInlineAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestInlineAdditionalProperties(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestInlineAdditionalPropertiesDefaultImplementation(e, "/fake/inline-additionalProperties", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestInlineAdditionalProperties(e); + throw; + } + } + + /// + /// The + /// + public partial class TestInlineAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestInlineAdditionalPropertiesApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestInlineAdditionalPropertiesApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + if (testInlineFreeformAdditionalPropertiesRequest == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(ITestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + bool suppressDefaultLog = false; + AfterTestInlineFreeformAdditionalProperties(ref suppressDefaultLog, apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestInlineFreeformAdditionalProperties(ref bool suppressDefaultLog, ITestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestInlineFreeformAdditionalPropertiesDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestInlineFreeformAdditionalProperties(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, testInlineFreeformAdditionalPropertiesRequest); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestInlineFreeformAdditionalProperties(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// test inline free-form additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineFreeformAdditionalPropertiesOrDefaultAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + + FormatTestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/inline-freeform-additionalProperties"; + + httpRequestMessageLocalVar.Content = (testInlineFreeformAdditionalPropertiesRequest as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(testInlineFreeformAdditionalPropertiesRequest, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); + + Events.ExecuteOnTestInlineFreeformAdditionalProperties(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestInlineFreeformAdditionalPropertiesDefaultImplementation(e, "/fake/inline-freeform-additionalProperties", uriBuilderLocalVar.Path, testInlineFreeformAdditionalPropertiesRequest); + Events.ExecuteOnErrorTestInlineFreeformAdditionalProperties(e); + throw; + } + } + + /// + /// The + /// + public partial class TestInlineFreeformAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestInlineFreeformAdditionalPropertiesApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestInlineFreeformAdditionalPropertiesApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestJsonFormData(ref string param, ref string param2); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateTestJsonFormData(string param, string param2) + { + if (param == null) + throw new ArgumentNullException(nameof(param)); + + if (param2 == null) + throw new ArgumentNullException(nameof(param2)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterTestJsonFormDataDefaultImplementation(ITestJsonFormDataApiResponse apiResponseLocalVar, string param, string param2) + { + bool suppressDefaultLog = false; + AfterTestJsonFormData(ref suppressDefaultLog, apiResponseLocalVar, param, param2); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterTestJsonFormData(ref bool suppressDefaultLog, ITestJsonFormDataApiResponse apiResponseLocalVar, string param, string param2); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorTestJsonFormDataDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string param, string param2) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestJsonFormData(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, param, param2); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestJsonFormData(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string param, string param2); + + /// + /// test json serialization of form data + /// + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + public async Task TestJsonFormDataOrDefaultAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestJsonFormDataAsync(param, param2, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + public async Task TestJsonFormDataAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestJsonFormData(param, param2); + + FormatTestJsonFormData(ref param, ref param2); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/jsonFormData"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("param", ClientUtils.ParameterToString(param))); + + formParameterLocalVars.Add(new KeyValuePair("param2", ClientUtils.ParameterToString(param2))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestJsonFormDataApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestJsonFormDataDefaultImplementation(apiResponseLocalVar, param, param2); + + Events.ExecuteOnTestJsonFormData(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestJsonFormDataDefaultImplementation(e, "/fake/jsonFormData", uriBuilderLocalVar.Path, param, param2); + Events.ExecuteOnErrorTestJsonFormData(e); + throw; + } + } + + /// + /// The + /// + public partial class TestJsonFormDataApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestJsonFormDataApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestJsonFormDataApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestQueryParameterCollectionFormat(List context, List http, List ioutil, List pipe, ref string requiredNotNullable, List url, ref Option notRequiredNotNullable, ref Option notRequiredNullable, ref string requiredNullable); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestQueryParameterCollectionFormat(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable) + { + if (context == null) + throw new ArgumentNullException(nameof(context)); + + if (http == null) + throw new ArgumentNullException(nameof(http)); + + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + + if (pipe == null) + throw new ArgumentNullException(nameof(pipe)); + + if (requiredNotNullable == null) + throw new ArgumentNullException(nameof(requiredNotNullable)); + + if (url == null) + throw new ArgumentNullException(nameof(url)); + + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ITestQueryParameterCollectionFormatApiResponse apiResponseLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string requiredNullable) + { + bool suppressDefaultLog = false; + AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ITestQueryParameterCollectionFormatApiResponse apiResponseLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string requiredNullable); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string requiredNullable) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestQueryParameterCollectionFormat(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestQueryParameterCollectionFormat(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string requiredNullable); + + /// + /// To test the collection format in query parameters + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestQueryParameterCollectionFormatOrDefaultAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string requiredNullable = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestQueryParameterCollectionFormatAsync(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestQueryParameterCollectionFormatAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string requiredNullable = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestQueryParameterCollectionFormat(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable); + + FormatTestQueryParameterCollectionFormat(context, http, ioutil, pipe, ref requiredNotNullable, url, ref notRequiredNotNullable, ref notRequiredNullable, ref requiredNullable); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/test-query-parameters"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["context"] = ClientUtils.ParameterToString(context); + parseQueryStringLocalVar["http"] = ClientUtils.ParameterToString(http); + parseQueryStringLocalVar["ioutil"] = ClientUtils.ParameterToString(ioutil); + parseQueryStringLocalVar["pipe"] = ClientUtils.ParameterToString(pipe); + parseQueryStringLocalVar["requiredNotNullable"] = ClientUtils.ParameterToString(requiredNotNullable); + parseQueryStringLocalVar["url"] = ClientUtils.ParameterToString(url); + parseQueryStringLocalVar["requiredNullable"] = ClientUtils.ParameterToString(requiredNullable); + + if (notRequiredNotNullable.IsSet) + parseQueryStringLocalVar["notRequiredNotNullable"] = ClientUtils.ParameterToString(notRequiredNotNullable.Value); + + if (notRequiredNullable.IsSet) + parseQueryStringLocalVar["notRequiredNullable"] = ClientUtils.ParameterToString(notRequiredNullable.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + + Events.ExecuteOnTestQueryParameterCollectionFormat(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + Events.ExecuteOnErrorTestQueryParameterCollectionFormat(e); + throw; + } + } + + /// + /// The + /// + public partial class TestQueryParameterCollectionFormatApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestQueryParameterCollectionFormatApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestQueryParameterCollectionFormatApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestStringMapReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestStringMapReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestStringMapReferenceDefaultImplementation(ITestStringMapReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestStringMapReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestStringMapReference(ref bool suppressDefaultLog, ITestStringMapReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestStringMapReferenceDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestStringMapReference(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestStringMapReference(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test referenced string map + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestStringMapReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestStringMapReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestStringMapReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestStringMapReference(requestBody); + + FormatTestStringMapReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/stringMap-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestStringMapReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestStringMapReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestStringMapReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestStringMapReferenceDefaultImplementation(e, "/fake/stringMap-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestStringMapReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestStringMapReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestStringMapReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestStringMapReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs new file mode 100644 index 000000000000..a12284afb01b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -0,0 +1,416 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IFakeClassnameTags123Api : IApi + { + /// + /// The class containing the events + /// + FakeClassnameTags123ApiEvents Events { get; } + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClassnameOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ITestClassnameApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeClassnameTags123ApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnTestClassname; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorTestClassname; + + internal void ExecuteOnTestClassname(FakeClassnameTags123Api.TestClassnameApiResponse apiResponse) + { + OnTestClassname?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestClassname(Exception exception) + { + OnErrorTestClassname?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class FakeClassnameTags123Api : IFakeClassnameTags123Api + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public FakeClassnameTags123ApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, FakeClassnameTags123ApiEvents fakeClassnameTags123ApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = fakeClassnameTags123ApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatTestClassname(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestClassname(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestClassnameDefaultImplementation(ITestClassnameApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterTestClassname(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestClassname(ref bool suppressDefaultLog, ITestClassnameApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestClassnameDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestClassname(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestClassname(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test class name in snake case To test class name in snake case + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClassnameOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestClassnameAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestClassname(modelClient); + + FormatTestClassname(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake_classname_test"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key_query", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + + apiKeyTokenLocalVar1.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestClassnameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestClassnameDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnTestClassname(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestClassnameDefaultImplementation(e, "/fake_classname_test", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorTestClassname(e); + throw; + } + } + + /// + /// The + /// + public partial class TestClassnameApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestClassnameApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestClassnameApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs new file mode 100644 index 000000000000..0350d428124a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -0,0 +1,2828 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IPetApi : IApi + { + /// + /// The class containing the events + /// + PetApiEvents Events { get; } + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task AddPetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + Task DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + Task DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Cancellation Token to cancel the request. + /// <> + Task FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter (deprecated) + /// Cancellation Token to cancel the request. + /// <> + Task FindPetsByStatusOrDefaultAsync(List status, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + [Obsolete] + Task FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + [Obsolete] + Task FindPetsByTagsOrDefaultAsync(List tags, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + Task GetPetByIdOrDefaultAsync(long petId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image + /// + /// + /// + /// + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileOrDefaultAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileWithRequiredFileOrDefaultAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IAddPetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IDeletePetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface IFindPetsByStatusApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } + } + + /// + /// The + /// + public interface IFindPetsByTagsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface IGetPetByIdApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IUpdatePetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IUpdatePetWithFormApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IUploadFileApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IUploadFileWithRequiredFileApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class PetApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnAddPet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorAddPet; + + internal void ExecuteOnAddPet(PetApi.AddPetApiResponse apiResponse) + { + OnAddPet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorAddPet(Exception exception) + { + OnErrorAddPet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnDeletePet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorDeletePet; + + internal void ExecuteOnDeletePet(PetApi.DeletePetApiResponse apiResponse) + { + OnDeletePet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeletePet(Exception exception) + { + OnErrorDeletePet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFindPetsByStatus; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFindPetsByStatus; + + internal void ExecuteOnFindPetsByStatus(PetApi.FindPetsByStatusApiResponse apiResponse) + { + OnFindPetsByStatus?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFindPetsByStatus(Exception exception) + { + OnErrorFindPetsByStatus?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnFindPetsByTags; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorFindPetsByTags; + + internal void ExecuteOnFindPetsByTags(PetApi.FindPetsByTagsApiResponse apiResponse) + { + OnFindPetsByTags?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFindPetsByTags(Exception exception) + { + OnErrorFindPetsByTags?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetPetById; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetPetById; + + internal void ExecuteOnGetPetById(PetApi.GetPetByIdApiResponse apiResponse) + { + OnGetPetById?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetPetById(Exception exception) + { + OnErrorGetPetById?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUpdatePet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUpdatePet; + + internal void ExecuteOnUpdatePet(PetApi.UpdatePetApiResponse apiResponse) + { + OnUpdatePet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdatePet(Exception exception) + { + OnErrorUpdatePet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUpdatePetWithForm; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUpdatePetWithForm; + + internal void ExecuteOnUpdatePetWithForm(PetApi.UpdatePetWithFormApiResponse apiResponse) + { + OnUpdatePetWithForm?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdatePetWithForm(Exception exception) + { + OnErrorUpdatePetWithForm?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUploadFile; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUploadFile; + + internal void ExecuteOnUploadFile(PetApi.UploadFileApiResponse apiResponse) + { + OnUploadFile?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUploadFile(Exception exception) + { + OnErrorUploadFile?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUploadFileWithRequiredFile; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUploadFileWithRequiredFile; + + internal void ExecuteOnUploadFileWithRequiredFile(PetApi.UploadFileWithRequiredFileApiResponse apiResponse) + { + OnUploadFileWithRequiredFile?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUploadFileWithRequiredFile(Exception exception) + { + OnErrorUploadFileWithRequiredFile?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class PetApi : IPetApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public PetApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, PetApiEvents petApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = petApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatAddPet(Pet pet); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateAddPet(Pet pet) + { + if (pet == null) + throw new ArgumentNullException(nameof(pet)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterAddPetDefaultImplementation(IAddPetApiResponse apiResponseLocalVar, Pet pet) + { + bool suppressDefaultLog = false; + AfterAddPet(ref suppressDefaultLog, apiResponseLocalVar, pet); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterAddPet(ref bool suppressDefaultLog, IAddPetApiResponse apiResponseLocalVar, Pet pet); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorAddPetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet) + { + bool suppressDefaultLogLocalVar = false; + OnErrorAddPet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, pet); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorAddPet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet); + + /// + /// Add a new pet to the store + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task AddPetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await AddPetAsync(pet, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateAddPet(pet); + + FormatAddPet(pet); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("http://petstore.swagger.io/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + + httpRequestMessageLocalVar.Content = (pet as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] contentTypes = new string[] { + "application/json", + "application/xml" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + AddPetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + + AfterAddPetDefaultImplementation(apiResponseLocalVar, pet); + + Events.ExecuteOnAddPet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorAddPetDefaultImplementation(e, "/pet", uriBuilderLocalVar.Path, pet); + Events.ExecuteOnErrorAddPet(e); + throw; + } + } + + /// + /// The + /// + public partial class AddPetApiResponse : Org.OpenAPITools.Client.ApiResponse, IAddPetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public AddPetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatDeletePet(ref long petId, ref Option apiKey); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeletePet(Option apiKey) + { + if (apiKey.IsSet && apiKey.Value == null) + throw new ArgumentNullException(nameof(apiKey)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterDeletePetDefaultImplementation(IDeletePetApiResponse apiResponseLocalVar, long petId, Option apiKey) + { + bool suppressDefaultLog = false; + AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterDeletePet(ref bool suppressDefaultLog, IDeletePetApiResponse apiResponseLocalVar, long petId, Option apiKey); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorDeletePetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option apiKey) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeletePet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, apiKey); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorDeletePet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option apiKey); + + /// + /// Deletes a pet + /// + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeletePetAsync(petId, apiKey, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeletePet(apiKey); + + FormatDeletePet(ref petId, ref apiKey); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + if (apiKey.IsSet) + httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeletePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeletePetDefaultImplementation(apiResponseLocalVar, petId, apiKey); + + Events.ExecuteOnDeletePet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeletePetDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId, apiKey); + Events.ExecuteOnErrorDeletePet(e); + throw; + } + } + + /// + /// The + /// + public partial class DeletePetApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeletePetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeletePetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFindPetsByStatus(List status); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFindPetsByStatus(List status) + { + if (status == null) + throw new ArgumentNullException(nameof(status)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFindPetsByStatusDefaultImplementation(IFindPetsByStatusApiResponse apiResponseLocalVar, List status) + { + bool suppressDefaultLog = false; + AfterFindPetsByStatus(ref suppressDefaultLog, apiResponseLocalVar, status); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFindPetsByStatus(ref bool suppressDefaultLog, IFindPetsByStatusApiResponse apiResponseLocalVar, List status); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFindPetsByStatusDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List status) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFindPetsByStatus(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, status); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFindPetsByStatus(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List status); + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByStatusOrDefaultAsync(List status, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FindPetsByStatusAsync(status, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFindPetsByStatus(status); + + FormatFindPetsByStatus(status); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/findByStatus"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["status"] = ClientUtils.ParameterToString(status); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FindPetsByStatusApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFindPetsByStatusDefaultImplementation(apiResponseLocalVar, status); + + Events.ExecuteOnFindPetsByStatus(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFindPetsByStatusDefaultImplementation(e, "/pet/findByStatus", uriBuilderLocalVar.Path, status); + Events.ExecuteOnErrorFindPetsByStatus(e); + throw; + } + } + + /// + /// The + /// + public partial class FindPetsByStatusApiResponse : Org.OpenAPITools.Client.ApiResponse, IFindPetsByStatusApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FindPetsByStatusApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFindPetsByTags(List tags); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFindPetsByTags(List tags) + { + if (tags == null) + throw new ArgumentNullException(nameof(tags)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFindPetsByTagsDefaultImplementation(IFindPetsByTagsApiResponse apiResponseLocalVar, List tags) + { + bool suppressDefaultLog = false; + AfterFindPetsByTags(ref suppressDefaultLog, apiResponseLocalVar, tags); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFindPetsByTags(ref bool suppressDefaultLog, IFindPetsByTagsApiResponse apiResponseLocalVar, List tags); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFindPetsByTagsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List tags) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFindPetsByTags(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, tags); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFindPetsByTags(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List tags); + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByTagsOrDefaultAsync(List tags, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FindPetsByTagsAsync(tags, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFindPetsByTags(tags); + + FormatFindPetsByTags(tags); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/findByTags"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["tags"] = ClientUtils.ParameterToString(tags); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FindPetsByTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFindPetsByTagsDefaultImplementation(apiResponseLocalVar, tags); + + Events.ExecuteOnFindPetsByTags(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFindPetsByTagsDefaultImplementation(e, "/pet/findByTags", uriBuilderLocalVar.Path, tags); + Events.ExecuteOnErrorFindPetsByTags(e); + throw; + } + } + + /// + /// The + /// + public partial class FindPetsByTagsApiResponse : Org.OpenAPITools.Client.ApiResponse, IFindPetsByTagsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FindPetsByTagsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetPetById(ref long petId); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetPetByIdDefaultImplementation(IGetPetByIdApiResponse apiResponseLocalVar, long petId) + { + bool suppressDefaultLog = false; + AfterGetPetById(ref suppressDefaultLog, apiResponseLocalVar, petId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetPetById(ref bool suppressDefaultLog, IGetPetByIdApiResponse apiResponseLocalVar, long petId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetPetByIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetPetById(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetPetById(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId); + + /// + /// Find pet by ID Returns a single pet + /// + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + public async Task GetPetByIdOrDefaultAsync(long petId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetPetByIdAsync(petId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + public async Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetPetById(ref petId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar); + + ApiKeyToken apiKeyTokenLocalVar2 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key_query", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar2); + + apiKeyTokenLocalVar2.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetPetByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetPetByIdDefaultImplementation(apiResponseLocalVar, petId); + + Events.ExecuteOnGetPetById(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetPetByIdDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId); + Events.ExecuteOnErrorGetPetById(e); + throw; + } + } + + /// + /// The + /// + public partial class GetPetByIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetPetByIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetPetByIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Pet Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Pet result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdatePet(Pet pet); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateUpdatePet(Pet pet) + { + if (pet == null) + throw new ArgumentNullException(nameof(pet)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterUpdatePetDefaultImplementation(IUpdatePetApiResponse apiResponseLocalVar, Pet pet) + { + bool suppressDefaultLog = false; + AfterUpdatePet(ref suppressDefaultLog, apiResponseLocalVar, pet); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterUpdatePet(ref bool suppressDefaultLog, IUpdatePetApiResponse apiResponseLocalVar, Pet pet); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorUpdatePetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdatePet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, pet); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdatePet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet); + + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdatePetAsync(pet, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdatePet(pet); + + FormatUpdatePet(pet); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("http://petstore.swagger.io/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + + httpRequestMessageLocalVar.Content = (pet as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] contentTypes = new string[] { + "application/json", + "application/xml" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdatePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdatePetDefaultImplementation(apiResponseLocalVar, pet); + + Events.ExecuteOnUpdatePet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdatePetDefaultImplementation(e, "/pet", uriBuilderLocalVar.Path, pet); + Events.ExecuteOnErrorUpdatePet(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdatePetApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdatePetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdatePetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdatePetWithForm(ref long petId, ref Option name, ref Option status); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUpdatePetWithForm(Option name, Option status) + { + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name)); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUpdatePetWithFormDefaultImplementation(IUpdatePetWithFormApiResponse apiResponseLocalVar, long petId, Option name, Option status) + { + bool suppressDefaultLog = false; + AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, IUpdatePetWithFormApiResponse apiResponseLocalVar, long petId, Option name, Option status); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option name, Option status) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdatePetWithForm(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, name, status); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdatePetWithForm(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option name, Option status); + + /// + /// Updates a pet in the store with form data + /// + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdatePetWithFormAsync(petId, name, status, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdatePetWithForm(name, status); + + FormatUpdatePetWithForm(ref petId, ref name, ref status); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet) + formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name.Value))); + + if (status.IsSet) + formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdatePetWithFormApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdatePetWithFormDefaultImplementation(apiResponseLocalVar, petId, name, status); + + Events.ExecuteOnUpdatePetWithForm(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdatePetWithFormDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId, name, status); + Events.ExecuteOnErrorUpdatePetWithForm(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdatePetWithFormApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdatePetWithFormApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdatePetWithFormApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUploadFile(ref long petId, ref Option additionalMetadata, ref Option file); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUploadFile(Option additionalMetadata, Option file) + { + if (additionalMetadata.IsSet && additionalMetadata.Value == null) + throw new ArgumentNullException(nameof(additionalMetadata)); + + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUploadFileDefaultImplementation(IUploadFileApiResponse apiResponseLocalVar, long petId, Option additionalMetadata, Option file) + { + bool suppressDefaultLog = false; + AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, additionalMetadata, file); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUploadFile(ref bool suppressDefaultLog, IUploadFileApiResponse apiResponseLocalVar, long petId, Option additionalMetadata, Option file); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUploadFileDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option additionalMetadata, Option file) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUploadFile(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, additionalMetadata, file); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUploadFile(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option additionalMetadata, Option file); + + /// + /// uploads an image + /// + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileOrDefaultAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UploadFileAsync(petId, additionalMetadata, file, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUploadFile(additionalMetadata, file); + + FormatUploadFile(ref petId, ref additionalMetadata, ref file); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}/uploadImage"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); + + if (file.IsSet) + multipartContentLocalVar.Add(new StreamContent(file.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "multipart/form-data" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UploadFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUploadFileDefaultImplementation(apiResponseLocalVar, petId, additionalMetadata, file); + + Events.ExecuteOnUploadFile(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUploadFileDefaultImplementation(e, "/pet/{petId}/uploadImage", uriBuilderLocalVar.Path, petId, additionalMetadata, file); + Events.ExecuteOnErrorUploadFile(e); + throw; + } + } + + /// + /// The + /// + public partial class UploadFileApiResponse : Org.OpenAPITools.Client.ApiResponse, IUploadFileApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UploadFileApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ApiResponse Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUploadFileWithRequiredFile(ref long petId, ref System.IO.Stream requiredFile, ref Option additionalMetadata); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option additionalMetadata) + { + if (requiredFile == null) + throw new ArgumentNullException(nameof(requiredFile)); + + if (additionalMetadata.IsSet && additionalMetadata.Value == null) + throw new ArgumentNullException(nameof(additionalMetadata)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUploadFileWithRequiredFileDefaultImplementation(IUploadFileWithRequiredFileApiResponse apiResponseLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata) + { + bool suppressDefaultLog = false; + AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, petId, requiredFile, additionalMetadata); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, IUploadFileWithRequiredFileApiResponse apiResponseLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUploadFileWithRequiredFile(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, requiredFile, additionalMetadata); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUploadFileWithRequiredFile(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata); + + /// + /// uploads an image (required) + /// + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileWithRequiredFileOrDefaultAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UploadFileWithRequiredFileAsync(petId, requiredFile, additionalMetadata, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUploadFileWithRequiredFile(requiredFile, additionalMetadata); + + FormatUploadFileWithRequiredFile(ref petId, ref requiredFile, ref additionalMetadata); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/{petId}/uploadImageWithRequiredFile"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); multipartContentLocalVar.Add(new StreamContent(requiredFile)); + + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "multipart/form-data" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUploadFileWithRequiredFileDefaultImplementation(apiResponseLocalVar, petId, requiredFile, additionalMetadata); + + Events.ExecuteOnUploadFileWithRequiredFile(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUploadFileWithRequiredFileDefaultImplementation(e, "/fake/{petId}/uploadImageWithRequiredFile", uriBuilderLocalVar.Path, petId, requiredFile, additionalMetadata); + Events.ExecuteOnErrorUploadFileWithRequiredFile(e); + throw; + } + } + + /// + /// The + /// + public partial class UploadFileWithRequiredFileApiResponse : Org.OpenAPITools.Client.ApiResponse, IUploadFileWithRequiredFileApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UploadFileWithRequiredFileApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ApiResponse Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs new file mode 100644 index 000000000000..b3cd5adcbcca --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,1201 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IStoreApi : IApi + { + /// + /// The class containing the events + /// + StoreApiEvents Events { get; } + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteOrderOrDefaultAsync(string orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetInventoryOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + Task GetOrderByIdOrDefaultAsync(long orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + Task PlaceOrderOrDefaultAsync(Order order, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IDeleteOrderApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IGetInventoryApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetOrderByIdApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IPlaceOrderApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class StoreApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnDeleteOrder; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorDeleteOrder; + + internal void ExecuteOnDeleteOrder(StoreApi.DeleteOrderApiResponse apiResponse) + { + OnDeleteOrder?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeleteOrder(Exception exception) + { + OnErrorDeleteOrder?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetInventory; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetInventory; + + internal void ExecuteOnGetInventory(StoreApi.GetInventoryApiResponse apiResponse) + { + OnGetInventory?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetInventory(Exception exception) + { + OnErrorGetInventory?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetOrderById; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetOrderById; + + internal void ExecuteOnGetOrderById(StoreApi.GetOrderByIdApiResponse apiResponse) + { + OnGetOrderById?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetOrderById(Exception exception) + { + OnErrorGetOrderById?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnPlaceOrder; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorPlaceOrder; + + internal void ExecuteOnPlaceOrder(StoreApi.PlaceOrderApiResponse apiResponse) + { + OnPlaceOrder?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorPlaceOrder(Exception exception) + { + OnErrorPlaceOrder?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class StoreApi : IStoreApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public StoreApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, StoreApiEvents storeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = storeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatDeleteOrder(ref string orderId); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeleteOrder(string orderId) + { + if (orderId == null) + throw new ArgumentNullException(nameof(orderId)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterDeleteOrderDefaultImplementation(IDeleteOrderApiResponse apiResponseLocalVar, string orderId) + { + bool suppressDefaultLog = false; + AfterDeleteOrder(ref suppressDefaultLog, apiResponseLocalVar, orderId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterDeleteOrder(ref bool suppressDefaultLog, IDeleteOrderApiResponse apiResponseLocalVar, string orderId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorDeleteOrderDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string orderId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeleteOrder(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, orderId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorDeleteOrder(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string orderId); + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteOrderOrDefaultAsync(string orderId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeleteOrderAsync(orderId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeleteOrder(orderId); + + FormatDeleteOrder(ref orderId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order/{order_id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeleteOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeleteOrderDefaultImplementation(apiResponseLocalVar, orderId); + + Events.ExecuteOnDeleteOrder(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeleteOrderDefaultImplementation(e, "/store/order/{order_id}", uriBuilderLocalVar.Path, orderId); + Events.ExecuteOnErrorDeleteOrder(e); + throw; + } + } + + /// + /// The + /// + public partial class DeleteOrderApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeleteOrderApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteOrderApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetInventoryDefaultImplementation(IGetInventoryApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetInventory(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetInventory(ref bool suppressDefaultLog, IGetInventoryApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetInventoryDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetInventory(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetInventory(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetInventoryOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetInventoryAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/inventory"; + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetInventoryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetInventoryDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetInventory(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetInventoryDefaultImplementation(e, "/store/inventory", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetInventory(e); + throw; + } + } + + /// + /// The + /// + public partial class GetInventoryApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetInventoryApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetInventoryApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Dictionary Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Dictionary result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetOrderById(ref long orderId); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetOrderByIdDefaultImplementation(IGetOrderByIdApiResponse apiResponseLocalVar, long orderId) + { + bool suppressDefaultLog = false; + AfterGetOrderById(ref suppressDefaultLog, apiResponseLocalVar, orderId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetOrderById(ref bool suppressDefaultLog, IGetOrderByIdApiResponse apiResponseLocalVar, long orderId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetOrderByIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long orderId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetOrderById(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, orderId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetOrderById(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long orderId); + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + public async Task GetOrderByIdOrDefaultAsync(long orderId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetOrderByIdAsync(orderId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + public async Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetOrderById(ref orderId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order/{order_id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetOrderByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetOrderByIdDefaultImplementation(apiResponseLocalVar, orderId); + + Events.ExecuteOnGetOrderById(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetOrderByIdDefaultImplementation(e, "/store/order/{order_id}", uriBuilderLocalVar.Path, orderId); + Events.ExecuteOnErrorGetOrderById(e); + throw; + } + } + + /// + /// The + /// + public partial class GetOrderByIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetOrderByIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetOrderByIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Order Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatPlaceOrder(Order order); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidatePlaceOrder(Order order) + { + if (order == null) + throw new ArgumentNullException(nameof(order)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterPlaceOrderDefaultImplementation(IPlaceOrderApiResponse apiResponseLocalVar, Order order) + { + bool suppressDefaultLog = false; + AfterPlaceOrder(ref suppressDefaultLog, apiResponseLocalVar, order); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterPlaceOrder(ref bool suppressDefaultLog, IPlaceOrderApiResponse apiResponseLocalVar, Order order); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorPlaceOrderDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Order order) + { + bool suppressDefaultLogLocalVar = false; + OnErrorPlaceOrder(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, order); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorPlaceOrder(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Order order); + + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + public async Task PlaceOrderOrDefaultAsync(Order order, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await PlaceOrderAsync(order, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + public async Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidatePlaceOrder(order); + + FormatPlaceOrder(order); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order"; + + httpRequestMessageLocalVar.Content = (order as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(order, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + PlaceOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); + + AfterPlaceOrderDefaultImplementation(apiResponseLocalVar, order); + + Events.ExecuteOnPlaceOrder(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorPlaceOrderDefaultImplementation(e, "/store/order", uriBuilderLocalVar.Path, order); + Events.ExecuteOnErrorPlaceOrder(e); + throw; + } + } + + /// + /// The + /// + public partial class PlaceOrderApiResponse : Org.OpenAPITools.Client.ApiResponse, IPlaceOrderApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public PlaceOrderApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Order Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/UserApi.cs new file mode 100644 index 000000000000..788e681d73c8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -0,0 +1,2262 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IUserApi : IApi + { + /// + /// The class containing the events + /// + UserApiEvents Events { get; } + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUserOrDefaultAsync(User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithArrayInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithListInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteUserOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get user by user name + /// + /// + /// + /// + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + Task GetUserByNameOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + Task LoginUserAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + Task LoginUserOrDefaultAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task LogoutUserOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task UpdateUserAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task UpdateUserOrDefaultAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ICreateUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface ICreateUsersWithArrayInputApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface ICreateUsersWithListInputApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IDeleteUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IGetUserByNameApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk, ICustomHttpStatusCode599 + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 598 CustomHttpStatusCode598 + /// + /// + bool IsCustomHttpStatusCode598 { get; } + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 + /// + /// + bool IsCustomHttpStatusCode599 { get; } + } + + /// + /// The + /// + public interface ILoginUserApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface ILogoutUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IUpdateUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class UserApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler OnCreateUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorCreateUser; + + internal void ExecuteOnCreateUser(UserApi.CreateUserApiResponse apiResponse) + { + OnCreateUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUser(Exception exception) + { + OnErrorCreateUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnCreateUsersWithArrayInput; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorCreateUsersWithArrayInput; + + internal void ExecuteOnCreateUsersWithArrayInput(UserApi.CreateUsersWithArrayInputApiResponse apiResponse) + { + OnCreateUsersWithArrayInput?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUsersWithArrayInput(Exception exception) + { + OnErrorCreateUsersWithArrayInput?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnCreateUsersWithListInput; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorCreateUsersWithListInput; + + internal void ExecuteOnCreateUsersWithListInput(UserApi.CreateUsersWithListInputApiResponse apiResponse) + { + OnCreateUsersWithListInput?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUsersWithListInput(Exception exception) + { + OnErrorCreateUsersWithListInput?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnDeleteUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorDeleteUser; + + internal void ExecuteOnDeleteUser(UserApi.DeleteUserApiResponse apiResponse) + { + OnDeleteUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeleteUser(Exception exception) + { + OnErrorDeleteUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnGetUserByName; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorGetUserByName; + + internal void ExecuteOnGetUserByName(UserApi.GetUserByNameApiResponse apiResponse) + { + OnGetUserByName?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetUserByName(Exception exception) + { + OnErrorGetUserByName?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnLoginUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorLoginUser; + + internal void ExecuteOnLoginUser(UserApi.LoginUserApiResponse apiResponse) + { + OnLoginUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorLoginUser(Exception exception) + { + OnErrorLoginUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnLogoutUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorLogoutUser; + + internal void ExecuteOnLogoutUser(UserApi.LogoutUserApiResponse apiResponse) + { + OnLogoutUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorLogoutUser(Exception exception) + { + OnErrorLogoutUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler OnUpdateUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler OnErrorUpdateUser; + + internal void ExecuteOnUpdateUser(UserApi.UpdateUserApiResponse apiResponse) + { + OnUpdateUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdateUser(Exception exception) + { + OnErrorUpdateUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class UserApi : IUserApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public UserApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// The token cookie container + /// + public Org.OpenAPITools.Client.CookieContainer CookieContainer { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, UserApiEvents userApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider, + Org.OpenAPITools.Client.CookieContainer cookieContainer) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = userApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + CookieContainer = cookieContainer; + } + + partial void FormatCreateUser(User user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUser(User user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUserDefaultImplementation(ICreateUserApiResponse apiResponseLocalVar, User user) + { + bool suppressDefaultLog = false; + AfterCreateUser(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUser(ref bool suppressDefaultLog, ICreateUserApiResponse apiResponseLocalVar, User user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user); + + /// + /// Create user This can only be done by the logged in user. + /// + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUserOrDefaultAsync(User user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUserAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUser(user); + + FormatCreateUser(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUserDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUserDefaultImplementation(e, "/user", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUser(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatCreateUsersWithArrayInput(List user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUsersWithArrayInput(List user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUsersWithArrayInputDefaultImplementation(ICreateUsersWithArrayInputApiResponse apiResponseLocalVar, List user) + { + bool suppressDefaultLog = false; + AfterCreateUsersWithArrayInput(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUsersWithArrayInput(ref bool suppressDefaultLog, ICreateUsersWithArrayInputApiResponse apiResponseLocalVar, List user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUsersWithArrayInputDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUsersWithArrayInput(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUsersWithArrayInput(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user); + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithArrayInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUsersWithArrayInputAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUsersWithArrayInput(user); + + FormatCreateUsersWithArrayInput(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/createWithArray"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUsersWithArrayInputDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUsersWithArrayInput(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUsersWithArrayInputDefaultImplementation(e, "/user/createWithArray", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUsersWithArrayInput(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUsersWithArrayInputApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUsersWithArrayInputApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUsersWithArrayInputApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatCreateUsersWithListInput(List user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUsersWithListInput(List user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUsersWithListInputDefaultImplementation(ICreateUsersWithListInputApiResponse apiResponseLocalVar, List user) + { + bool suppressDefaultLog = false; + AfterCreateUsersWithListInput(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUsersWithListInput(ref bool suppressDefaultLog, ICreateUsersWithListInputApiResponse apiResponseLocalVar, List user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUsersWithListInputDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUsersWithListInput(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUsersWithListInput(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user); + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithListInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUsersWithListInputAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUsersWithListInput(user); + + FormatCreateUsersWithListInput(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/createWithList"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUsersWithListInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUsersWithListInputDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUsersWithListInput(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUsersWithListInputDefaultImplementation(e, "/user/createWithList", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUsersWithListInput(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUsersWithListInputApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUsersWithListInputApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUsersWithListInputApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatDeleteUser(ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeleteUser(string username) + { + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterDeleteUserDefaultImplementation(IDeleteUserApiResponse apiResponseLocalVar, string username) + { + bool suppressDefaultLog = false; + AfterDeleteUser(ref suppressDefaultLog, apiResponseLocalVar, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterDeleteUser(ref bool suppressDefaultLog, IDeleteUserApiResponse apiResponseLocalVar, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorDeleteUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeleteUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorDeleteUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username); + + /// + /// Delete user This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteUserOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeleteUserAsync(username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeleteUser(username); + + FormatDeleteUser(ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeleteUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeleteUserDefaultImplementation(apiResponseLocalVar, username); + + Events.ExecuteOnDeleteUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeleteUserDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, username); + Events.ExecuteOnErrorDeleteUser(e); + throw; + } + } + + /// + /// The + /// + public partial class DeleteUserApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeleteUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetUserByName(ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateGetUserByName(string username) + { + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetUserByNameDefaultImplementation(IGetUserByNameApiResponse apiResponseLocalVar, string username) + { + bool suppressDefaultLog = false; + AfterGetUserByName(ref suppressDefaultLog, apiResponseLocalVar, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetUserByName(ref bool suppressDefaultLog, IGetUserByNameApiResponse apiResponseLocalVar, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetUserByNameDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetUserByName(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetUserByName(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username); + + /// + /// Get user by user name + /// + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetUserByNameOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetUserByNameAsync(username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateGetUserByName(username); + + FormatGetUserByName(ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetUserByNameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetUserByNameDefaultImplementation(apiResponseLocalVar, username); + + Events.ExecuteOnGetUserByName(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetUserByNameDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, username); + Events.ExecuteOnErrorGetUserByName(e); + throw; + } + } + + /// + /// The + /// + public partial class GetUserByNameApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetUserByNameApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetUserByNameApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.User Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Returns true if the response is 598 CustomHttpStatusCode598 + /// + /// + public bool IsCustomHttpStatusCode598 => 598 == (int)StatusCode; + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 + /// + /// + public bool IsCustomHttpStatusCode599 => 599 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 599 CustomHttpStatusCode599 + /// + /// + public Org.OpenAPITools.Model.User CustomHttpStatusCode599() + { + // This logic may be modified with the AsModel.mustache template + return IsCustomHttpStatusCode599 + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 and the deserialized response is not null + /// + /// + /// + public bool TryCustomHttpStatusCode599([NotNullWhen(true)]out Org.OpenAPITools.Model.User result) + { + result = null; + + try + { + result = CustomHttpStatusCode599(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)599); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatLoginUser(ref string password, ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateLoginUser(string password, string username) + { + if (password == null) + throw new ArgumentNullException(nameof(password)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterLoginUserDefaultImplementation(ILoginUserApiResponse apiResponseLocalVar, string password, string username) + { + bool suppressDefaultLog = false; + AfterLoginUser(ref suppressDefaultLog, apiResponseLocalVar, password, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterLoginUser(ref bool suppressDefaultLog, ILoginUserApiResponse apiResponseLocalVar, string password, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorLoginUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string password, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorLoginUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, password, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorLoginUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string password, string username); + + /// + /// Logs user into the system + /// + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + public async Task LoginUserOrDefaultAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await LoginUserAsync(password, username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + public async Task LoginUserAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateLoginUser(password, username); + + FormatLoginUser(ref password, ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/login"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["password"] = ClientUtils.ParameterToString(password); + parseQueryStringLocalVar["username"] = ClientUtils.ParameterToString(username); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + LoginUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); + + AfterLoginUserDefaultImplementation(apiResponseLocalVar, password, username); + + Events.ExecuteOnLoginUser(apiResponseLocalVar); + + if (httpResponseMessageLocalVar.StatusCode == (HttpStatusCode) 200 && httpResponseMessageLocalVar.Headers.TryGetValues("Set-Cookie", out var cookieHeadersLocalVar)) + { + foreach(string cookieHeader in cookieHeadersLocalVar) + { + IList setCookieHeaderValuesLocalVar = Microsoft.Net.Http.Headers.SetCookieHeaderValue.ParseList(cookieHeadersLocalVar.ToArray()); + + foreach(Microsoft.Net.Http.Headers.SetCookieHeaderValue setCookieHeaderValueLocalVar in setCookieHeaderValuesLocalVar) + { + Cookie cookieLocalVar = new Cookie(setCookieHeaderValueLocalVar.Name.ToString(), setCookieHeaderValueLocalVar.Value.ToString()) + { + HttpOnly = setCookieHeaderValueLocalVar.HttpOnly + }; + + if (setCookieHeaderValueLocalVar.Expires.HasValue) + cookieLocalVar.Expires = setCookieHeaderValueLocalVar.Expires.Value.UtcDateTime; + + if (setCookieHeaderValueLocalVar.Path.HasValue) + cookieLocalVar.Path = setCookieHeaderValueLocalVar.Path.Value; + + if (setCookieHeaderValueLocalVar.Domain.HasValue) + cookieLocalVar.Domain = setCookieHeaderValueLocalVar.Domain.Value; + + CookieContainer.Value.Add(new Uri($"{uriBuilderLocalVar.Scheme}://{uriBuilderLocalVar.Host}"), cookieLocalVar); + } + } + } + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorLoginUserDefaultImplementation(e, "/user/login", uriBuilderLocalVar.Path, password, username); + Events.ExecuteOnErrorLoginUser(e); + throw; + } + } + + /// + /// The + /// + public partial class LoginUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ILoginUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public LoginUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public string Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out string result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterLogoutUserDefaultImplementation(ILogoutUserApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterLogoutUser(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterLogoutUser(ref bool suppressDefaultLog, ILogoutUserApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorLogoutUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorLogoutUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorLogoutUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Logs out current logged in user session + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task LogoutUserOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await LogoutUserAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + LogoutUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); + + AfterLogoutUserDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnLogoutUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorLogoutUserDefaultImplementation(e, "/user/logout", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorLogoutUser(e); + throw; + } + } + + /// + /// The + /// + public partial class LogoutUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ILogoutUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public LogoutUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdateUser(User user, ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUpdateUser(User user, string username) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterUpdateUserDefaultImplementation(IUpdateUserApiResponse apiResponseLocalVar, User user, string username) + { + bool suppressDefaultLog = false; + AfterUpdateUser(ref suppressDefaultLog, apiResponseLocalVar, user, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterUpdateUser(ref bool suppressDefaultLog, IUpdateUserApiResponse apiResponseLocalVar, User user, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorUpdateUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdateUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdateUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user, string username); + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateUserOrDefaultAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdateUserAsync(user, username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateUserAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdateUser(user, username); + + FormatUpdateUser(user, ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdateUserDefaultImplementation(apiResponseLocalVar, user, username); + + Events.ExecuteOnUpdateUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdateUserDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, user, username); + Events.ExecuteOnErrorUpdateUser(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdateUserApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdateUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdateUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..fdd11dd19c9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiException.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs new file mode 100644 index 000000000000..4ae15cda355e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -0,0 +1,52 @@ +// + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an apiKey. + /// + public class ApiKeyToken : TokenBase + { + private string _raw; + + /// + /// The header that this token will be used with. + /// + public ClientUtils.ApiKeyHeader Header { get; } + + /// + /// Constructs an ApiKeyToken object. + /// + /// + /// + /// + /// + public ApiKeyToken(string value, ClientUtils.ApiKeyHeader header, string prefix = "Bearer ", TimeSpan? timeout = null) : base(timeout) + { + Header = header; + _raw = $"{ prefix }{ value }"; + } + + /// + /// Places the token in the header. + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request) + { + request.Headers.Add(ClientUtils.ApiKeyHeaderToString(Header), _raw); + } + + /// + /// Places the token in the query. + /// + /// + /// + /// + public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage request, UriBuilder uriBuilder, System.Collections.Specialized.NameValueCollection parseQueryString) + { + parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..794b3601c853 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,210 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface ICustomHttpStatusCode599 : IApiResponse + { + /// + /// Deserializes the response if the response is CustomHttpStatusCode599 + /// + /// + TType CustomHttpStatusCode599(); + + /// + /// Returns true if the response is CustomHttpStatusCode599 and the deserialized response is not null + /// + /// + /// + bool TryCustomHttpStatusCode599([NotNullWhen(true)]out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk([NotNullWhen(true)]out TType result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IDefault : IApiResponse + { + /// + /// Deserializes the response if the response is Default + /// + /// + TType Default(); + + /// + /// Returns true if the response is Default and the deserialized response is not null + /// + /// + /// + bool TryDefault([NotNullWhen(true)]out TType result); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs new file mode 100644 index 000000000000..bde0562e1940 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BasicToken.cs @@ -0,0 +1,42 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from a username and password. + /// + public class BasicToken : TokenBase + { + private string _username; + + private string _password; + + /// + /// Constructs a BasicToken object. + /// + /// + /// + /// + public BasicToken(string username, string password, TimeSpan? timeout = null) : base(timeout) + { + _username = username; + + _password = password; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs new file mode 100644 index 000000000000..4337ac9a7736 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/BearerToken.cs @@ -0,0 +1,37 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from a token from a bearer token. + /// + public class BearerToken : TokenBase + { + private string _raw; + + /// + /// Constructs a BearerToken object. + /// + /// + /// + public BearerToken(string value, TimeSpan? timeout = null) : base(timeout) + { + _raw = value; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..b8e281efd8ba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,426 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using KellermanSoftware.CompareNetObjects; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// An instance of CompareLogic. + /// + public static CompareLogic compareLogic; + + /// + /// Static constructor to initialise compareLogic. + /// + static ClientUtils() + { + ComparisonConfig comparisonConfig = new(); + comparisonConfig.UseHashCodeIdentifier = true; + compareLogic = new(comparisonConfig); + } + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// An enum of headers + /// + public enum ApiKeyHeader + { + /// + /// The api-key header + /// + Api_key, + /// + /// The api_key_query header + /// + Api_key_query + } + + /// + /// Converte an ApiKeyHeader to a string + /// + /// + /// + /// + public static string ApiKeyHeaderToString(ApiKeyHeader value) + { + return value switch + { + ApiKeyHeader.Api_key => "api-key", + ApiKeyHeader.Api_key_query => "api_key_query", + _ => throw new System.ComponentModel.InvalidEnumArgumentException(nameof(value), (int)value, typeof(ApiKeyHeader)), + }; + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string ParameterToString(object obj, string format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum) + return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum); + if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum) + return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum); + if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum) + return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); + if (obj is EnumClass enumClass) + return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); + if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) + return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); + if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) + return EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTestEnumIntegerOnlyEnum).ToString(); + if (obj is EnumTest.EnumNumberEnum enumTestEnumNumberEnum) + return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); + if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) + return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); + if (obj is MapTest.InnerEnum mapTestInnerEnum) + return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); + if (obj is Order.StatusEnum orderStatusEnum) + return Order.StatusEnumToJsonValue(orderStatusEnum); + if (obj is OuterEnum outerEnum) + return OuterEnumValueConverter.ToJsonValue(outerEnum); + if (obj is OuterEnumDefaultValue outerEnumDefaultValue) + return OuterEnumDefaultValueValueConverter.ToJsonValue(outerEnumDefaultValue); + if (obj is OuterEnumInteger outerEnumInteger) + return OuterEnumIntegerValueConverter.ToJsonValue(outerEnumInteger).ToString(); + if (obj is OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) + return OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(outerEnumIntegerDefaultValue).ToString(); + if (obj is OuterEnumTest outerEnumTest) + return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); + if (obj is Pet.StatusEnum petStatusEnum) + return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is Zebra.TypeEnum zebraTypeEnum) + return Zebra.TypeEnumToJsonValue(zebraTypeEnum); + if (obj is ZeroBasedEnum zeroBasedEnum) + return ZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnum); + if (obj is ZeroBasedEnumClass.ZeroBasedEnumEnum zeroBasedEnumClassZeroBasedEnumEnum) + return ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClassZeroBasedEnumEnum); + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// 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) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://petstore.swagger.io:80/v2"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = "/v2"; + + /// + /// The host of the API + /// + public const string HOST = "petstore.swagger.io"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..da94287dab88 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,18 @@ +// + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..11b100056516 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..92ef8f6c92bf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..623f3c18353c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,75 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..43730a86b868 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString(); + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..f711f9f3c7ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..cb0e43c85272 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,251 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new ActivityJsonConverter()); + _jsonOptions.Converters.Add(new ActivityOutputElementRepresentationJsonConverter()); + _jsonOptions.Converters.Add(new AdditionalPropertiesClassJsonConverter()); + _jsonOptions.Converters.Add(new AnimalJsonConverter()); + _jsonOptions.Converters.Add(new ApiResponseJsonConverter()); + _jsonOptions.Converters.Add(new AppleJsonConverter()); + _jsonOptions.Converters.Add(new AppleReqJsonConverter()); + _jsonOptions.Converters.Add(new ArrayOfArrayOfNumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ArrayOfNumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ArrayTestJsonConverter()); + _jsonOptions.Converters.Add(new BananaJsonConverter()); + _jsonOptions.Converters.Add(new BananaReqJsonConverter()); + _jsonOptions.Converters.Add(new BasquePigJsonConverter()); + _jsonOptions.Converters.Add(new CapitalizationJsonConverter()); + _jsonOptions.Converters.Add(new CatJsonConverter()); + _jsonOptions.Converters.Add(new CategoryJsonConverter()); + _jsonOptions.Converters.Add(new ChildCatJsonConverter()); + _jsonOptions.Converters.Add(new ClassModelJsonConverter()); + _jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new DanishPigJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyClassJsonConverter()); + _jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter()); + _jsonOptions.Converters.Add(new DogJsonConverter()); + _jsonOptions.Converters.Add(new DrawingJsonConverter()); + _jsonOptions.Converters.Add(new EnumArraysJsonConverter()); + _jsonOptions.Converters.Add(new EnumClassJsonConverter()); + _jsonOptions.Converters.Add(new EnumClassNullableJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestJsonConverter()); + _jsonOptions.Converters.Add(new EquilateralTriangleJsonConverter()); + _jsonOptions.Converters.Add(new FileJsonConverter()); + _jsonOptions.Converters.Add(new FileSchemaTestClassJsonConverter()); + _jsonOptions.Converters.Add(new FooJsonConverter()); + _jsonOptions.Converters.Add(new FooGetDefaultResponseJsonConverter()); + _jsonOptions.Converters.Add(new FormatTestJsonConverter()); + _jsonOptions.Converters.Add(new FruitJsonConverter()); + _jsonOptions.Converters.Add(new FruitReqJsonConverter()); + _jsonOptions.Converters.Add(new GmFruitJsonConverter()); + _jsonOptions.Converters.Add(new GrandparentAnimalJsonConverter()); + _jsonOptions.Converters.Add(new HasOnlyReadOnlyJsonConverter()); + _jsonOptions.Converters.Add(new HealthCheckResultJsonConverter()); + _jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter()); + _jsonOptions.Converters.Add(new ListJsonConverter()); + _jsonOptions.Converters.Add(new LiteralStringClassJsonConverter()); + _jsonOptions.Converters.Add(new MammalJsonConverter()); + _jsonOptions.Converters.Add(new MapTestJsonConverter()); + _jsonOptions.Converters.Add(new MixLogJsonConverter()); + _jsonOptions.Converters.Add(new MixedAnyOfJsonConverter()); + _jsonOptions.Converters.Add(new MixedAnyOfContentJsonConverter()); + _jsonOptions.Converters.Add(new MixedOneOfJsonConverter()); + _jsonOptions.Converters.Add(new MixedOneOfContentJsonConverter()); + _jsonOptions.Converters.Add(new MixedPropertiesAndAdditionalPropertiesClassJsonConverter()); + _jsonOptions.Converters.Add(new MixedSubIdJsonConverter()); + _jsonOptions.Converters.Add(new Model200ResponseJsonConverter()); + _jsonOptions.Converters.Add(new ModelClientJsonConverter()); + _jsonOptions.Converters.Add(new NameJsonConverter()); + _jsonOptions.Converters.Add(new NotificationtestGetElementsV1ResponseMPayloadJsonConverter()); + _jsonOptions.Converters.Add(new NullableClassJsonConverter()); + _jsonOptions.Converters.Add(new NullableGuidClassJsonConverter()); + _jsonOptions.Converters.Add(new NullableShapeJsonConverter()); + _jsonOptions.Converters.Add(new NumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ObjectWithDeprecatedFieldsJsonConverter()); + _jsonOptions.Converters.Add(new OneOfStringJsonConverter()); + _jsonOptions.Converters.Add(new OrderJsonConverter()); + _jsonOptions.Converters.Add(new OuterCompositeJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumDefaultValueJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumDefaultValueNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerDefaultValueJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerDefaultValueNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumTestJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumTestNullableJsonConverter()); + _jsonOptions.Converters.Add(new ParentPetJsonConverter()); + _jsonOptions.Converters.Add(new PetJsonConverter()); + _jsonOptions.Converters.Add(new PigJsonConverter()); + _jsonOptions.Converters.Add(new PolymorphicPropertyJsonConverter()); + _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); + _jsonOptions.Converters.Add(new ReturnJsonConverter()); + _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); + _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); + _jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter()); + _jsonOptions.Converters.Add(new ShapeJsonConverter()); + _jsonOptions.Converters.Add(new ShapeInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new ShapeOrNullJsonConverter()); + _jsonOptions.Converters.Add(new SimpleQuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new SpecialModelNameJsonConverter()); + _jsonOptions.Converters.Add(new TagJsonConverter()); + _jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter()); + _jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter()); + _jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter()); + _jsonOptions.Converters.Add(new TriangleJsonConverter()); + _jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new UserJsonConverter()); + _jsonOptions.Converters.Add(new WhaleJsonConverter()); + _jsonOptions.Converters.Add(new ZebraJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action client = null, Action builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs new file mode 100644 index 000000000000..7616d3209c20 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -0,0 +1,677 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Cryptography; +using System.Text; +using System.Web; + +namespace Org.OpenAPITools.Client +{ + /// + /// Class for HttpSigning auth related parameter and methods + /// + public class HttpSigningConfiguration + { + /// + /// Create an instance + /// + public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString keyPassPhrase, List httpSigningHeader, HashAlgorithmName hashAlgorithm, string signingAlgorithm, int signatureValidityPeriod) + { + KeyId = keyId; + KeyFilePath = keyFilePath; + KeyPassPhrase = keyPassPhrase; + HttpSigningHeader = httpSigningHeader; + HashAlgorithm = hashAlgorithm; + SigningAlgorithm = signingAlgorithm; + SignatureValidityPeriod = signatureValidityPeriod; + } + + /// + ///Gets the Api keyId + /// + public string KeyId { get; set; } + + /// + /// Gets the Key file path + /// + public string KeyFilePath { get; set; } + + /// + /// Gets the key pass phrase for password protected key + /// + public SecureString KeyPassPhrase { get; set; } + + /// + /// Gets the HTTP signing header + /// + public List HttpSigningHeader { get; set; } + + /// + /// Gets the hash algorithm sha256 or sha512 + /// + public HashAlgorithmName HashAlgorithm { get; set; } = HashAlgorithmName.SHA256; + + /// + /// Gets the signing algorithm + /// + public string SigningAlgorithm { get; set; } + + /// + /// Gets the Signature validity period in seconds + /// + public int SignatureValidityPeriod { get; set; } + + private enum PrivateKeyType + { + None = 0, + RSA = 1, + ECDSA = 2, + } + + /// + /// Gets the Headers for HttpSigning + /// + /// + /// + /// + internal Dictionary GetHttpSignedHeader(global::System.Net.Http.HttpRequestMessage request, string requestBody, System.Threading.CancellationToken cancellationToken = default) + { + if (request.RequestUri == null) + throw new NullReferenceException("The request URI was null"); + + const string HEADER_REQUEST_TARGET = "(request-target)"; + + // The time when the HTTP signature expires. The API server should reject HTTP requests that have expired. + const string HEADER_EXPIRES = "(expires)"; + + //The 'Date' header. + const string HEADER_DATE = "Date"; + + //The 'Host' header. + const string HEADER_HOST = "Host"; + + //The time when the HTTP signature was generated. + const string HEADER_CREATED = "(created)"; + + //When the 'Digest' header is included in the HTTP signature, the client automatically + //computes the digest of the HTTP request body, per RFC 3230. + const string HEADER_DIGEST = "Digest"; + + //The 'Authorization' header is automatically generated by the client. It includes + //the list of signed headers and a base64-encoded signature. + const string HEADER_AUTHORIZATION = "Authorization"; + + //Hash table to store singed headers + var HttpSignedRequestHeader = new Dictionary(); + + var httpSignatureHeader = new Dictionary(); + + if (HttpSigningHeader.Count == 0) + HttpSigningHeader.Add("(created)"); + + var dateTime = DateTime.Now; + string digest = String.Empty; + + if (HashAlgorithm == HashAlgorithmName.SHA256) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + digest = string.Format("SHA-256={0}", Convert.ToBase64String(bodyDigest)); + } + else if (HashAlgorithm == HashAlgorithmName.SHA512) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + digest = string.Format("SHA-512={0}", Convert.ToBase64String(bodyDigest)); + } + else + throw new Exception(string.Format("{0} not supported", HashAlgorithm)); + + foreach (var header in HttpSigningHeader) + if (header.Equals(HEADER_REQUEST_TARGET)) + httpSignatureHeader.Add(header.ToLower(), request.RequestUri.ToString()); + else if (header.Equals(HEADER_EXPIRES)) + { + var expireDateTime = dateTime.AddSeconds(SignatureValidityPeriod); + httpSignatureHeader.Add(header.ToLower(), GetUnixTime(expireDateTime).ToString()); + } + else if (header.Equals(HEADER_DATE)) + { + var utcDateTime = dateTime.ToString("r").ToString(); + httpSignatureHeader.Add(header.ToLower(), utcDateTime); + HttpSignedRequestHeader.Add(HEADER_DATE, utcDateTime); + } + else if (header.Equals(HEADER_HOST)) + { + httpSignatureHeader.Add(header.ToLower(), request.RequestUri.ToString()); + HttpSignedRequestHeader.Add(HEADER_HOST, request.RequestUri.ToString()); + } + else if (header.Equals(HEADER_CREATED)) + httpSignatureHeader.Add(header.ToLower(), GetUnixTime(dateTime).ToString()); + else if (header.Equals(HEADER_DIGEST)) + { + HttpSignedRequestHeader.Add(HEADER_DIGEST, digest); + httpSignatureHeader.Add(header.ToLower(), digest); + } + else + { + bool isHeaderFound = false; + foreach (var item in request.Headers) + { + if (string.Equals(item.Key, header, StringComparison.OrdinalIgnoreCase)) + { + httpSignatureHeader.Add(header.ToLower(), item.Value.ToString()); + isHeaderFound = true; + break; + } + } + + if (!isHeaderFound) + throw new Exception(string.Format("Cannot sign HTTP request.Request does not contain the {0} header.",header)); + } + + var headersKeysString = String.Join(" ", httpSignatureHeader.Keys); + var headerValuesList = new List(); + + foreach (var keyVal in httpSignatureHeader) + headerValuesList.Add(string.Format("{0}: {1}", keyVal.Key, keyVal.Value)); + + //Concatenate headers value separated by new line + var headerValuesString = string.Join("\n", headerValuesList); + var signatureStringHash = GetStringHash(HashAlgorithm, headerValuesString); + string headerSignatureStr = null; + var keyType = GetKeyType(KeyFilePath); + + if (keyType == PrivateKeyType.RSA) + headerSignatureStr = GetRSASignature(signatureStringHash); + + else if (keyType == PrivateKeyType.ECDSA) + headerSignatureStr = GetECDSASignature(signatureStringHash); + + var cryptographicScheme = "hs2019"; + var authorizationHeaderValue = string.Format("Signature keyId=\"{0}\",algorithm=\"{1}\"", + KeyId, cryptographicScheme); + + if (httpSignatureHeader.ContainsKey(HEADER_CREATED)) + authorizationHeaderValue += string.Format(",created={0}", httpSignatureHeader[HEADER_CREATED]); + + if (httpSignatureHeader.ContainsKey(HEADER_EXPIRES)) + authorizationHeaderValue += string.Format(",expires={0}", httpSignatureHeader[HEADER_EXPIRES]); + + authorizationHeaderValue += string.Format(",headers=\"{0}\",signature=\"{1}\"", headersKeysString, headerSignatureStr); + + HttpSignedRequestHeader.Add(HEADER_AUTHORIZATION, authorizationHeaderValue); + + return HttpSignedRequestHeader; + } + + private byte[] GetStringHash(HashAlgorithmName hashAlgorithmName, string stringToBeHashed) + { + HashAlgorithm hashAlgorithm = null; + + if (hashAlgorithmName == HashAlgorithmName.SHA1) + hashAlgorithm = SHA1.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA256) + hashAlgorithm = SHA256.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA512) + hashAlgorithm = SHA512.Create(); + + if (hashAlgorithmName == HashAlgorithmName.MD5) + hashAlgorithm = MD5.Create(); + + if (hashAlgorithm == null) + throw new NullReferenceException($"{ nameof(hashAlgorithm) } was null."); + + byte[] bytes = Encoding.UTF8.GetBytes(stringToBeHashed); + byte[] stringHash = hashAlgorithm.ComputeHash(bytes); + return stringHash; + } + + private int GetUnixTime(DateTime date2) + { + DateTime date1 = new DateTime(1970, 01, 01); + TimeSpan timeSpan = date2 - date1; + return (int)timeSpan.TotalSeconds; + } + + private string GetRSASignature(byte[] stringToSign) + { + if (KeyPassPhrase == null) + throw new NullReferenceException($"{ nameof(KeyPassPhrase) } was null."); + + RSA rsa = GetRSAProviderFromPemFile(KeyFilePath, KeyPassPhrase); + + if (rsa == null) + return string.Empty; + else if (SigningAlgorithm == "RSASSA-PSS") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pss); + return Convert.ToBase64String(signedbytes); + } + else if (SigningAlgorithm == "PKCS1-v15") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pkcs1); + return Convert.ToBase64String(signedbytes); + } + + return string.Empty; + } + + /// + /// Gets the ECDSA signature + /// + /// + /// + private string GetECDSASignature(byte[] dataToSign) + { + if (!File.Exists(KeyFilePath)) + throw new Exception("key file path does not exist."); + + var ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + var ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var keyStr = File.ReadAllText(KeyFilePath); + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + + string ptrToStringUni = Marshal.PtrToStringUni(unmanagedString) ?? throw new NullReferenceException(); + + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(ptrToStringUni), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var signedBytes = ecdsa.SignHash(dataToSign); + var derBytes = ConvertToECDSAANS1Format(signedBytes); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; + } + + private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) + { + var derBytes = new List(); + byte derLength = 68; //default length for ECDSA code signing bit 0x44 + byte rbytesLength = 32; //R length 0x20 + byte sbytesLength = 32; //S length 0x20 + var rBytes = new List(); + var sBytes = new List(); + for (int i = 0; i < 32; i++) + rBytes.Add(signedBytes[i]); + + for (int i = 32; i < 64; i++) + sBytes.Add(signedBytes[i]); + + if (rBytes[0] > 0x7F) + { + derLength++; + rbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(rBytes); + rBytes.Clear(); + rBytes.Add(0x00); + rBytes.AddRange(tempBytes); + } + + if (sBytes[0] > 0x7F) + { + derLength++; + sbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(sBytes); + sBytes.Clear(); + sBytes.Add(0x00); + sBytes.AddRange(tempBytes); + + } + + derBytes.Add(48); //start of the sequence 0x30 + derBytes.Add(derLength); //total length r length, type and r bytes + + derBytes.Add(2); //tag for integer + derBytes.Add(rbytesLength); //length of r + derBytes.AddRange(rBytes); + + derBytes.Add(2); //tag for integer + derBytes.Add(sbytesLength); //length of s + derBytes.AddRange(sBytes); + return derBytes.ToArray(); + } + + private RSACryptoServiceProvider GetRSAProviderFromPemFile(String pemfile, SecureString keyPassPhrase = null) + { + const String pempubheader = "-----BEGIN PUBLIC KEY-----"; + const String pempubfooter = "-----END PUBLIC KEY-----"; + bool isPrivateKeyFile = true; + byte[] pemkey = null; + + if (!File.Exists(pemfile)) + throw new Exception("private key file does not exist."); + + string pemstr = File.ReadAllText(pemfile).Trim(); + + if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) + isPrivateKeyFile = false; + + if (isPrivateKeyFile) + { + pemkey = ConvertPrivateKeyToBytes(pemstr, keyPassPhrase); + + if (pemkey == null) + return null; + + return DecodeRSAPrivateKey(pemkey); + } + return null; + } + + private byte[] ConvertPrivateKeyToBytes(String instr, SecureString keyPassPhrase = null) + { + const String pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; + const String pemprivfooter = "-----END RSA PRIVATE KEY-----"; + String pemstr = instr.Trim(); + byte[] binkey; + + if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) + return null; + + StringBuilder sb = new StringBuilder(pemstr); + sb.Replace(pemprivheader, ""); + sb.Replace(pemprivfooter, ""); + String pvkstr = sb.ToString().Trim(); + + try + { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key + binkey = Convert.FromBase64String(pvkstr); + return binkey; + } + catch (global::System.FormatException) + { + StringReader str = new StringReader(pvkstr); + + //-------- read PEM encryption info. lines and extract salt ----- + if (!str.ReadLine().StartsWith("Proc-Type: 4,ENCRYPTED")) // TODO: what do we do here if ReadLine is null? + return null; + + String saltline = str.ReadLine(); // TODO: what do we do here if ReadLine is null? + if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) + return null; + + String saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); + byte[] salt = new byte[saltstr.Length / 2]; + for (int i = 0; i < salt.Length; i++) + salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); + + if (!(str.ReadLine() == "")) + return null; + + //------ remaining b64 data is encrypted RSA key ---- + String encryptedstr = str.ReadToEnd(); + + try + { //should have b64 encrypted RSA key now + binkey = Convert.FromBase64String(encryptedstr); + } + catch (global::System.FormatException) + { //data is not in base64 format + return null; + } + + // TODO: what do we do here if keyPassPhrase is null? + byte[] deskey = GetEncryptedKey(salt, keyPassPhrase, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes + if (deskey == null) + return null; + + //------ Decrypt the encrypted 3des-encrypted RSA private key ------ + byte[] rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV + + return rsakey; + } + } + + private RSACryptoServiceProvider DecodeRSAPrivateKey(byte[] privkey) + { + byte[] MODULUS, E, D, P, Q, DP, DQ, IQ; + + // --------- Set up stream to decode the asn.1 encoded RSA private key ------ + MemoryStream mem = new MemoryStream(privkey); + BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading + byte bt = 0; + ushort twobytes = 0; + int elems = 0; + try + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + binr.ReadByte(); //advance 1 byte + else if (twobytes == 0x8230) + binr.ReadInt16(); //advance 2 bytes + else + return null; + + twobytes = binr.ReadUInt16(); + if (twobytes != 0x0102) //version number + return null; + + bt = binr.ReadByte(); + if (bt != 0x00) + return null; + + //------ all private key components are Integer sequences ---- + elems = GetIntegerSize(binr); + MODULUS = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + E = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + D = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + P = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + Q = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + IQ = binr.ReadBytes(elems); + + // ------- create RSACryptoServiceProvider instance and initialize with public key ----- + RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); + RSAParameters RSAparams = new RSAParameters(); + RSAparams.Modulus = MODULUS; + RSAparams.Exponent = E; + RSAparams.D = D; + RSAparams.P = P; + RSAparams.Q = Q; + RSAparams.DP = DP; + RSAparams.DQ = DQ; + RSAparams.InverseQ = IQ; + RSA.ImportParameters(RSAparams); + return RSA; + } + catch (Exception) + { + return null; + } + finally + { + binr.Close(); + } + } + + private int GetIntegerSize(BinaryReader binr) + { + byte bt = 0; + byte lowbyte = 0x00; + byte highbyte = 0x00; + int count = 0; + bt = binr.ReadByte(); + if (bt != 0x02) //expect integer + return 0; + + bt = binr.ReadByte(); + + if (bt == 0x81) + count = binr.ReadByte(); // data size in next byte + else if (bt == 0x82) + { + highbyte = binr.ReadByte(); // data size in next 2 bytes + lowbyte = binr.ReadByte(); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; + count = BitConverter.ToInt32(modint, 0); + } + else + count = bt; // we already have the data size + + while (binr.ReadByte() == 0x00) + //remove high order zeros in data + count -= 1; + + binr.BaseStream.Seek(-1, SeekOrigin.Current); + + //last ReadByte wasn't a removed zero, so back up a byte + return count; + } + + private byte[] GetEncryptedKey(byte[] salt, SecureString secpswd, int count, int miter) + { + IntPtr unmanagedPswd = IntPtr.Zero; + int HASHLENGTH = 16; //MD5 bytes + byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store concatenated Mi hashed results + + byte[] psbytes = new byte[secpswd.Length]; + unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); + Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); + Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); + + // --- concatenate salt and pswd bytes into fixed data array --- + byte[] data00 = new byte[psbytes.Length + salt.Length]; + Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes + Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes + + // ---- do multi-hashing and concatenate results D1, D2 ... into keymaterial bytes ---- + MD5 md5 = MD5.Create(); + byte[] result = null; + byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget + + for (int j = 0; j < miter; j++) + { + // ---- Now hash consecutively for count times ------ + if (j == 0) + result = data00; //initialize + else + { + Array.Copy(result, hashtarget, result.Length); // TODO: what do we do if result is null here? + Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); + result = hashtarget; + } + + for (int i = 0; i < count; i++) + result = md5.ComputeHash(result); + + Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //concatenate to keymaterial + } + byte[] deskey = new byte[24]; + Array.Copy(keymaterial, deskey, deskey.Length); + + Array.Clear(psbytes, 0, psbytes.Length); + Array.Clear(data00, 0, data00.Length); + Array.Clear(result, 0, result.Length); // TODO: what do we do if result is null here? + Array.Clear(hashtarget, 0, hashtarget.Length); + Array.Clear(keymaterial, 0, keymaterial.Length); + return deskey; + } + + private byte[] DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) + { + MemoryStream memst = new MemoryStream(); + TripleDES alg = TripleDES.Create(); + alg.Key = desKey; + alg.IV = IV; + try + { + CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); + cs.Write(cipherData, 0, cipherData.Length); + cs.Close(); + } + catch (Exception) + { + return null; + } + byte[] decryptedData = memst.ToArray(); + return decryptedData; + } + + /// + /// Detect the key type from the pem file. + /// + /// key file path in pem format + /// + private PrivateKeyType GetKeyType(string keyFilePath) + { + if (!File.Exists(keyFilePath)) + throw new Exception("Key file path does not exist."); + + var ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY"; + var ecPrivateKeyFooter = "END EC PRIVATE KEY"; + var rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY"; + var rsaPrivateFooter = "END RSA PRIVATE KEY"; + //var pkcs8Header = "BEGIN PRIVATE KEY"; + //var pkcs8Footer = "END PRIVATE KEY"; + var keyType = PrivateKeyType.None; + var key = File.ReadAllLines(keyFilePath); + + if (key[0].ToString().Contains(rsaPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(rsaPrivateFooter)) + keyType = PrivateKeyType.RSA; + else if (key[0].ToString().Contains(ecPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + keyType = PrivateKeyType.ECDSA; + + else if (key[0].ToString().Contains(ecPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + { + /* this type of key can hold many type different types of private key, but here due lack of pem header + Considering this as EC key + */ + //TODO :- update the key based on oid + keyType = PrivateKeyType.ECDSA; + } + else + throw new Exception("Either the key is invalid or key is not supported"); + + return keyType; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs new file mode 100644 index 000000000000..387f7a8829e8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -0,0 +1,41 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an HttpSigningConfiguration + /// + public class HttpSignatureToken : TokenBase + { + private HttpSigningConfiguration _configuration; + + /// + /// Constructs an HttpSignatureToken object. + /// + /// + /// + public HttpSignatureToken(HttpSigningConfiguration configuration, TimeSpan? timeout = null) : base(timeout) + { + _configuration = configuration; + } + + /// + /// Places the token in the header. + /// + /// + /// + /// + public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string requestBody, CancellationToken cancellationToken = default) + { + var signedHeaders = _configuration.GetHttpSignedHeader(request, requestBody, cancellationToken); + + foreach (var signedHeader in signedHeaders) + request.Headers.Add(signedHeader.Key, signedHeader.Value); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..8fd6b68578f0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,25 @@ +// + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs new file mode 100644 index 000000000000..209e913db3e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -0,0 +1,37 @@ +// + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed with OAuth. + /// + public class OAuthToken : TokenBase + { + private string _raw; + + /// + /// Consturcts an OAuthToken object. + /// + /// + /// + public OAuthToken(string value, TimeSpan? timeout = null) : base(timeout) + { + _raw = value; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..8cf79a713b74 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/Option.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..eb894eec8416 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + if (container is TokenContainer apiKeyTokenContainer) + { + string[] headers = apiKeyTokenContainer.Tokens.Select(t => ClientUtils.ApiKeyHeaderToString(t.Header)).Distinct().ToArray(); + + foreach (string header in headers) + { + BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(header, Channel.CreateBounded(options)); + } + } + else + { + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + } + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..ec843104cafe --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,69 @@ +// + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..1e81bcd48886 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,35 @@ +// + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..36d7dad03e23 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,42 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..dce7b971eaac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,41 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..40eeffc96765 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..fdda03b9a5fd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs new file mode 100644 index 000000000000..f9d2680b0ad5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Activity.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// test map of maps + /// + public partial class Activity : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// activityOutputs + [JsonConstructor] + public Activity(Option>> activityOutputs = default) + { + ActivityOutputsOption = activityOutputs; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ActivityOutputs + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> ActivityOutputsOption { get; private set; } + + /// + /// Gets or Sets ActivityOutputs + /// + [JsonPropertyName("activity_outputs")] + public Dictionary> ActivityOutputs { get { return this.ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Activity {\n"); + sb.Append(" ActivityOutputs: ").Append(ActivityOutputs).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActivityJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>> activityOutputs = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "activity_outputs": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (activityOutputs.IsSet && activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); + + return new Activity(activityOutputs); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, activity, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) + { + if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + + if (activity.ActivityOutputsOption.IsSet) + { + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs new file mode 100644 index 000000000000..f5bcaf712030 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -0,0 +1,207 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ActivityOutputElementRepresentation + /// + public partial class ActivityOutputElementRepresentation : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// prop1 + /// prop2 + [JsonConstructor] + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) + { + Prop1Option = prop1; + Prop2Option = prop2; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Prop1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Prop1Option { get; private set; } + + /// + /// Gets or Sets Prop1 + /// + [JsonPropertyName("prop1")] + public string Prop1 { get { return this.Prop1Option; } set { this.Prop1Option = new(value); } } + + /// + /// Used to track the state of Prop2 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Prop2Option { get; private set; } + + /// + /// Gets or Sets Prop2 + /// + [JsonPropertyName("prop2")] + public Object Prop2 { get { return this.Prop2Option; } set { this.Prop2Option = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ActivityOutputElementRepresentation {\n"); + sb.Append(" Prop1: ").Append(Prop1).Append("\n"); + sb.Append(" Prop2: ").Append(Prop2).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActivityOutputElementRepresentationJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option prop1 = default; + Option prop2 = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "prop1": + prop1 = new Option(utf8JsonReader.GetString()); + break; + case "prop2": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (prop1.IsSet && prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); + + if (prop2.IsSet && prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); + + return new ActivityOutputElementRepresentation(prop1, prop2); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, activityOutputElementRepresentation, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) + { + if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop1Option.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); + + if (activityOutputElementRepresentation.Prop2Option.IsSet) + { + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs new file mode 100644 index 000000000000..8d4153d53022 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -0,0 +1,400 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// AdditionalPropertiesClass + /// + public partial class AdditionalPropertiesClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// anytype1 + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + /// mapOfMapProperty + /// mapProperty + /// mapWithUndeclaredPropertiesAnytype1 + /// mapWithUndeclaredPropertiesAnytype2 + /// mapWithUndeclaredPropertiesAnytype3 + /// mapWithUndeclaredPropertiesString + [JsonConstructor] + public AdditionalPropertiesClass(Option anytype1 = default, Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default) + { + Anytype1Option = anytype1; + EmptyMapOption = emptyMap; + MapOfMapPropertyOption = mapOfMapProperty; + MapPropertyOption = mapProperty; + MapWithUndeclaredPropertiesAnytype1Option = mapWithUndeclaredPropertiesAnytype1; + MapWithUndeclaredPropertiesAnytype2Option = mapWithUndeclaredPropertiesAnytype2; + MapWithUndeclaredPropertiesAnytype3Option = mapWithUndeclaredPropertiesAnytype3; + MapWithUndeclaredPropertiesStringOption = mapWithUndeclaredPropertiesString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Anytype1Option { get; private set; } + + /// + /// Gets or Sets Anytype1 + /// + [JsonPropertyName("anytype_1")] + public Object Anytype1 { get { return this.Anytype1Option; } set { this.Anytype1Option = new(value); } } + + /// + /// Used to track the state of EmptyMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EmptyMapOption { get; private set; } + + /// + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + /// + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + [JsonPropertyName("empty_map")] + public Object EmptyMap { get { return this.EmptyMapOption; } set { this.EmptyMapOption = new(value); } } + + /// + /// Used to track the state of MapOfMapProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> MapOfMapPropertyOption { get; private set; } + + /// + /// Gets or Sets MapOfMapProperty + /// + [JsonPropertyName("map_of_map_property")] + public Dictionary> MapOfMapProperty { get { return this.MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } + + /// + /// Used to track the state of MapProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapPropertyOption { get; private set; } + + /// + /// Gets or Sets MapProperty + /// + [JsonPropertyName("map_property")] + public Dictionary MapProperty { get { return this.MapPropertyOption; } set { this.MapPropertyOption = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_1")] + public Object MapWithUndeclaredPropertiesAnytype1 { get { return this.MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_2")] + public Object MapWithUndeclaredPropertiesAnytype2 { get { return this.MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_3")] + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get { return this.MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesString + /// + [JsonPropertyName("map_with_undeclared_properties_string")] + public Dictionary MapWithUndeclaredPropertiesString { get { return this.MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AdditionalPropertiesClass {\n"); + sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); + sb.Append(" EmptyMap: ").Append(EmptyMap).Append("\n"); + sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); + sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype1: ").Append(MapWithUndeclaredPropertiesAnytype1).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AdditionalPropertiesClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option anytype1 = default; + Option emptyMap = default; + Option>> mapOfMapProperty = default; + Option> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option> mapWithUndeclaredPropertiesAnytype3 = default; + Option> mapWithUndeclaredPropertiesString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "anytype_1": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "empty_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_of_map_property": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_property": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_with_undeclared_properties_anytype_1": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_with_undeclared_properties_anytype_2": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_with_undeclared_properties_anytype_3": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype3 = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_with_undeclared_properties_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (emptyMap.IsSet && emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapOfMapProperty.IsSet && mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapProperty.IsSet && mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype1.IsSet && mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype2.IsSet && mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype3.IsSet && mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); + + return new AdditionalPropertiesClass(anytype1, emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, additionalPropertiesClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.Anytype1Option.IsSet) + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); + if (additionalPropertiesClass.EmptyMapOption.IsSet) + { + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) + { + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapPropertyOption.IsSet) + { + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Animal.cs new file mode 100644 index 000000000000..d0b07da62cc8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Animal.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Animal + /// + public partial class Animal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// color (default to "red") + [JsonConstructor] + public Animal(Option color = default) + { + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public string ClassName { get; } = "Animal"; + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Animal {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AnimalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option color = default; + + string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "className"); + + if (discriminator != null && discriminator.Equals("Cat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + if (discriminator != null && discriminator.Equals("Dog")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Animal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); + + return new Animal(color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) + { + if (animal is Cat cat){ + JsonSerializer.Serialize(writer, cat, jsonSerializerOptions); + return; + } + + if (animal is Dog dog){ + JsonSerializer.Serialize(writer, dog, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, animal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) + { + if (animal.ColorOption.IsSet && animal.Color == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + + writer.WriteString("className", animal.ClassName); + + if (animal.ColorOption.IsSet) + writer.WriteString("color", animal.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs new file mode 100644 index 000000000000..3b185247e442 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -0,0 +1,230 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ApiResponse + /// + public partial class ApiResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// code + /// message + /// type + [JsonConstructor] + public ApiResponse(Option code = default, Option message = default, Option type = default) + { + CodeOption = code; + MessageOption = message; + TypeOption = type; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Code + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CodeOption { get; private set; } + + /// + /// Gets or Sets Code + /// + [JsonPropertyName("code")] + public int? Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } } + + /// + /// Used to track the state of Message + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MessageOption { get; private set; } + + /// + /// Gets or Sets Message + /// + [JsonPropertyName("message")] + public string Message { get { return this.MessageOption; } set { this.MessageOption = new(value); } } + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TypeOption { get; private set; } + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public string Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ApiResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option code = default; + Option message = default; + Option type = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "code": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + code = new Option(utf8JsonReader.GetInt32()); + break; + case "message": + message = new Option(utf8JsonReader.GetString()); + break; + case "type": + type = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (code.IsSet && code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); + + if (message.IsSet && message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); + + return new ApiResponse(code, message, type); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apiResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + + if (apiResponse.CodeOption.IsSet) + writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); + + if (apiResponse.MessageOption.IsSet) + writer.WriteString("message", apiResponse.Message); + + if (apiResponse.TypeOption.IsSet) + writer.WriteString("type", apiResponse.Type); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Apple.cs new file mode 100644 index 000000000000..26fbe0516849 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Apple.cs @@ -0,0 +1,262 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Apple + /// + public partial class Apple : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// colorCode + /// cultivar + /// origin + [JsonConstructor] + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) + { + ColorCodeOption = colorCode; + CultivarOption = cultivar; + OriginOption = origin; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ColorCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorCodeOption { get; private set; } + + /// + /// Gets or Sets ColorCode + /// + [JsonPropertyName("color_code")] + public string ColorCode { get { return this.ColorCodeOption; } set { this.ColorCodeOption = new(value); } } + + /// + /// Used to track the state of Cultivar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CultivarOption { get; private set; } + + /// + /// Gets or Sets Cultivar + /// + [JsonPropertyName("cultivar")] + public string Cultivar { get { return this.CultivarOption; } set { this.CultivarOption = new(value); } } + + /// + /// Used to track the state of Origin + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OriginOption { get; private set; } + + /// + /// Gets or Sets Origin + /// + [JsonPropertyName("origin")] + public string Origin { get { return this.OriginOption; } set { this.OriginOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Apple {\n"); + sb.Append(" ColorCode: ").Append(ColorCode).Append("\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); + sb.Append(" Origin: ").Append(Origin).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.ColorCodeOption.Value != null) { + // ColorCode (string) pattern + Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); + + if (this.ColorCodeOption.Value != null &&!regexColorCode.Match(this.ColorCodeOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); + } + } + + if (this.CultivarOption.Value != null) { + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + + if (this.CultivarOption.Value != null &&!regexCultivar.Match(this.CultivarOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } + } + + if (this.OriginOption.Value != null) { + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.OriginOption.Value != null &&!regexOrigin.Match(this.OriginOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } + } + + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option colorCode = default; + Option cultivar = default; + Option origin = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color_code": + colorCode = new Option(utf8JsonReader.GetString()); + break; + case "cultivar": + cultivar = new Option(utf8JsonReader.GetString()); + break; + case "origin": + origin = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (colorCode.IsSet && colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); + + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); + + if (origin.IsSet && origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); + + return new Apple(colorCode, cultivar, origin); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apple, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.CultivarOption.IsSet && apple.Cultivar == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.OriginOption.IsSet && apple.Origin == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + + if (apple.ColorCodeOption.IsSet) + writer.WriteString("color_code", apple.ColorCode); + + if (apple.CultivarOption.IsSet) + writer.WriteString("cultivar", apple.Cultivar); + + if (apple.OriginOption.IsSet) + writer.WriteString("origin", apple.Origin); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs new file mode 100644 index 000000000000..942640761b26 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// AppleReq + /// + public partial class AppleReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// cultivar + /// mealy + [JsonConstructor] + public AppleReq(string cultivar, Option mealy = default) + { + Cultivar = cultivar; + MealyOption = mealy; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Cultivar + /// + [JsonPropertyName("cultivar")] + public string Cultivar { get; set; } + + /// + /// Used to track the state of Mealy + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MealyOption { get; private set; } + + /// + /// Gets or Sets Mealy + /// + [JsonPropertyName("mealy")] + public bool? Mealy { get { return this.MealyOption; } set { this.MealyOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AppleReq {\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); + sb.Append(" Mealy: ").Append(Mealy).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option cultivar = default; + Option mealy = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "cultivar": + cultivar = new Option(utf8JsonReader.GetString()); + break; + case "mealy": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mealy = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!cultivar.IsSet) + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); + + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); + + if (mealy.IsSet && mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + return new AppleReq(cultivar.Value, mealy); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, appleReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) + { + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + + writer.WriteString("cultivar", appleReq.Cultivar); + + if (appleReq.MealyOption.IsSet) + writer.WriteBoolean("mealy", appleReq.MealyOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs new file mode 100644 index 000000000000..debcff217b93 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfArrayOfNumberOnly + /// + public partial class ArrayOfArrayOfNumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayArrayNumber + [JsonConstructor] + public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) + { + ArrayArrayNumberOption = arrayArrayNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayArrayNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> ArrayArrayNumberOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayNumber + /// + [JsonPropertyName("ArrayArrayNumber")] + public List> ArrayArrayNumber { get { return this.ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayOfArrayOfNumberOnly {\n"); + sb.Append(" ArrayArrayNumber: ").Append(ArrayArrayNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayOfArrayOfNumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>> arrayArrayNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ArrayArrayNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); + + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayOfArrayOfNumberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) + { + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs new file mode 100644 index 000000000000..ded293438a45 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfNumberOnly + /// + public partial class ArrayOfNumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayNumber + [JsonConstructor] + public ArrayOfNumberOnly(Option> arrayNumber = default) + { + ArrayNumberOption = arrayNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayNumberOption { get; private set; } + + /// + /// Gets or Sets ArrayNumber + /// + [JsonPropertyName("ArrayNumber")] + public List ArrayNumber { get { return this.ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayOfNumberOnly {\n"); + sb.Append(" ArrayNumber: ").Append(ArrayNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayOfNumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> arrayNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ArrayNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (arrayNumber.IsSet && arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); + + return new ArrayOfNumberOnly(arrayNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayOfNumberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) + { + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs new file mode 100644 index 000000000000..ee7b94f08bd3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -0,0 +1,242 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayTest + /// + public partial class ArrayTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayArrayOfInteger + /// arrayArrayOfModel + /// arrayOfString + [JsonConstructor] + public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) + { + ArrayArrayOfIntegerOption = arrayArrayOfInteger; + ArrayArrayOfModelOption = arrayArrayOfModel; + ArrayOfStringOption = arrayOfString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayArrayOfInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> ArrayArrayOfIntegerOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayOfInteger + /// + [JsonPropertyName("array_array_of_integer")] + public List> ArrayArrayOfInteger { get { return this.ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } + + /// + /// Used to track the state of ArrayArrayOfModel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> ArrayArrayOfModelOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayOfModel + /// + [JsonPropertyName("array_array_of_model")] + public List> ArrayArrayOfModel { get { return this.ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } + + /// + /// Used to track the state of ArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets ArrayOfString + /// + [JsonPropertyName("array_of_string")] + public List ArrayOfString { get { return this.ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayTest {\n"); + sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n"); + sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append("\n"); + sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>> arrayArrayOfInteger = default; + Option>> arrayArrayOfModel = default; + Option> arrayOfString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_array_of_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_array_of_model": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (arrayArrayOfInteger.IsSet && arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); + + if (arrayArrayOfModel.IsSet && arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); + + if (arrayOfString.IsSet && arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); + + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) + { + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + } + if (arrayTest.ArrayArrayOfModelOption.IsSet) + { + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + } + if (arrayTest.ArrayOfStringOption.IsSet) + { + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs new file mode 100644 index 000000000000..476a1c25352b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Banana.cs @@ -0,0 +1,172 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Banana + /// + public partial class Banana : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lengthCm + [JsonConstructor] + public Banana(Option lengthCm = default) + { + LengthCmOption = lengthCm; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of LengthCm + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option LengthCmOption { get; private set; } + + /// + /// Gets or Sets LengthCm + /// + [JsonPropertyName("lengthCm")] + public decimal? LengthCm { get { return this.LengthCmOption; } set { this.LengthCmOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Banana {\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option lengthCm = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lengthCm": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + lengthCm = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); + + return new Banana(lengthCm); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, banana, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + if (banana.LengthCmOption.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs new file mode 100644 index 000000000000..a3a0a15428b4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs @@ -0,0 +1,187 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// BananaReq + /// + public partial class BananaReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lengthCm + /// sweet + [JsonConstructor] + public BananaReq(decimal lengthCm, Option sweet = default) + { + LengthCm = lengthCm; + SweetOption = sweet; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets LengthCm + /// + [JsonPropertyName("lengthCm")] + public decimal LengthCm { get; set; } + + /// + /// Used to track the state of Sweet + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SweetOption { get; private set; } + + /// + /// Gets or Sets Sweet + /// + [JsonPropertyName("sweet")] + public bool? Sweet { get { return this.SweetOption; } set { this.SweetOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BananaReq {\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); + sb.Append(" Sweet: ").Append(Sweet).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option lengthCm = default; + Option sweet = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lengthCm": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + lengthCm = new Option(utf8JsonReader.GetDecimal()); + break; + case "sweet": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + sweet = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!lengthCm.IsSet) + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); + + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); + + if (sweet.IsSet && sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + return new BananaReq(lengthCm.Value.Value, sweet); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, bananaReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + + if (bananaReq.SweetOption.IsSet) + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs new file mode 100644 index 000000000000..9938d89e008d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// BasquePig + /// + public partial class BasquePig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + [JsonConstructor] + public BasquePig(string className) + { + ClassName = className; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BasquePig {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BasquePigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + return new BasquePig(className.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, basquePig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) + { + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + + writer.WriteString("className", basquePig.ClassName); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs new file mode 100644 index 000000000000..8308df3a0912 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs @@ -0,0 +1,320 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Capitalization + /// + public partial class Capitalization : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Name of the pet + /// capitalCamel + /// capitalSnake + /// sCAETHFlowPoints + /// smallCamel + /// smallSnake + [JsonConstructor] + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) + { + ATT_NAMEOption = aTTNAME; + CapitalCamelOption = capitalCamel; + CapitalSnakeOption = capitalSnake; + SCAETHFlowPointsOption = sCAETHFlowPoints; + SmallCamelOption = smallCamel; + SmallSnakeOption = smallSnake; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ATT_NAME + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ATT_NAMEOption { get; private set; } + + /// + /// Name of the pet + /// + /// Name of the pet + [JsonPropertyName("ATT_NAME")] + public string ATT_NAME { get { return this.ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } + + /// + /// Used to track the state of CapitalCamel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CapitalCamelOption { get; private set; } + + /// + /// Gets or Sets CapitalCamel + /// + [JsonPropertyName("CapitalCamel")] + public string CapitalCamel { get { return this.CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } + + /// + /// Used to track the state of CapitalSnake + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CapitalSnakeOption { get; private set; } + + /// + /// Gets or Sets CapitalSnake + /// + [JsonPropertyName("Capital_Snake")] + public string CapitalSnake { get { return this.CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } + + /// + /// Used to track the state of SCAETHFlowPoints + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SCAETHFlowPointsOption { get; private set; } + + /// + /// Gets or Sets SCAETHFlowPoints + /// + [JsonPropertyName("SCA_ETH_Flow_Points")] + public string SCAETHFlowPoints { get { return this.SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } + + /// + /// Used to track the state of SmallCamel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SmallCamelOption { get; private set; } + + /// + /// Gets or Sets SmallCamel + /// + [JsonPropertyName("smallCamel")] + public string SmallCamel { get { return this.SmallCamelOption; } set { this.SmallCamelOption = new(value); } } + + /// + /// Used to track the state of SmallSnake + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SmallSnakeOption { get; private set; } + + /// + /// Gets or Sets SmallSnake + /// + [JsonPropertyName("small_Snake")] + public string SmallSnake { get { return this.SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Capitalization {\n"); + sb.Append(" ATT_NAME: ").Append(ATT_NAME).Append("\n"); + sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n"); + sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n"); + sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n"); + sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n"); + sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class CapitalizationJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ATT_NAME": + aTTNAME = new Option(utf8JsonReader.GetString()); + break; + case "CapitalCamel": + capitalCamel = new Option(utf8JsonReader.GetString()); + break; + case "Capital_Snake": + capitalSnake = new Option(utf8JsonReader.GetString()); + break; + case "SCA_ETH_Flow_Points": + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()); + break; + case "smallCamel": + smallCamel = new Option(utf8JsonReader.GetString()); + break; + case "small_Snake": + smallSnake = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (aTTNAME.IsSet && aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); + + if (capitalCamel.IsSet && capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); + + if (capitalSnake.IsSet && capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); + + if (sCAETHFlowPoints.IsSet && sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); + + if (smallCamel.IsSet && smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); + + if (smallSnake.IsSet && smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); + + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, capitalization, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) + { + if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + + if (capitalization.ATT_NAMEOption.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); + + if (capitalization.CapitalCamelOption.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); + + if (capitalization.CapitalSnakeOption.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); + + if (capitalization.SCAETHFlowPointsOption.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); + + if (capitalization.SmallCamelOption.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel); + + if (capitalization.SmallSnakeOption.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs new file mode 100644 index 000000000000..6a1dfe1d90b6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Cat.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Cat + /// + public partial class Cat : Animal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// color (default to "red") + /// declawed + [JsonConstructor] + public Cat(Option color = default, Option declawed = default) : base(color) + { + DeclawedOption = declawed; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string ClassName { get; } = "Cat"; + + /// + /// Used to track the state of Declawed + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeclawedOption { get; private set; } + + /// + /// Gets or Sets Declawed + /// + [JsonPropertyName("declawed")] + public bool? Declawed { get { return this.DeclawedOption; } set { this.DeclawedOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Cat {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class CatJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option color = default; + Option declawed = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + case "declawed": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + declawed = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Cat.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); + + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + + return new Cat(color, declawed); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, cat, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) + { + if (cat.ColorOption.IsSet && cat.Color == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + + writer.WriteString("className", cat.ClassName); + + if (cat.ColorOption.IsSet) + writer.WriteString("color", cat.Color); + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs new file mode 100644 index 000000000000..9bd387646078 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Category.cs @@ -0,0 +1,196 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Category + /// + public partial class Category : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + /// name (default to "default-name") + [JsonConstructor] + public Category(Option id = default, string name = @"default-name") + { + IdOption = id; + Name = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Category {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class CategoryJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!name.IsSet) + throw new ArgumentException("Property is required for class Category.", nameof(name)); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + return new Category(id, name.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, category, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) + { + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + + if (category.IdOption.IsSet) + writer.WriteNumber("id", category.IdOption.Value.Value); + + writer.WriteString("name", category.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs new file mode 100644 index 000000000000..87a49cbe08f0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs @@ -0,0 +1,231 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ChildCat + /// + public partial class ChildCat : ParentPet, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public ChildCat(Option name = default) : base() + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines PetType + /// + public enum PetTypeEnum + { + /// + /// Enum ChildCat for value: ChildCat + /// + ChildCat = 1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static PetTypeEnum PetTypeEnumFromString(string value) + { + if (value.Equals("ChildCat")) + return PetTypeEnum.ChildCat; + + throw new NotImplementedException($"Could not convert value to type PetTypeEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static PetTypeEnum? PetTypeEnumFromStringOrDefault(string value) + { + if (value.Equals("ChildCat")) + return PetTypeEnum.ChildCat; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string PetTypeEnumToJsonValue(PetTypeEnum value) + { + if (value == PetTypeEnum.ChildCat) + return "ChildCat"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new PetTypeEnum PetType { get; } = (PetTypeEnum)Enum.Parse(typeof(PetTypeEnum), "ChildCat"); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ChildCat {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class ChildCatJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + Option petType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + case "pet_type": + string petTypeRawValue = utf8JsonReader.GetString(); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ChildCat.", nameof(petType)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); + + return new ChildCat(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, childCat, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) + { + if (childCat.NameOption.IsSet && childCat.Name == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + + if (childCat.NameOption.IsSet) + writer.WriteString("name", childCat.Name); + + writer.WriteString("pet_type", ChildCat.PetTypeEnumToJsonValue(childCat.PetType)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs new file mode 100644 index 000000000000..9730e5b1185e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model with \"_class\" property + /// + public partial class ClassModel : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// class + [JsonConstructor] + public ClassModel(Option @class = default) + { + ClassOption = @class; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Class + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ClassOption { get; private set; } + + /// + /// Gets or Sets Class + /// + [JsonPropertyName("_class")] + public string Class { get { return this.ClassOption; } set { this.ClassOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ClassModel {\n"); + sb.Append(" Class: ").Append(Class).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ClassModelJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClass = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "_class": + varClass = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); + + return new ClassModel(varClass); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, classModel, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) + { + if (classModel.ClassOption.IsSet && classModel.Class == null) + throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + + if (classModel.ClassOption.IsSet) + writer.WriteString("_class", classModel.Class); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs new file mode 100644 index 000000000000..3023a45610e4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ComplexQuadrilateral + /// + public partial class ComplexQuadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + /// shapeType + [JsonConstructor] + public ComplexQuadrilateral(string quadrilateralType, string shapeType) + { + QuadrilateralType = quadrilateralType; + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ComplexQuadrilateral {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ComplexQuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()); + break; + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + return new ComplexQuadrilateral(quadrilateralType.Value, shapeType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, complexQuadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs new file mode 100644 index 000000000000..14b2ed3b153f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DanishPig + /// + public partial class DanishPig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + [JsonConstructor] + public DanishPig(string className) + { + ClassName = className; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DanishPig {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DanishPigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + return new DanishPig(className.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, danishPig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) + { + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + + writer.WriteString("className", danishPig.ClassName); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs new file mode 100644 index 000000000000..1f3a3bb8a98e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DateOnlyClass + /// + public partial class DateOnlyClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// dateOnlyProperty + [JsonConstructor] + public DateOnlyClass(Option dateOnlyProperty = default) + { + DateOnlyPropertyOption = dateOnlyProperty; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of DateOnlyProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateOnlyPropertyOption { get; private set; } + + /// + /// Gets or Sets DateOnlyProperty + /// + /* Fri Jul 21 00:00:00 UTC 2017 */ + [JsonPropertyName("dateOnlyProperty")] + public DateOnly? DateOnlyProperty { get { return this.DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DateOnlyClass {\n"); + sb.Append(" DateOnlyProperty: ").Append(DateOnlyProperty).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DateOnlyClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateOnlyProperty + /// + public static string DateOnlyPropertyFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option dateOnlyProperty = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "dateOnlyProperty": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); + + return new DateOnlyClass(dateOnlyProperty); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, dateOnlyClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) + { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs new file mode 100644 index 000000000000..65695f863abb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DeprecatedObject + /// + public partial class DeprecatedObject : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public DeprecatedObject(Option name = default) + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeprecatedObject {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DeprecatedObjectJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); + + return new DeprecatedObject(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, deprecatedObject, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) + { + if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + + if (deprecatedObject.NameOption.IsSet) + writer.WriteString("name", deprecatedObject.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Dog.cs new file mode 100644 index 000000000000..2ab1ca19d2d0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Dog.cs @@ -0,0 +1,191 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Dog + /// + public partial class Dog : Animal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// breed + /// color (default to "red") + [JsonConstructor] + public Dog(Option breed = default, Option color = default) : base(color) + { + BreedOption = breed; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string ClassName { get; } = "Dog"; + + /// + /// Used to track the state of Breed + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BreedOption { get; private set; } + + /// + /// Gets or Sets Breed + /// + [JsonPropertyName("breed")] + public string Breed { get { return this.BreedOption; } set { this.BreedOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Dog {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class DogJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option breed = default; + Option color = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()); + break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Dog.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + + if (breed.IsSet && breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); + + return new Dog(breed, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, dog, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) + { + if (dog.BreedOption.IsSet && dog.Breed == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.ColorOption.IsSet && dog.Color == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + + writer.WriteString("className", dog.ClassName); + + if (dog.BreedOption.IsSet) + writer.WriteString("breed", dog.Breed); + + if (dog.ColorOption.IsSet) + writer.WriteString("color", dog.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs new file mode 100644 index 000000000000..72e59c9baf44 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Drawing.cs @@ -0,0 +1,268 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Drawing + /// + public partial class Drawing : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// mainShape + /// nullableShape + /// shapeOrNull + /// shapes + [JsonConstructor] + public Drawing(Option mainShape = default, Option nullableShape = default, Option shapeOrNull = default, Option> shapes = default) + { + MainShapeOption = mainShape; + NullableShapeOption = nullableShape; + ShapeOrNullOption = shapeOrNull; + ShapesOption = shapes; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of MainShape + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MainShapeOption { get; private set; } + + /// + /// Gets or Sets MainShape + /// + [JsonPropertyName("mainShape")] + public Shape MainShape { get { return this.MainShapeOption; } set { this.MainShapeOption = new(value); } } + + /// + /// Used to track the state of NullableShape + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NullableShapeOption { get; private set; } + + /// + /// Gets or Sets NullableShape + /// + [JsonPropertyName("nullableShape")] + public NullableShape NullableShape { get { return this.NullableShapeOption; } set { this.NullableShapeOption = new(value); } } + + /// + /// Used to track the state of ShapeOrNull + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShapeOrNullOption { get; private set; } + + /// + /// Gets or Sets ShapeOrNull + /// + [JsonPropertyName("shapeOrNull")] + public ShapeOrNull ShapeOrNull { get { return this.ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } + + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ShapesOption { get; private set; } + + /// + /// Gets or Sets Shapes + /// + [JsonPropertyName("shapes")] + public List Shapes { get { return this.ShapesOption; } set { this.ShapesOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Drawing {\n"); + sb.Append(" MainShape: ").Append(MainShape).Append("\n"); + sb.Append(" NullableShape: ").Append(NullableShape).Append("\n"); + sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n"); + sb.Append(" Shapes: ").Append(Shapes).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DrawingJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option mainShape = default; + Option nullableShape = default; + Option shapeOrNull = default; + Option> shapes = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "mainShape": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "nullableShape": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "shapeOrNull": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "shapes": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (mainShape.IsSet && mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); + + if (shapes.IsSet && shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); + + return new Drawing(mainShape, nullableShape, shapeOrNull, shapes); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, drawing, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) + { + if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.ShapesOption.IsSet && drawing.Shapes == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + + if (drawing.MainShapeOption.IsSet) + { + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + } + if (drawing.NullableShapeOption.IsSet) + if (drawing.NullableShapeOption.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNullOption.IsSet) + if (drawing.ShapeOrNullOption.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); + if (drawing.ShapesOption.IsSet) + { + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs new file mode 100644 index 000000000000..4eb9365b1f54 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumArrays + /// + public partial class EnumArrays : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayEnum + /// justSymbol + [JsonConstructor] + public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) + { + ArrayEnumOption = arrayEnum; + JustSymbolOption = justSymbol; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines ArrayEnum + /// + public enum ArrayEnumEnum + { + /// + /// Enum Fish for value: fish + /// + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + Crab = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static ArrayEnumEnum ArrayEnumEnumFromString(string value) + { + if (value.Equals("fish")) + return ArrayEnumEnum.Fish; + + if (value.Equals("crab")) + return ArrayEnumEnum.Crab; + + throw new NotImplementedException($"Could not convert value to type ArrayEnumEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static ArrayEnumEnum? ArrayEnumEnumFromStringOrDefault(string value) + { + if (value.Equals("fish")) + return ArrayEnumEnum.Fish; + + if (value.Equals("crab")) + return ArrayEnumEnum.Crab; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) + { + if (value == ArrayEnumEnum.Fish) + return "fish"; + + if (value == ArrayEnumEnum.Crab) + return "crab"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Defines JustSymbol + /// + public enum JustSymbolEnum + { + /// + /// Enum GreaterThanOrEqualTo for value: >= + /// + GreaterThanOrEqualTo = 1, + + /// + /// Enum Dollar for value: $ + /// + Dollar = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static JustSymbolEnum JustSymbolEnumFromString(string value) + { + if (value.Equals(">=")) + return JustSymbolEnum.GreaterThanOrEqualTo; + + if (value.Equals("$")) + return JustSymbolEnum.Dollar; + + throw new NotImplementedException($"Could not convert value to type JustSymbolEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static JustSymbolEnum? JustSymbolEnumFromStringOrDefault(string value) + { + if (value.Equals(">=")) + return JustSymbolEnum.GreaterThanOrEqualTo; + + if (value.Equals("$")) + return JustSymbolEnum.Dollar; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) + { + if (value == JustSymbolEnum.GreaterThanOrEqualTo) + return ">="; + + if (value == JustSymbolEnum.Dollar) + return "$"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of JustSymbol + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option JustSymbolOption { get; private set; } + + /// + /// Gets or Sets JustSymbol + /// + [JsonPropertyName("just_symbol")] + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } + + /// + /// Used to track the state of ArrayEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayEnumOption { get; private set; } + + /// + /// Gets or Sets ArrayEnum + /// + [JsonPropertyName("array_enum")] + public List ArrayEnum { get { return this.ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EnumArrays {\n"); + sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EnumArraysJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> arrayEnum = default; + Option justSymbol = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_enum": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "just_symbol": + string justSymbolRawValue = utf8JsonReader.GetString(); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); + break; + default: + break; + } + } + } + + if (arrayEnum.IsSet && arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); + + if (justSymbol.IsSet && justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); + + return new EnumArrays(arrayEnum, justSymbol); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, enumArrays, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) + { + if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + + if (enumArrays.ArrayEnumOption.IsSet) + { + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + } + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value); + writer.WriteString("just_symbol", justSymbolRawValue); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumClass.cs new file mode 100644 index 000000000000..b1aff0adf0d8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumClass.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines EnumClass + /// + public enum EnumClass + { + /// + /// Enum Abc for value: _abc + /// + Abc = 1, + + /// + /// Enum Efg for value: -efg + /// + Efg = 2, + + /// + /// Enum Xyz for value: (xyz) + /// + Xyz = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class EnumClassValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EnumClass FromString(string value) + { + if (value.Equals("_abc")) + return EnumClass.Abc; + + if (value.Equals("-efg")) + return EnumClass.Efg; + + if (value.Equals("(xyz)")) + return EnumClass.Xyz; + + throw new NotImplementedException($"Could not convert value to type EnumClass: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EnumClass? FromStringOrDefault(string value) + { + if (value.Equals("_abc")) + return EnumClass.Abc; + + if (value.Equals("-efg")) + return EnumClass.Efg; + + if (value.Equals("(xyz)")) + return EnumClass.Xyz; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EnumClass value) + { + if (value == EnumClass.Abc) + return "_abc"; + + if (value == EnumClass.Efg) + return "-efg"; + + if (value == EnumClass.Xyz) + return "(xyz)"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EnumClassJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EnumClass Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumClass? result = rawValue == null + ? null + : EnumClassValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EnumClass to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumClass enumClass, JsonSerializerOptions options) + { + writer.WriteStringValue(enumClass.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EnumClassNullableJsonConverter : JsonConverter + { + /// + /// Returns a EnumClass from the Json object + /// + /// + /// + /// + /// + public override EnumClass? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + EnumClass? result = rawValue == null + ? null + : EnumClassValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumClass? enumClass, JsonSerializerOptions options) + { + writer.WriteStringValue(enumClass?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs new file mode 100644 index 000000000000..f7a3a20b1b10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs @@ -0,0 +1,881 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumTest + /// + public partial class EnumTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// enumStringRequired + /// enumInteger + /// enumIntegerOnly + /// enumNumber + /// enumString + /// outerEnum + /// outerEnumDefaultValue + /// outerEnumInteger + /// outerEnumIntegerDefaultValue + [JsonConstructor] + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnum = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default) + { + EnumStringRequired = enumStringRequired; + EnumIntegerOption = enumInteger; + EnumIntegerOnlyOption = enumIntegerOnly; + EnumNumberOption = enumNumber; + EnumStringOption = enumString; + OuterEnumOption = outerEnum; + OuterEnumDefaultValueOption = outerEnumDefaultValue; + OuterEnumIntegerOption = outerEnumInteger; + OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } + + /// + /// Defines EnumInteger + /// + public enum EnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumIntegerEnum EnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return EnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return EnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type EnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumIntegerEnum? EnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return EnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return EnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of EnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumIntegerOption { get; private set; } + + /// + /// Gets or Sets EnumInteger + /// + [JsonPropertyName("enum_integer")] + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } + + /// + /// Defines EnumIntegerOnly + /// + public enum EnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumIntegerOnlyEnum EnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type EnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumIntegerOnlyEnum? EnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of EnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets EnumIntegerOnly + /// + [JsonPropertyName("enum_integer_only")] + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } + + /// + /// Defines EnumNumber + /// + public enum EnumNumberEnum + { + /// + /// Enum NUMBER_1_DOT_1 for value: 1.1 + /// + NUMBER_1_DOT_1 = 1, + + /// + /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 + /// + NUMBER_MINUS_1_DOT_2 = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumNumberEnum EnumNumberEnumFromString(string value) + { + if (value.Equals("1.1")) + return EnumNumberEnum.NUMBER_1_DOT_1; + + if (value.Equals("-1.2")) + return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; + + throw new NotImplementedException($"Could not convert value to type EnumNumberEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumNumberEnum? EnumNumberEnumFromStringOrDefault(string value) + { + if (value.Equals("1.1")) + return EnumNumberEnum.NUMBER_1_DOT_1; + + if (value.Equals("-1.2")) + return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) + { + if (value == EnumNumberEnum.NUMBER_1_DOT_1) + return 1.1; + + if (value == EnumNumberEnum.NUMBER_MINUS_1_DOT_2) + return -1.2; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of EnumNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumNumberOption { get; private set; } + + /// + /// Gets or Sets EnumNumber + /// + [JsonPropertyName("enum_number")] + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } + + /// + /// Defines EnumString + /// + public enum EnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringEnum EnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringEnum.Lower; + + if (value.Equals("")) + return EnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringEnum? EnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringEnum.Lower; + + if (value.Equals("")) + return EnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringEnumToJsonValue(EnumStringEnum? value) + { + if (value == EnumStringEnum.UPPER) + return "UPPER"; + + if (value == EnumStringEnum.Lower) + return "lower"; + + if (value == EnumStringEnum.Empty) + return ""; + + if (value == EnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of EnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumStringOption { get; private set; } + + /// + /// Gets or Sets EnumString + /// + [JsonPropertyName("enum_string")] + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } + + /// + /// Used to track the state of OuterEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumOption { get; private set; } + + /// + /// Gets or Sets OuterEnum + /// + [JsonPropertyName("outerEnum")] + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } + + /// + /// Used to track the state of OuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets OuterEnumDefaultValue + /// + [JsonPropertyName("outerEnumDefaultValue")] + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } + + /// + /// Used to track the state of OuterEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets OuterEnumInteger + /// + [JsonPropertyName("outerEnumInteger")] + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } + + /// + /// Used to track the state of OuterEnumIntegerDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumIntegerDefaultValueOption { get; private set; } + + /// + /// Gets or Sets OuterEnumIntegerDefaultValue + /// + [JsonPropertyName("outerEnumIntegerDefaultValue")] + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); + sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); + sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); + sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); + sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); + sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); + sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); + sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EnumTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnum = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "enum_string_required": + string enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; + case "enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "enum_number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + break; + case "enum_string": + string enumStringRawValue = utf8JsonReader.GetString(); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); + break; + case "outerEnum": + string outerEnumRawValue = utf8JsonReader.GetString(); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + break; + case "outerEnumDefaultValue": + string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); + break; + case "outerEnumInteger": + string outerEnumIntegerRawValue = utf8JsonReader.GetString(); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); + break; + case "outerEnumIntegerDefaultValue": + string outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); + break; + default: + break; + } + } + } + + if (!enumStringRequired.IsSet) + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); + + if (enumStringRequired.IsSet && enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); + + if (enumInteger.IsSet && enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); + + if (enumIntegerOnly.IsSet && enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); + + if (enumNumber.IsSet && enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + + if (enumString.IsSet && enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); + + if (outerEnumDefaultValue.IsSet && outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); + + if (outerEnumInteger.IsSet && outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); + + if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + + return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnum, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, enumTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) + { + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); + writer.WriteString("enum_string_required", enumStringRequiredRawValue); + if (enumTest.EnumIntegerOption.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value.Value)); + + if (enumTest.EnumIntegerOnlyOption.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value.Value)); + + if (enumTest.EnumNumberOption.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value.Value)); + + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value.Value); + writer.WriteString("enum_string", enumStringRawValue); + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); + writer.WriteString("outerEnum", outerEnumRawValue); + } + else + writer.WriteNull("outerEnum"); + if (enumTest.OuterEnumDefaultValueOption.IsSet) + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumIntegerOption.IsSet) + { + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) + { + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs new file mode 100644 index 000000000000..d65c7740e5e8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EquilateralTriangle + /// + public partial class EquilateralTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public EquilateralTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EquilateralTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EquilateralTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + return new EquilateralTriangle(shapeType.Value, triangleType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, equilateralTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + + writer.WriteString("triangleType", equilateralTriangle.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 000000000000..3962bf2beee0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/File.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + public partial class File : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization + [JsonConstructor] + public File(Option sourceURI = default) + { + SourceURIOption = sourceURI; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of SourceURI + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SourceURIOption { get; private set; } + + /// + /// Test capitalization + /// + /// Test capitalization + [JsonPropertyName("sourceURI")] + public string SourceURI { get { return this.SourceURIOption; } set { this.SourceURIOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FileJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option sourceURI = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "sourceURI": + sourceURI = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (sourceURI.IsSet && sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); + + return new File(sourceURI); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, file, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) + { + if (file.SourceURIOption.IsSet && file.SourceURI == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + + if (file.SourceURIOption.IsSet) + writer.WriteString("sourceURI", file.SourceURI); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 000000000000..b4307b69a3b6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,210 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + public partial class FileSchemaTestClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// file + /// files + [JsonConstructor] + public FileSchemaTestClass(Option file = default, Option> files = default) + { + FileOption = file; + FilesOption = files; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of File + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FileOption { get; private set; } + + /// + /// Gets or Sets File + /// + [JsonPropertyName("file")] + public File File { get { return this.FileOption; } set { this.FileOption = new(value); } } + + /// + /// Used to track the state of Files + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> FilesOption { get; private set; } + + /// + /// Gets or Sets Files + /// + [JsonPropertyName("files")] + public List Files { get { return this.FilesOption; } set { this.FilesOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FileSchemaTestClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option file = default; + Option> files = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "file": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "files": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); + + if (files.IsSet && files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); + + return new FileSchemaTestClass(file, files); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fileSchemaTestClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) + { + if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FileOption.IsSet) + { + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + } + if (fileSchemaTestClass.FilesOption.IsSet) + { + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Foo.cs new file mode 100644 index 000000000000..8c2e7c2aeb35 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Foo.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Foo + /// + public partial class Foo : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar (default to "bar") + [JsonConstructor] + public Foo(Option bar = default) + { + BarOption = bar; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; private set; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string Bar { get { return this.BarOption; } set { this.BarOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Foo {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FooJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); + + return new Foo(bar); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, foo, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) + { + if (foo.BarOption.IsSet && foo.Bar == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + + if (foo.BarOption.IsSet) + writer.WriteString("bar", foo.Bar); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 000000000000..1540483527a3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + public partial class FooGetDefaultResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// string + [JsonConstructor] + public FooGetDefaultResponse(Option @string = default) + { + StringOption = @string; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public Foo String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FooGetDefaultResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); + + return new FooGetDefaultResponse(varString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fooGetDefaultResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + + if (fooGetDefaultResponse.StringOption.IsSet) + { + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.String, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs new file mode 100644 index 000000000000..96902abd13a6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -0,0 +1,969 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FormatTest + /// + public partial class FormatTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// byte + /// date + /// number + /// password + /// binary + /// dateTime + /// decimal + /// double + /// float + /// int32 + /// int32Range + /// int64 + /// int64Negative + /// int64NegativeExclusive + /// int64Positive + /// int64PositiveExclusive + /// integer + /// None + /// A string that is a 10 digit number. Can have leading zeros. + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// string + /// unsignedInteger + /// unsignedLong + /// uuid + [JsonConstructor] + public FormatTest(byte[] @byte, DateOnly date, decimal number, string password, Option binary = default, Option dateTime = default, Option @decimal = default, Option @double = default, Option @float = default, Option int32 = default, Option int32Range = default, Option int64 = default, Option int64Negative = default, Option int64NegativeExclusive = default, Option int64Positive = default, Option int64PositiveExclusive = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option @string = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) + { + Byte = @byte; + Date = date; + Number = number; + Password = password; + BinaryOption = binary; + DateTimeOption = dateTime; + DecimalOption = @decimal; + DoubleOption = @double; + FloatOption = @float; + Int32Option = int32; + Int32RangeOption = int32Range; + Int64Option = int64; + Int64NegativeOption = int64Negative; + Int64NegativeExclusiveOption = int64NegativeExclusive; + Int64PositiveOption = int64Positive; + Int64PositiveExclusiveOption = int64PositiveExclusive; + IntegerOption = integer; + PatternWithBackslashOption = patternWithBackslash; + PatternWithDigitsOption = patternWithDigits; + PatternWithDigitsAndDelimiterOption = patternWithDigitsAndDelimiter; + StringOption = @string; + UnsignedIntegerOption = unsignedInteger; + UnsignedLongOption = unsignedLong; + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Byte + /// + [JsonPropertyName("byte")] + public byte[] Byte { get; set; } + + /// + /// Gets or Sets Date + /// + /* Sun Feb 02 00:00:00 UTC 2020 */ + [JsonPropertyName("date")] + public DateOnly Date { get; set; } + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } + + /// + /// Used to track the state of Binary + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BinaryOption { get; private set; } + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream Binary { get { return this.BinaryOption; } set { this.BinaryOption = new(value); } } + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateTimeOption { get; private set; } + + /// + /// Gets or Sets DateTime + /// + /* 2007-12-03T10:15:30+01:00 */ + [JsonPropertyName("dateTime")] + public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new(value); } } + + /// + /// Used to track the state of Decimal + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DecimalOption { get; private set; } + + /// + /// Gets or Sets Decimal + /// + [JsonPropertyName("decimal")] + public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new(value); } } + + /// + /// Used to track the state of Double + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DoubleOption { get; private set; } + + /// + /// Gets or Sets Double + /// + [JsonPropertyName("double")] + public double? Double { get { return this.DoubleOption; } set { this.DoubleOption = new(value); } } + + /// + /// Used to track the state of Float + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FloatOption { get; private set; } + + /// + /// Gets or Sets Float + /// + [JsonPropertyName("float")] + public float? Float { get { return this.FloatOption; } set { this.FloatOption = new(value); } } + + /// + /// Used to track the state of Int32 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int32Option { get; private set; } + + /// + /// Gets or Sets Int32 + /// + [JsonPropertyName("int32")] + public int? Int32 { get { return this.Int32Option; } set { this.Int32Option = new(value); } } + + /// + /// Used to track the state of Int32Range + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int32RangeOption { get; private set; } + + /// + /// Gets or Sets Int32Range + /// + [JsonPropertyName("int32Range")] + public int? Int32Range { get { return this.Int32RangeOption; } set { this.Int32RangeOption = new(value); } } + + /// + /// Used to track the state of Int64 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64Option { get; private set; } + + /// + /// Gets or Sets Int64 + /// + [JsonPropertyName("int64")] + public long? Int64 { get { return this.Int64Option; } set { this.Int64Option = new(value); } } + + /// + /// Used to track the state of Int64Negative + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64NegativeOption { get; private set; } + + /// + /// Gets or Sets Int64Negative + /// + [JsonPropertyName("int64Negative")] + public long? Int64Negative { get { return this.Int64NegativeOption; } set { this.Int64NegativeOption = new(value); } } + + /// + /// Used to track the state of Int64NegativeExclusive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64NegativeExclusiveOption { get; private set; } + + /// + /// Gets or Sets Int64NegativeExclusive + /// + [JsonPropertyName("int64NegativeExclusive")] + public long? Int64NegativeExclusive { get { return this.Int64NegativeExclusiveOption; } set { this.Int64NegativeExclusiveOption = new(value); } } + + /// + /// Used to track the state of Int64Positive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64PositiveOption { get; private set; } + + /// + /// Gets or Sets Int64Positive + /// + [JsonPropertyName("int64Positive")] + public long? Int64Positive { get { return this.Int64PositiveOption; } set { this.Int64PositiveOption = new(value); } } + + /// + /// Used to track the state of Int64PositiveExclusive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64PositiveExclusiveOption { get; private set; } + + /// + /// Gets or Sets Int64PositiveExclusive + /// + [JsonPropertyName("int64PositiveExclusive")] + public long? Int64PositiveExclusive { get { return this.Int64PositiveExclusiveOption; } set { this.Int64PositiveExclusiveOption = new(value); } } + + /// + /// Used to track the state of Integer + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntegerOption { get; private set; } + + /// + /// Gets or Sets Integer + /// + [JsonPropertyName("integer")] + public int? Integer { get { return this.IntegerOption; } set { this.IntegerOption = new(value); } } + + /// + /// Used to track the state of PatternWithBackslash + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithBackslashOption { get; private set; } + + /// + /// None + /// + /// None + [JsonPropertyName("pattern_with_backslash")] + public string PatternWithBackslash { get { return this.PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } + + /// + /// Used to track the state of PatternWithDigits + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithDigitsOption { get; private set; } + + /// + /// A string that is a 10 digit number. Can have leading zeros. + /// + /// A string that is a 10 digit number. Can have leading zeros. + [JsonPropertyName("pattern_with_digits")] + public string PatternWithDigits { get { return this.PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } + + /// + /// Used to track the state of PatternWithDigitsAndDelimiter + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithDigitsAndDelimiterOption { get; private set; } + + /// + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + [JsonPropertyName("pattern_with_digits_and_delimiter")] + public string PatternWithDigitsAndDelimiter { get { return this.PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public string String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Used to track the state of UnsignedInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsignedIntegerOption { get; private set; } + + /// + /// Gets or Sets UnsignedInteger + /// + [JsonPropertyName("unsigned_integer")] + public uint? UnsignedInteger { get { return this.UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } + + /// + /// Used to track the state of UnsignedLong + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsignedLongOption { get; private set; } + + /// + /// Gets or Sets UnsignedLong + /// + [JsonPropertyName("unsigned_long")] + public ulong? UnsignedLong { get { return this.UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FormatTest {\n"); + sb.Append(" Byte: ").Append(Byte).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Decimal: ").Append(Decimal).Append("\n"); + sb.Append(" Double: ").Append(Double).Append("\n"); + sb.Append(" Float: ").Append(Float).Append("\n"); + sb.Append(" Int32: ").Append(Int32).Append("\n"); + sb.Append(" Int32Range: ").Append(Int32Range).Append("\n"); + sb.Append(" Int64: ").Append(Int64).Append("\n"); + sb.Append(" Int64Negative: ").Append(Int64Negative).Append("\n"); + sb.Append(" Int64NegativeExclusive: ").Append(Int64NegativeExclusive).Append("\n"); + sb.Append(" Int64Positive: ").Append(Int64Positive).Append("\n"); + sb.Append(" Int64PositiveExclusive: ").Append(Int64PositiveExclusive).Append("\n"); + sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); + sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); + sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" UnsignedInteger: ").Append(UnsignedInteger).Append("\n"); + sb.Append(" UnsignedLong: ").Append(UnsignedLong).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + // Double (double) maximum + if (this.DoubleOption.IsSet && this.DoubleOption.Value > (double)123.4) + { + yield return new ValidationResult("Invalid value for Double, must be a value less than or equal to 123.4.", new [] { "Double" }); + } + + // Double (double) minimum + if (this.DoubleOption.IsSet && this.DoubleOption.Value < (double)67.8) + { + yield return new ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); + } + + // Float (float) maximum + if (this.FloatOption.IsSet && this.FloatOption.Value > (float)987.6) + { + yield return new ValidationResult("Invalid value for Float, must be a value less than or equal to 987.6.", new [] { "Float" }); + } + + // Float (float) minimum + if (this.FloatOption.IsSet && this.FloatOption.Value < (float)54.3) + { + yield return new ValidationResult("Invalid value for Float, must be a value greater than or equal to 54.3.", new [] { "Float" }); + } + + // Int32 (int) maximum + if (this.Int32Option.IsSet && this.Int32Option.Value > (int)200) + { + yield return new ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); + } + + // Int32 (int) minimum + if (this.Int32Option.IsSet && this.Int32Option.Value < (int)20) + { + yield return new ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); + } + + // Int32Range (int) maximum + if (this.Int32RangeOption.IsSet && this.Int32RangeOption.Value > (int)2147483647) + { + yield return new ValidationResult("Invalid value for Int32Range, must be a value less than or equal to 2147483647.", new [] { "Int32Range" }); + } + + // Int32Range (int) minimum + if (this.Int32RangeOption.IsSet && this.Int32RangeOption.Value < (int)-2147483648) + { + yield return new ValidationResult("Invalid value for Int32Range, must be a value greater than or equal to -2147483648.", new [] { "Int32Range" }); + } + + // Int64Negative (long) maximum + if (this.Int64NegativeOption.IsSet && this.Int64NegativeOption.Value > (long)-2147483649) + { + yield return new ValidationResult("Invalid value for Int64Negative, must be a value less than or equal to -2147483649.", new [] { "Int64Negative" }); + } + + // Int64NegativeExclusive (long) maximum + if (this.Int64NegativeExclusiveOption.IsSet && this.Int64NegativeExclusiveOption.Value <= (long)-2147483648) + { + yield return new ValidationResult("Invalid value for Int64NegativeExclusive, must be a value less than -2147483648.", new [] { "Int64NegativeExclusive" }); + } + + // Int64Positive (long) minimum + if (this.Int64PositiveOption.IsSet && this.Int64PositiveOption.Value < (long)2147483648) + { + yield return new ValidationResult("Invalid value for Int64Positive, must be a value greater than or equal to 2147483648.", new [] { "Int64Positive" }); + } + + // Int64PositiveExclusive (long) minimum + if (this.Int64PositiveExclusiveOption.IsSet && this.Int64PositiveExclusiveOption.Value < (long)2147483647) + { + yield return new ValidationResult("Invalid value for Int64PositiveExclusive, must be a value greater than 2147483647.", new [] { "Int64PositiveExclusive" }); + } + + // Integer (int) maximum + if (this.IntegerOption.IsSet && this.IntegerOption.Value > (int)100) + { + yield return new ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); + } + + // Integer (int) minimum + if (this.IntegerOption.IsSet && this.IntegerOption.Value < (int)10) + { + yield return new ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); + } + + if (this.PatternWithBackslashOption.Value != null) { + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + + if (this.PatternWithBackslashOption.Value != null &&!regexPatternWithBackslash.Match(this.PatternWithBackslashOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } + } + + if (this.PatternWithDigitsOption.Value != null) { + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + + if (this.PatternWithDigitsOption.Value != null &&!regexPatternWithDigits.Match(this.PatternWithDigitsOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } + } + + if (this.PatternWithDigitsAndDelimiterOption.Value != null) { + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.PatternWithDigitsAndDelimiterOption.Value != null &&!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiterOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } + } + + if (this.StringOption.Value != null) { + // String (string) pattern + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.StringOption.Value != null &&!regexString.Match(this.StringOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); + } + } + + // UnsignedInteger (uint) maximum + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value > (uint)200) + { + yield return new ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); + } + + // UnsignedInteger (uint) minimum + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value < (uint)20) + { + yield return new ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); + } + + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FormatTestJsonConverter : JsonConverter + { + /// + /// The format to use to serialize Date + /// + public static string DateFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize DateTime + /// + public static string DateTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int32Range = default; + Option int64 = default; + Option int64Negative = default; + Option int64NegativeExclusive = default; + Option int64Positive = default; + Option int64PositiveExclusive = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "byte": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "date": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + number = new Option(utf8JsonReader.GetDecimal()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "dateTime": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "decimal": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "double": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varDouble = new Option(utf8JsonReader.GetDouble()); + break; + case "float": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varFloat = new Option((float)utf8JsonReader.GetDouble()); + break; + case "int32": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int32 = new Option(utf8JsonReader.GetInt32()); + break; + case "int32Range": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int32Range = new Option(utf8JsonReader.GetInt32()); + break; + case "int64": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64 = new Option(utf8JsonReader.GetInt64()); + break; + case "int64Negative": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64Negative = new Option(utf8JsonReader.GetInt32()); + break; + case "int64NegativeExclusive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + break; + case "int64Positive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64Positive = new Option(utf8JsonReader.GetInt32()); + break; + case "int64PositiveExclusive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + break; + case "integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + integer = new Option(utf8JsonReader.GetInt32()); + break; + case "pattern_with_backslash": + patternWithBackslash = new Option(utf8JsonReader.GetString()); + break; + case "pattern_with_digits": + patternWithDigits = new Option(utf8JsonReader.GetString()); + break; + case "pattern_with_digits_and_delimiter": + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()); + break; + case "string": + varString = new Option(utf8JsonReader.GetString()); + break; + case "unsigned_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + break; + case "unsigned_long": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + unsignedLong = new Option(utf8JsonReader.GetUInt64()); + break; + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!varByte.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); + + if (!date.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); + + if (!number.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); + + if (!password.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); + + if (varByte.IsSet && varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); + + if (date.IsSet && date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); + + if (number.IsSet && number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); + + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); + + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); + + if (varDecimal.IsSet && varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + + if (varDouble.IsSet && varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + + if (varFloat.IsSet && varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + + if (int32.IsSet && int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + + if (int32Range.IsSet && int32Range.Value == null) + throw new ArgumentNullException(nameof(int32Range), "Property is not nullable for class FormatTest."); + + if (int64.IsSet && int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + + if (int64Negative.IsSet && int64Negative.Value == null) + throw new ArgumentNullException(nameof(int64Negative), "Property is not nullable for class FormatTest."); + + if (int64NegativeExclusive.IsSet && int64NegativeExclusive.Value == null) + throw new ArgumentNullException(nameof(int64NegativeExclusive), "Property is not nullable for class FormatTest."); + + if (int64Positive.IsSet && int64Positive.Value == null) + throw new ArgumentNullException(nameof(int64Positive), "Property is not nullable for class FormatTest."); + + if (int64PositiveExclusive.IsSet && int64PositiveExclusive.Value == null) + throw new ArgumentNullException(nameof(int64PositiveExclusive), "Property is not nullable for class FormatTest."); + + if (integer.IsSet && integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + + if (patternWithBackslash.IsSet && patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); + + if (patternWithDigits.IsSet && patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); + + if (patternWithDigitsAndDelimiter.IsSet && patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + + if (unsignedInteger.IsSet && unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + + if (unsignedLong.IsSet && unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + + return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, binary, dateTime, varDecimal, varDouble, varFloat, int32, int32Range, int64, int64Negative, int64NegativeExclusive, int64Positive, int64PositiveExclusive, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, formatTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) + { + if (formatTest.Byte == null) + throw new ArgumentNullException(nameof(formatTest.Byte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.StringOption.IsSet && formatTest.String == null) + throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + + writer.WritePropertyName("byte"); + JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + + writer.WriteNumber("number", formatTest.Number); + + writer.WriteString("password", formatTest.Password); + + if (formatTest.BinaryOption.IsSet) + { + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + } + if (formatTest.DateTimeOption.IsSet) + writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); + + if (formatTest.DecimalOption.IsSet) + { + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.Decimal, jsonSerializerOptions); + } + if (formatTest.DoubleOption.IsSet) + writer.WriteNumber("double", formatTest.DoubleOption.Value.Value); + + if (formatTest.FloatOption.IsSet) + writer.WriteNumber("float", formatTest.FloatOption.Value.Value); + + if (formatTest.Int32Option.IsSet) + writer.WriteNumber("int32", formatTest.Int32Option.Value.Value); + + if (formatTest.Int32RangeOption.IsSet) + writer.WriteNumber("int32Range", formatTest.Int32RangeOption.Value.Value); + + if (formatTest.Int64Option.IsSet) + writer.WriteNumber("int64", formatTest.Int64Option.Value.Value); + + if (formatTest.Int64NegativeOption.IsSet) + writer.WriteNumber("int64Negative", formatTest.Int64NegativeOption.Value.Value); + + if (formatTest.Int64NegativeExclusiveOption.IsSet) + writer.WriteNumber("int64NegativeExclusive", formatTest.Int64NegativeExclusiveOption.Value.Value); + + if (formatTest.Int64PositiveOption.IsSet) + writer.WriteNumber("int64Positive", formatTest.Int64PositiveOption.Value.Value); + + if (formatTest.Int64PositiveExclusiveOption.IsSet) + writer.WriteNumber("int64PositiveExclusive", formatTest.Int64PositiveExclusiveOption.Value.Value); + + if (formatTest.IntegerOption.IsSet) + writer.WriteNumber("integer", formatTest.IntegerOption.Value.Value); + + if (formatTest.PatternWithBackslashOption.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); + + if (formatTest.PatternWithDigitsOption.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); + + if (formatTest.StringOption.IsSet) + writer.WriteString("string", formatTest.String); + + if (formatTest.UnsignedIntegerOption.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value.Value); + + if (formatTest.UnsignedLongOption.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value.Value); + + if (formatTest.UuidOption.IsSet) + writer.WriteString("uuid", formatTest.UuidOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Fruit.cs new file mode 100644 index 000000000000..1b74f3034c82 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Fruit.cs @@ -0,0 +1,218 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Fruit + /// + public partial class Fruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Apple apple, Option color = default) + { + Apple = apple; + ColorOption = color; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Banana banana, Option color = default) + { + Banana = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Apple + /// + public Apple Apple { get; set; } + + /// + /// Gets or Sets Banana + /// + public Banana Banana { get; set; } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Fruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple apple = default; + Banana banana = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + if (apple != null) + return new Fruit(apple, color); + + if (banana != null) + return new Fruit(banana, color); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FruitReq.cs new file mode 100644 index 000000000000..1e72875d4d32 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/FruitReq.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FruitReq + /// + public partial class FruitReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public FruitReq(AppleReq appleReq) + { + AppleReq = appleReq; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FruitReq(BananaReq bananaReq) + { + BananaReq = bananaReq; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets AppleReq + /// + public AppleReq AppleReq { get; set; } + + /// + /// Gets or Sets BananaReq + /// + public BananaReq BananaReq { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FruitReq {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + AppleReq appleReq = default; + BananaReq bananaReq = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderAppleReq = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderAppleReq, jsonSerializerOptions, out appleReq); + + Utf8JsonReader utf8JsonReaderBananaReq = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBananaReq, jsonSerializerOptions, out bananaReq); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (appleReq != null) + return new FruitReq(appleReq); + + if (bananaReq != null) + return new FruitReq(bananaReq); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fruitReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs new file mode 100644 index 000000000000..d5f9d222bc04 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs @@ -0,0 +1,235 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// GmFruit + /// + public partial class GmFruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// color + public GmFruit(Option apple, Option banana, Option color = default) + { + AppleOption = apple; + BananaOption = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AppleOption { get; private set; } + + /// + /// Gets or Sets Apple + /// + public Apple Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BananaOption { get; private set; } + + /// + /// Gets or Sets Banana + /// + public Banana Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GmFruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class GmFruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple apple = default; + Banana banana = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); + + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null) + { + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(writer, gmFruit.AppleOption.Value, jsonSerializerOptions); + } + + if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null) + { + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(writer, gmFruit.BananaOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, gmFruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) + { + if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + + if (gmFruit.ColorOption.IsSet) + writer.WriteString("color", gmFruit.Color); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GrandparentAnimal.cs new file mode 100644 index 000000000000..b23e4826fd6b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -0,0 +1,192 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// GrandparentAnimal + /// + public partial class GrandparentAnimal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructor] + public GrandparentAnimal() + { + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public string PetType { get; } = "GrandparentAnimal"; + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GrandparentAnimal {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class GrandparentAnimalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option petType = default; + + string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type"); + + if (discriminator != null && discriminator.Equals("ChildCat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + if (discriminator != null && discriminator.Equals("ParentPet")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pet_type": + petType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + return new GrandparentAnimal(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) + { + if (grandparentAnimal is ChildCat childCat){ + JsonSerializer.Serialize(writer, childCat, jsonSerializerOptions); + return; + } + + if (grandparentAnimal is ParentPet parentPet){ + JsonSerializer.Serialize(writer, parentPet, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, grandparentAnimal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("pet_type", grandparentAnimal.PetType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs new file mode 100644 index 000000000000..a4e67f73a8e5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -0,0 +1,244 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// HasOnlyReadOnly + /// + public partial class HasOnlyReadOnly : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar + /// foo + [JsonConstructor] + internal HasOnlyReadOnly(Option bar = default, Option foo = default) + { + BarOption = bar; + FooOption = foo; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string Bar { get { return this.BarOption; } } + + /// + /// Used to track the state of Foo + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FooOption { get; } + + /// + /// Gets or Sets Foo + /// + [JsonPropertyName("foo")] + public string Foo { get { return this.FooOption; } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HasOnlyReadOnly {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Foo: ").Append(Foo).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as HasOnlyReadOnly).AreEqual; + } + + /// + /// Returns true if HasOnlyReadOnly instances are equal + /// + /// Instance of HasOnlyReadOnly to be compared + /// Boolean + public bool Equals(HasOnlyReadOnly input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + if (Foo != null) + hashCode = (hashCode * 59) + Foo.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class HasOnlyReadOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + Option foo = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()); + break; + case "foo": + foo = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); + + if (foo.IsSet && foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); + + return new HasOnlyReadOnly(bar, foo); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, hasOnlyReadOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.BarOption.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar); + + if (hasOnlyReadOnly.FooOption.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HealthCheckResult.cs new file mode 100644 index 000000000000..4b7b17d3f58a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -0,0 +1,171 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + /// + public partial class HealthCheckResult : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// nullableMessage + [JsonConstructor] + public HealthCheckResult(Option nullableMessage = default) + { + NullableMessageOption = nullableMessage; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of NullableMessage + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NullableMessageOption { get; private set; } + + /// + /// Gets or Sets NullableMessage + /// + [JsonPropertyName("NullableMessage")] + public string NullableMessage { get { return this.NullableMessageOption; } set { this.NullableMessageOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HealthCheckResult {\n"); + sb.Append(" NullableMessage: ").Append(NullableMessage).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class HealthCheckResultJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option nullableMessage = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "NullableMessage": + nullableMessage = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + return new HealthCheckResult(nullableMessage); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, healthCheckResult, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) + { + if (healthCheckResult.NullableMessageOption.IsSet) + if (healthCheckResult.NullableMessageOption.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + else + writer.WriteNull("NullableMessage"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs new file mode 100644 index 000000000000..cce859524111 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -0,0 +1,186 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// IsoscelesTriangle + /// + public partial class IsoscelesTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public IsoscelesTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IsoscelesTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class IsoscelesTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + return new IsoscelesTriangle(shapeType.Value, triangleType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, isoscelesTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/List.cs new file mode 100644 index 000000000000..8880c4c197e5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/List.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// List + /// + public partial class List : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// var123List + [JsonConstructor] + public List(Option var123List = default) + { + Var123ListOption = var123List; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Var123List + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Var123ListOption { get; private set; } + + /// + /// Gets or Sets Var123List + /// + [JsonPropertyName("123-list")] + public string Var123List { get { return this.Var123ListOption; } set { this.Var123ListOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class List {\n"); + sb.Append(" Var123List: ").Append(Var123List).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ListJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option var123List = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "123-list": + var123List = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (var123List.IsSet && var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); + + return new List(var123List); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, list, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) + { + if (list.Var123ListOption.IsSet && list.Var123List == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + + if (list.Var123ListOption.IsSet) + writer.WriteString("123-list", list.Var123List); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 000000000000..4c97ce2b0066 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + public partial class LiteralStringClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username") + /// unescapedLiteralString (default to "C:\Users\username") + [JsonConstructor] + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) + { + EscapedLiteralStringOption = escapedLiteralString; + UnescapedLiteralStringOption = unescapedLiteralString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of EscapedLiteralString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EscapedLiteralStringOption { get; private set; } + + /// + /// Gets or Sets EscapedLiteralString + /// + [JsonPropertyName("escapedLiteralString")] + public string EscapedLiteralString { get { return this.EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } + + /// + /// Used to track the state of UnescapedLiteralString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnescapedLiteralStringOption { get; private set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [JsonPropertyName("unescapedLiteralString")] + public string UnescapedLiteralString { get { return this.UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class LiteralStringClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option escapedLiteralString = default; + Option unescapedLiteralString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "escapedLiteralString": + escapedLiteralString = new Option(utf8JsonReader.GetString()); + break; + case "unescapedLiteralString": + unescapedLiteralString = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (escapedLiteralString.IsSet && escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, literalStringClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.EscapedLiteralStringOption.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Mammal.cs new file mode 100644 index 000000000000..267ac8769d31 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Mammal.cs @@ -0,0 +1,269 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mammal + /// + public partial class Mammal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Whale whale) + { + Whale = whale; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Zebra zebra) + { + Zebra = zebra; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Pig pig) + { + Pig = pig; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Whale + /// + public Whale Whale { get; set; } + + /// + /// Gets or Sets Zebra + /// + public Zebra Zebra { get; set; } + + /// + /// Gets or Sets Pig + /// + public Pig Pig { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Mammal {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MammalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + Pig pig = null; + Whale whale = null; + Zebra zebra = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("className")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("Pig")) + { + Utf8JsonReader utf8JsonReaderPig = utf8JsonReader; + pig = JsonSerializer.Deserialize(ref utf8JsonReaderPig, jsonSerializerOptions); + } + if (discriminator.Equals("whale")) + { + Utf8JsonReader utf8JsonReaderWhale = utf8JsonReader; + whale = JsonSerializer.Deserialize(ref utf8JsonReaderWhale, jsonSerializerOptions); + } + if (discriminator.Equals("zebra")) + { + Utf8JsonReader utf8JsonReaderZebra = utf8JsonReader; + zebra = JsonSerializer.Deserialize(ref utf8JsonReaderZebra, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); + + if (pig != null) + return new Mammal(pig); + + if (whale != null) + return new Mammal(whale); + + if (zebra != null) + return new Mammal(zebra); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (mammal.Whale != null) + { + WhaleJsonConverter whaleJsonConverter = (WhaleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Whale.GetType())); + whaleJsonConverter.WriteProperties(writer, mammal.Whale, jsonSerializerOptions); + } + + if (mammal.Zebra != null) + { + ZebraJsonConverter zebraJsonConverter = (ZebraJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Zebra.GetType())); + zebraJsonConverter.WriteProperties(writer, mammal.Zebra, jsonSerializerOptions); + } + + if (mammal.Pig != null) + { + PigJsonConverter pigJsonConverter = (PigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Pig.GetType())); + pigJsonConverter.WriteProperties(writer, mammal.Pig, jsonSerializerOptions); + } + + WriteProperties(writer, mammal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs new file mode 100644 index 000000000000..938d01fec443 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MapTest.cs @@ -0,0 +1,340 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MapTest + /// + public partial class MapTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// directMap + /// indirectMap + /// mapMapOfString + /// mapOfEnumString + [JsonConstructor] + public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) + { + DirectMapOption = directMap; + IndirectMapOption = indirectMap; + MapMapOfStringOption = mapMapOfString; + MapOfEnumStringOption = mapOfEnumString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines Inner + /// + public enum InnerEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static InnerEnum InnerEnumFromString(string value) + { + if (value.Equals("UPPER")) + return InnerEnum.UPPER; + + if (value.Equals("lower")) + return InnerEnum.Lower; + + throw new NotImplementedException($"Could not convert value to type InnerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static InnerEnum? InnerEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return InnerEnum.UPPER; + + if (value.Equals("lower")) + return InnerEnum.Lower; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string InnerEnumToJsonValue(InnerEnum value) + { + if (value == InnerEnum.UPPER) + return "UPPER"; + + if (value == InnerEnum.Lower) + return "lower"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of DirectMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> DirectMapOption { get; private set; } + + /// + /// Gets or Sets DirectMap + /// + [JsonPropertyName("direct_map")] + public Dictionary DirectMap { get { return this.DirectMapOption; } set { this.DirectMapOption = new(value); } } + + /// + /// Used to track the state of IndirectMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> IndirectMapOption { get; private set; } + + /// + /// Gets or Sets IndirectMap + /// + [JsonPropertyName("indirect_map")] + public Dictionary IndirectMap { get { return this.IndirectMapOption; } set { this.IndirectMapOption = new(value); } } + + /// + /// Used to track the state of MapMapOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>> MapMapOfStringOption { get; private set; } + + /// + /// Gets or Sets MapMapOfString + /// + [JsonPropertyName("map_map_of_string")] + public Dictionary> MapMapOfString { get { return this.MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } + + /// + /// Used to track the state of MapOfEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapOfEnumStringOption { get; private set; } + + /// + /// Gets or Sets MapOfEnumString + /// + [JsonPropertyName("map_of_enum_string")] + public Dictionary MapOfEnumString { get { return this.MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MapTest {\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); + sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); + sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MapTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> directMap = default; + Option> indirectMap = default; + Option>> mapMapOfString = default; + Option> mapOfEnumString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "direct_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "indirect_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_map_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapMapOfString = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map_of_enum_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (directMap.IsSet && directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); + + if (indirectMap.IsSet && indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); + + if (mapMapOfString.IsSet && mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); + + if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); + + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mapTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) + { + if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + + if (mapTest.DirectMapOption.IsSet) + { + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + } + if (mapTest.IndirectMapOption.IsSet) + { + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + } + if (mapTest.MapMapOfStringOption.IsSet) + { + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + } + if (mapTest.MapOfEnumStringOption.IsSet) + { + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixLog.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixLog.cs new file mode 100644 index 000000000000..defed9c5c7c8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixLog.cs @@ -0,0 +1,1027 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixLog + /// + public partial class MixLog : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// description + /// formulaVersionDate + /// id + /// mixDate + /// totalOverPoors + /// totalRecalculations + /// totalSkips + /// totalUnderPours + /// batchNumber + /// BrandCode is only required for non-color mixes + /// BrandId is only required for color mixes + /// BrandName is only required for color mixes + /// CategoryCode is not used anymore + /// Color is only required for color mixes + /// colorDescription + /// comment + /// commercialProductCode + /// country + /// createdBy + /// createdByFirstName + /// createdByLastName + /// deltaECalculationRepaired + /// deltaECalculationSprayout + /// ownColorVariantNumber + /// primerProductId + /// ProductId is only required for color mixes + /// ProductLineCode is only required for color mixes + /// ProductName is only required for color mixes + /// selectedVersionIndex + /// shopId + /// SomeCode is only required for color mixes + /// totalPrice + [JsonConstructor] + public MixLog(string description, DateTime formulaVersionDate, Guid id, DateTime mixDate, int totalOverPoors, int totalRecalculations, int totalSkips, int totalUnderPours, Option batchNumber = default, Option brandCode = default, Option brandId = default, Option brandName = default, Option categoryCode = default, Option color = default, Option colorDescription = default, Option comment = default, Option commercialProductCode = default, Option country = default, Option createdBy = default, Option createdByFirstName = default, Option createdByLastName = default, Option deltaECalculationRepaired = default, Option deltaECalculationSprayout = default, Option ownColorVariantNumber = default, Option primerProductId = default, Option productId = default, Option productLineCode = default, Option productName = default, Option selectedVersionIndex = default, Option shopId = default, Option someCode = default, Option totalPrice = default) + { + Description = description; + FormulaVersionDate = formulaVersionDate; + Id = id; + MixDate = mixDate; + TotalOverPoors = totalOverPoors; + TotalRecalculations = totalRecalculations; + TotalSkips = totalSkips; + TotalUnderPours = totalUnderPours; + BatchNumberOption = batchNumber; + BrandCodeOption = brandCode; + BrandIdOption = brandId; + BrandNameOption = brandName; + CategoryCodeOption = categoryCode; + ColorOption = color; + ColorDescriptionOption = colorDescription; + CommentOption = comment; + CommercialProductCodeOption = commercialProductCode; + CountryOption = country; + CreatedByOption = createdBy; + CreatedByFirstNameOption = createdByFirstName; + CreatedByLastNameOption = createdByLastName; + DeltaECalculationRepairedOption = deltaECalculationRepaired; + DeltaECalculationSprayoutOption = deltaECalculationSprayout; + OwnColorVariantNumberOption = ownColorVariantNumber; + PrimerProductIdOption = primerProductId; + ProductIdOption = productId; + ProductLineCodeOption = productLineCode; + ProductNameOption = productName; + SelectedVersionIndexOption = selectedVersionIndex; + ShopIdOption = shopId; + SomeCodeOption = someCode; + TotalPriceOption = totalPrice; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Description + /// + [JsonPropertyName("description")] + public string Description { get; set; } + + /// + /// Gets or Sets FormulaVersionDate + /// + [JsonPropertyName("formulaVersionDate")] + public DateTime FormulaVersionDate { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Guid Id { get; set; } + + /// + /// Gets or Sets MixDate + /// + [JsonPropertyName("mixDate")] + public DateTime MixDate { get; set; } + + /// + /// Gets or Sets TotalOverPoors + /// + [JsonPropertyName("totalOverPoors")] + public int TotalOverPoors { get; set; } + + /// + /// Gets or Sets TotalRecalculations + /// + [JsonPropertyName("totalRecalculations")] + public int TotalRecalculations { get; set; } + + /// + /// Gets or Sets TotalSkips + /// + [JsonPropertyName("totalSkips")] + public int TotalSkips { get; set; } + + /// + /// Gets or Sets TotalUnderPours + /// + [JsonPropertyName("totalUnderPours")] + public int TotalUnderPours { get; set; } + + /// + /// Used to track the state of BatchNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BatchNumberOption { get; private set; } + + /// + /// Gets or Sets BatchNumber + /// + [JsonPropertyName("batchNumber")] + public string BatchNumber { get { return this.BatchNumberOption; } set { this.BatchNumberOption = new(value); } } + + /// + /// Used to track the state of BrandCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandCodeOption { get; private set; } + + /// + /// BrandCode is only required for non-color mixes + /// + /// BrandCode is only required for non-color mixes + [JsonPropertyName("brandCode")] + public string BrandCode { get { return this.BrandCodeOption; } set { this.BrandCodeOption = new(value); } } + + /// + /// Used to track the state of BrandId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandIdOption { get; private set; } + + /// + /// BrandId is only required for color mixes + /// + /// BrandId is only required for color mixes + [JsonPropertyName("brandId")] + public string BrandId { get { return this.BrandIdOption; } set { this.BrandIdOption = new(value); } } + + /// + /// Used to track the state of BrandName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandNameOption { get; private set; } + + /// + /// BrandName is only required for color mixes + /// + /// BrandName is only required for color mixes + [JsonPropertyName("brandName")] + public string BrandName { get { return this.BrandNameOption; } set { this.BrandNameOption = new(value); } } + + /// + /// Used to track the state of CategoryCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CategoryCodeOption { get; private set; } + + /// + /// CategoryCode is not used anymore + /// + /// CategoryCode is not used anymore + [JsonPropertyName("categoryCode")] + public string CategoryCode { get { return this.CategoryCodeOption; } set { this.CategoryCodeOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Color is only required for color mixes + /// + /// Color is only required for color mixes + [JsonPropertyName("color")] + public string Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Used to track the state of ColorDescription + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorDescriptionOption { get; private set; } + + /// + /// Gets or Sets ColorDescription + /// + [JsonPropertyName("colorDescription")] + public string ColorDescription { get { return this.ColorDescriptionOption; } set { this.ColorDescriptionOption = new(value); } } + + /// + /// Used to track the state of Comment + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CommentOption { get; private set; } + + /// + /// Gets or Sets Comment + /// + [JsonPropertyName("comment")] + public string Comment { get { return this.CommentOption; } set { this.CommentOption = new(value); } } + + /// + /// Used to track the state of CommercialProductCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CommercialProductCodeOption { get; private set; } + + /// + /// Gets or Sets CommercialProductCode + /// + [JsonPropertyName("commercialProductCode")] + public string CommercialProductCode { get { return this.CommercialProductCodeOption; } set { this.CommercialProductCodeOption = new(value); } } + + /// + /// Used to track the state of Country + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CountryOption { get; private set; } + + /// + /// Gets or Sets Country + /// + [JsonPropertyName("country")] + public string Country { get { return this.CountryOption; } set { this.CountryOption = new(value); } } + + /// + /// Used to track the state of CreatedBy + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByOption { get; private set; } + + /// + /// Gets or Sets CreatedBy + /// + [JsonPropertyName("createdBy")] + public string CreatedBy { get { return this.CreatedByOption; } set { this.CreatedByOption = new(value); } } + + /// + /// Used to track the state of CreatedByFirstName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByFirstNameOption { get; private set; } + + /// + /// Gets or Sets CreatedByFirstName + /// + [JsonPropertyName("createdByFirstName")] + public string CreatedByFirstName { get { return this.CreatedByFirstNameOption; } set { this.CreatedByFirstNameOption = new(value); } } + + /// + /// Used to track the state of CreatedByLastName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByLastNameOption { get; private set; } + + /// + /// Gets or Sets CreatedByLastName + /// + [JsonPropertyName("createdByLastName")] + public string CreatedByLastName { get { return this.CreatedByLastNameOption; } set { this.CreatedByLastNameOption = new(value); } } + + /// + /// Used to track the state of DeltaECalculationRepaired + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeltaECalculationRepairedOption { get; private set; } + + /// + /// Gets or Sets DeltaECalculationRepaired + /// + [JsonPropertyName("deltaECalculationRepaired")] + public string DeltaECalculationRepaired { get { return this.DeltaECalculationRepairedOption; } set { this.DeltaECalculationRepairedOption = new(value); } } + + /// + /// Used to track the state of DeltaECalculationSprayout + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeltaECalculationSprayoutOption { get; private set; } + + /// + /// Gets or Sets DeltaECalculationSprayout + /// + [JsonPropertyName("deltaECalculationSprayout")] + public string DeltaECalculationSprayout { get { return this.DeltaECalculationSprayoutOption; } set { this.DeltaECalculationSprayoutOption = new(value); } } + + /// + /// Used to track the state of OwnColorVariantNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OwnColorVariantNumberOption { get; private set; } + + /// + /// Gets or Sets OwnColorVariantNumber + /// + [JsonPropertyName("ownColorVariantNumber")] + public int? OwnColorVariantNumber { get { return this.OwnColorVariantNumberOption; } set { this.OwnColorVariantNumberOption = new(value); } } + + /// + /// Used to track the state of PrimerProductId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PrimerProductIdOption { get; private set; } + + /// + /// Gets or Sets PrimerProductId + /// + [JsonPropertyName("primerProductId")] + public string PrimerProductId { get { return this.PrimerProductIdOption; } set { this.PrimerProductIdOption = new(value); } } + + /// + /// Used to track the state of ProductId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductIdOption { get; private set; } + + /// + /// ProductId is only required for color mixes + /// + /// ProductId is only required for color mixes + [JsonPropertyName("productId")] + public string ProductId { get { return this.ProductIdOption; } set { this.ProductIdOption = new(value); } } + + /// + /// Used to track the state of ProductLineCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductLineCodeOption { get; private set; } + + /// + /// ProductLineCode is only required for color mixes + /// + /// ProductLineCode is only required for color mixes + [JsonPropertyName("productLineCode")] + public string ProductLineCode { get { return this.ProductLineCodeOption; } set { this.ProductLineCodeOption = new(value); } } + + /// + /// Used to track the state of ProductName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductNameOption { get; private set; } + + /// + /// ProductName is only required for color mixes + /// + /// ProductName is only required for color mixes + [JsonPropertyName("productName")] + public string ProductName { get { return this.ProductNameOption; } set { this.ProductNameOption = new(value); } } + + /// + /// Used to track the state of SelectedVersionIndex + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SelectedVersionIndexOption { get; private set; } + + /// + /// Gets or Sets SelectedVersionIndex + /// + [JsonPropertyName("selectedVersionIndex")] + public int? SelectedVersionIndex { get { return this.SelectedVersionIndexOption; } set { this.SelectedVersionIndexOption = new(value); } } + + /// + /// Used to track the state of ShopId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShopIdOption { get; private set; } + + /// + /// Gets or Sets ShopId + /// + [JsonPropertyName("shopId")] + public Guid? ShopId { get { return this.ShopIdOption; } set { this.ShopIdOption = new(value); } } + + /// + /// Used to track the state of SomeCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SomeCodeOption { get; private set; } + + /// + /// SomeCode is only required for color mixes + /// + /// SomeCode is only required for color mixes + [JsonPropertyName("someCode")] + public string SomeCode { get { return this.SomeCodeOption; } set { this.SomeCodeOption = new(value); } } + + /// + /// Used to track the state of TotalPrice + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TotalPriceOption { get; private set; } + + /// + /// Gets or Sets TotalPrice + /// + [JsonPropertyName("totalPrice")] + public float? TotalPrice { get { return this.TotalPriceOption; } set { this.TotalPriceOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixLog {\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" FormulaVersionDate: ").Append(FormulaVersionDate).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" MixDate: ").Append(MixDate).Append("\n"); + sb.Append(" TotalOverPoors: ").Append(TotalOverPoors).Append("\n"); + sb.Append(" TotalRecalculations: ").Append(TotalRecalculations).Append("\n"); + sb.Append(" TotalSkips: ").Append(TotalSkips).Append("\n"); + sb.Append(" TotalUnderPours: ").Append(TotalUnderPours).Append("\n"); + sb.Append(" BatchNumber: ").Append(BatchNumber).Append("\n"); + sb.Append(" BrandCode: ").Append(BrandCode).Append("\n"); + sb.Append(" BrandId: ").Append(BrandId).Append("\n"); + sb.Append(" BrandName: ").Append(BrandName).Append("\n"); + sb.Append(" CategoryCode: ").Append(CategoryCode).Append("\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" ColorDescription: ").Append(ColorDescription).Append("\n"); + sb.Append(" Comment: ").Append(Comment).Append("\n"); + sb.Append(" CommercialProductCode: ").Append(CommercialProductCode).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append(" CreatedBy: ").Append(CreatedBy).Append("\n"); + sb.Append(" CreatedByFirstName: ").Append(CreatedByFirstName).Append("\n"); + sb.Append(" CreatedByLastName: ").Append(CreatedByLastName).Append("\n"); + sb.Append(" DeltaECalculationRepaired: ").Append(DeltaECalculationRepaired).Append("\n"); + sb.Append(" DeltaECalculationSprayout: ").Append(DeltaECalculationSprayout).Append("\n"); + sb.Append(" OwnColorVariantNumber: ").Append(OwnColorVariantNumber).Append("\n"); + sb.Append(" PrimerProductId: ").Append(PrimerProductId).Append("\n"); + sb.Append(" ProductId: ").Append(ProductId).Append("\n"); + sb.Append(" ProductLineCode: ").Append(ProductLineCode).Append("\n"); + sb.Append(" ProductName: ").Append(ProductName).Append("\n"); + sb.Append(" SelectedVersionIndex: ").Append(SelectedVersionIndex).Append("\n"); + sb.Append(" ShopId: ").Append(ShopId).Append("\n"); + sb.Append(" SomeCode: ").Append(SomeCode).Append("\n"); + sb.Append(" TotalPrice: ").Append(TotalPrice).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixLogJsonConverter : JsonConverter + { + /// + /// The format to use to serialize FormulaVersionDate + /// + public static string FormulaVersionDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize MixDate + /// + public static string MixDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixLog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option description = default; + Option formulaVersionDate = default; + Option id = default; + Option mixDate = default; + Option totalOverPoors = default; + Option totalRecalculations = default; + Option totalSkips = default; + Option totalUnderPours = default; + Option batchNumber = default; + Option brandCode = default; + Option brandId = default; + Option brandName = default; + Option categoryCode = default; + Option color = default; + Option colorDescription = default; + Option comment = default; + Option commercialProductCode = default; + Option country = default; + Option createdBy = default; + Option createdByFirstName = default; + Option createdByLastName = default; + Option deltaECalculationRepaired = default; + Option deltaECalculationSprayout = default; + Option ownColorVariantNumber = default; + Option primerProductId = default; + Option productId = default; + Option productLineCode = default; + Option productName = default; + Option selectedVersionIndex = default; + Option shopId = default; + Option someCode = default; + Option totalPrice = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "description": + description = new Option(utf8JsonReader.GetString()); + break; + case "formulaVersionDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + formulaVersionDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetGuid()); + break; + case "mixDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mixDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "totalOverPoors": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalOverPoors = new Option(utf8JsonReader.GetInt32()); + break; + case "totalRecalculations": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalRecalculations = new Option(utf8JsonReader.GetInt32()); + break; + case "totalSkips": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalSkips = new Option(utf8JsonReader.GetInt32()); + break; + case "totalUnderPours": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalUnderPours = new Option(utf8JsonReader.GetInt32()); + break; + case "batchNumber": + batchNumber = new Option(utf8JsonReader.GetString()); + break; + case "brandCode": + brandCode = new Option(utf8JsonReader.GetString()); + break; + case "brandId": + brandId = new Option(utf8JsonReader.GetString()); + break; + case "brandName": + brandName = new Option(utf8JsonReader.GetString()); + break; + case "categoryCode": + categoryCode = new Option(utf8JsonReader.GetString()); + break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; + case "colorDescription": + colorDescription = new Option(utf8JsonReader.GetString()); + break; + case "comment": + comment = new Option(utf8JsonReader.GetString()); + break; + case "commercialProductCode": + commercialProductCode = new Option(utf8JsonReader.GetString()); + break; + case "country": + country = new Option(utf8JsonReader.GetString()); + break; + case "createdBy": + createdBy = new Option(utf8JsonReader.GetString()); + break; + case "createdByFirstName": + createdByFirstName = new Option(utf8JsonReader.GetString()); + break; + case "createdByLastName": + createdByLastName = new Option(utf8JsonReader.GetString()); + break; + case "deltaECalculationRepaired": + deltaECalculationRepaired = new Option(utf8JsonReader.GetString()); + break; + case "deltaECalculationSprayout": + deltaECalculationSprayout = new Option(utf8JsonReader.GetString()); + break; + case "ownColorVariantNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + ownColorVariantNumber = new Option(utf8JsonReader.GetInt32()); + break; + case "primerProductId": + primerProductId = new Option(utf8JsonReader.GetString()); + break; + case "productId": + productId = new Option(utf8JsonReader.GetString()); + break; + case "productLineCode": + productLineCode = new Option(utf8JsonReader.GetString()); + break; + case "productName": + productName = new Option(utf8JsonReader.GetString()); + break; + case "selectedVersionIndex": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + selectedVersionIndex = new Option(utf8JsonReader.GetInt32()); + break; + case "shopId": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shopId = new Option(utf8JsonReader.GetGuid()); + break; + case "someCode": + someCode = new Option(utf8JsonReader.GetString()); + break; + case "totalPrice": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalPrice = new Option((float)utf8JsonReader.GetDouble()); + break; + default: + break; + } + } + } + + if (!description.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(description)); + + if (!formulaVersionDate.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(formulaVersionDate)); + + if (!id.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(id)); + + if (!mixDate.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(mixDate)); + + if (!totalOverPoors.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalOverPoors)); + + if (!totalRecalculations.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalRecalculations)); + + if (!totalSkips.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalSkips)); + + if (!totalUnderPours.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalUnderPours)); + + if (description.IsSet && description.Value == null) + throw new ArgumentNullException(nameof(description), "Property is not nullable for class MixLog."); + + if (formulaVersionDate.IsSet && formulaVersionDate.Value == null) + throw new ArgumentNullException(nameof(formulaVersionDate), "Property is not nullable for class MixLog."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixLog."); + + if (mixDate.IsSet && mixDate.Value == null) + throw new ArgumentNullException(nameof(mixDate), "Property is not nullable for class MixLog."); + + if (totalOverPoors.IsSet && totalOverPoors.Value == null) + throw new ArgumentNullException(nameof(totalOverPoors), "Property is not nullable for class MixLog."); + + if (totalRecalculations.IsSet && totalRecalculations.Value == null) + throw new ArgumentNullException(nameof(totalRecalculations), "Property is not nullable for class MixLog."); + + if (totalSkips.IsSet && totalSkips.Value == null) + throw new ArgumentNullException(nameof(totalSkips), "Property is not nullable for class MixLog."); + + if (totalUnderPours.IsSet && totalUnderPours.Value == null) + throw new ArgumentNullException(nameof(totalUnderPours), "Property is not nullable for class MixLog."); + + if (batchNumber.IsSet && batchNumber.Value == null) + throw new ArgumentNullException(nameof(batchNumber), "Property is not nullable for class MixLog."); + + if (brandCode.IsSet && brandCode.Value == null) + throw new ArgumentNullException(nameof(brandCode), "Property is not nullable for class MixLog."); + + if (brandId.IsSet && brandId.Value == null) + throw new ArgumentNullException(nameof(brandId), "Property is not nullable for class MixLog."); + + if (brandName.IsSet && brandName.Value == null) + throw new ArgumentNullException(nameof(brandName), "Property is not nullable for class MixLog."); + + if (categoryCode.IsSet && categoryCode.Value == null) + throw new ArgumentNullException(nameof(categoryCode), "Property is not nullable for class MixLog."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class MixLog."); + + if (colorDescription.IsSet && colorDescription.Value == null) + throw new ArgumentNullException(nameof(colorDescription), "Property is not nullable for class MixLog."); + + if (comment.IsSet && comment.Value == null) + throw new ArgumentNullException(nameof(comment), "Property is not nullable for class MixLog."); + + if (commercialProductCode.IsSet && commercialProductCode.Value == null) + throw new ArgumentNullException(nameof(commercialProductCode), "Property is not nullable for class MixLog."); + + if (country.IsSet && country.Value == null) + throw new ArgumentNullException(nameof(country), "Property is not nullable for class MixLog."); + + if (createdBy.IsSet && createdBy.Value == null) + throw new ArgumentNullException(nameof(createdBy), "Property is not nullable for class MixLog."); + + if (createdByFirstName.IsSet && createdByFirstName.Value == null) + throw new ArgumentNullException(nameof(createdByFirstName), "Property is not nullable for class MixLog."); + + if (createdByLastName.IsSet && createdByLastName.Value == null) + throw new ArgumentNullException(nameof(createdByLastName), "Property is not nullable for class MixLog."); + + if (deltaECalculationRepaired.IsSet && deltaECalculationRepaired.Value == null) + throw new ArgumentNullException(nameof(deltaECalculationRepaired), "Property is not nullable for class MixLog."); + + if (deltaECalculationSprayout.IsSet && deltaECalculationSprayout.Value == null) + throw new ArgumentNullException(nameof(deltaECalculationSprayout), "Property is not nullable for class MixLog."); + + if (primerProductId.IsSet && primerProductId.Value == null) + throw new ArgumentNullException(nameof(primerProductId), "Property is not nullable for class MixLog."); + + if (productId.IsSet && productId.Value == null) + throw new ArgumentNullException(nameof(productId), "Property is not nullable for class MixLog."); + + if (productLineCode.IsSet && productLineCode.Value == null) + throw new ArgumentNullException(nameof(productLineCode), "Property is not nullable for class MixLog."); + + if (productName.IsSet && productName.Value == null) + throw new ArgumentNullException(nameof(productName), "Property is not nullable for class MixLog."); + + if (selectedVersionIndex.IsSet && selectedVersionIndex.Value == null) + throw new ArgumentNullException(nameof(selectedVersionIndex), "Property is not nullable for class MixLog."); + + if (shopId.IsSet && shopId.Value == null) + throw new ArgumentNullException(nameof(shopId), "Property is not nullable for class MixLog."); + + return new MixLog(description.Value, formulaVersionDate.Value.Value, id.Value.Value, mixDate.Value.Value, totalOverPoors.Value.Value, totalRecalculations.Value.Value, totalSkips.Value.Value, totalUnderPours.Value.Value, batchNumber, brandCode, brandId, brandName, categoryCode, color, colorDescription, comment, commercialProductCode, country, createdBy, createdByFirstName, createdByLastName, deltaECalculationRepaired, deltaECalculationSprayout, ownColorVariantNumber, primerProductId, productId, productLineCode, productName, selectedVersionIndex, shopId, someCode, totalPrice); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixLog, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions) + { + if (mixLog.Description == null) + throw new ArgumentNullException(nameof(mixLog.Description), "Property is required for class MixLog."); + + if (mixLog.BatchNumberOption.IsSet && mixLog.BatchNumber == null) + throw new ArgumentNullException(nameof(mixLog.BatchNumber), "Property is required for class MixLog."); + + if (mixLog.BrandCodeOption.IsSet && mixLog.BrandCode == null) + throw new ArgumentNullException(nameof(mixLog.BrandCode), "Property is required for class MixLog."); + + if (mixLog.BrandIdOption.IsSet && mixLog.BrandId == null) + throw new ArgumentNullException(nameof(mixLog.BrandId), "Property is required for class MixLog."); + + if (mixLog.BrandNameOption.IsSet && mixLog.BrandName == null) + throw new ArgumentNullException(nameof(mixLog.BrandName), "Property is required for class MixLog."); + + if (mixLog.CategoryCodeOption.IsSet && mixLog.CategoryCode == null) + throw new ArgumentNullException(nameof(mixLog.CategoryCode), "Property is required for class MixLog."); + + if (mixLog.ColorOption.IsSet && mixLog.Color == null) + throw new ArgumentNullException(nameof(mixLog.Color), "Property is required for class MixLog."); + + if (mixLog.ColorDescriptionOption.IsSet && mixLog.ColorDescription == null) + throw new ArgumentNullException(nameof(mixLog.ColorDescription), "Property is required for class MixLog."); + + if (mixLog.CommentOption.IsSet && mixLog.Comment == null) + throw new ArgumentNullException(nameof(mixLog.Comment), "Property is required for class MixLog."); + + if (mixLog.CommercialProductCodeOption.IsSet && mixLog.CommercialProductCode == null) + throw new ArgumentNullException(nameof(mixLog.CommercialProductCode), "Property is required for class MixLog."); + + if (mixLog.CountryOption.IsSet && mixLog.Country == null) + throw new ArgumentNullException(nameof(mixLog.Country), "Property is required for class MixLog."); + + if (mixLog.CreatedByOption.IsSet && mixLog.CreatedBy == null) + throw new ArgumentNullException(nameof(mixLog.CreatedBy), "Property is required for class MixLog."); + + if (mixLog.CreatedByFirstNameOption.IsSet && mixLog.CreatedByFirstName == null) + throw new ArgumentNullException(nameof(mixLog.CreatedByFirstName), "Property is required for class MixLog."); + + if (mixLog.CreatedByLastNameOption.IsSet && mixLog.CreatedByLastName == null) + throw new ArgumentNullException(nameof(mixLog.CreatedByLastName), "Property is required for class MixLog."); + + if (mixLog.DeltaECalculationRepairedOption.IsSet && mixLog.DeltaECalculationRepaired == null) + throw new ArgumentNullException(nameof(mixLog.DeltaECalculationRepaired), "Property is required for class MixLog."); + + if (mixLog.DeltaECalculationSprayoutOption.IsSet && mixLog.DeltaECalculationSprayout == null) + throw new ArgumentNullException(nameof(mixLog.DeltaECalculationSprayout), "Property is required for class MixLog."); + + if (mixLog.PrimerProductIdOption.IsSet && mixLog.PrimerProductId == null) + throw new ArgumentNullException(nameof(mixLog.PrimerProductId), "Property is required for class MixLog."); + + if (mixLog.ProductIdOption.IsSet && mixLog.ProductId == null) + throw new ArgumentNullException(nameof(mixLog.ProductId), "Property is required for class MixLog."); + + if (mixLog.ProductLineCodeOption.IsSet && mixLog.ProductLineCode == null) + throw new ArgumentNullException(nameof(mixLog.ProductLineCode), "Property is required for class MixLog."); + + if (mixLog.ProductNameOption.IsSet && mixLog.ProductName == null) + throw new ArgumentNullException(nameof(mixLog.ProductName), "Property is required for class MixLog."); + + writer.WriteString("description", mixLog.Description); + + writer.WriteString("formulaVersionDate", mixLog.FormulaVersionDate.ToString(FormulaVersionDateFormat)); + + writer.WriteString("id", mixLog.Id); + + writer.WriteString("mixDate", mixLog.MixDate.ToString(MixDateFormat)); + + writer.WriteNumber("totalOverPoors", mixLog.TotalOverPoors); + + writer.WriteNumber("totalRecalculations", mixLog.TotalRecalculations); + + writer.WriteNumber("totalSkips", mixLog.TotalSkips); + + writer.WriteNumber("totalUnderPours", mixLog.TotalUnderPours); + + if (mixLog.BatchNumberOption.IsSet) + writer.WriteString("batchNumber", mixLog.BatchNumber); + + if (mixLog.BrandCodeOption.IsSet) + writer.WriteString("brandCode", mixLog.BrandCode); + + if (mixLog.BrandIdOption.IsSet) + writer.WriteString("brandId", mixLog.BrandId); + + if (mixLog.BrandNameOption.IsSet) + writer.WriteString("brandName", mixLog.BrandName); + + if (mixLog.CategoryCodeOption.IsSet) + writer.WriteString("categoryCode", mixLog.CategoryCode); + + if (mixLog.ColorOption.IsSet) + writer.WriteString("color", mixLog.Color); + + if (mixLog.ColorDescriptionOption.IsSet) + writer.WriteString("colorDescription", mixLog.ColorDescription); + + if (mixLog.CommentOption.IsSet) + writer.WriteString("comment", mixLog.Comment); + + if (mixLog.CommercialProductCodeOption.IsSet) + writer.WriteString("commercialProductCode", mixLog.CommercialProductCode); + + if (mixLog.CountryOption.IsSet) + writer.WriteString("country", mixLog.Country); + + if (mixLog.CreatedByOption.IsSet) + writer.WriteString("createdBy", mixLog.CreatedBy); + + if (mixLog.CreatedByFirstNameOption.IsSet) + writer.WriteString("createdByFirstName", mixLog.CreatedByFirstName); + + if (mixLog.CreatedByLastNameOption.IsSet) + writer.WriteString("createdByLastName", mixLog.CreatedByLastName); + + if (mixLog.DeltaECalculationRepairedOption.IsSet) + writer.WriteString("deltaECalculationRepaired", mixLog.DeltaECalculationRepaired); + + if (mixLog.DeltaECalculationSprayoutOption.IsSet) + writer.WriteString("deltaECalculationSprayout", mixLog.DeltaECalculationSprayout); + + if (mixLog.OwnColorVariantNumberOption.IsSet) + if (mixLog.OwnColorVariantNumberOption.Value != null) + writer.WriteNumber("ownColorVariantNumber", mixLog.OwnColorVariantNumberOption.Value.Value); + else + writer.WriteNull("ownColorVariantNumber"); + + if (mixLog.PrimerProductIdOption.IsSet) + writer.WriteString("primerProductId", mixLog.PrimerProductId); + + if (mixLog.ProductIdOption.IsSet) + writer.WriteString("productId", mixLog.ProductId); + + if (mixLog.ProductLineCodeOption.IsSet) + writer.WriteString("productLineCode", mixLog.ProductLineCode); + + if (mixLog.ProductNameOption.IsSet) + writer.WriteString("productName", mixLog.ProductName); + + if (mixLog.SelectedVersionIndexOption.IsSet) + writer.WriteNumber("selectedVersionIndex", mixLog.SelectedVersionIndexOption.Value.Value); + + if (mixLog.ShopIdOption.IsSet) + writer.WriteString("shopId", mixLog.ShopIdOption.Value.Value); + + if (mixLog.SomeCodeOption.IsSet) + if (mixLog.SomeCodeOption.Value != null) + writer.WriteString("someCode", mixLog.SomeCode); + else + writer.WriteNull("someCode"); + + if (mixLog.TotalPriceOption.IsSet) + if (mixLog.TotalPriceOption.Value != null) + writer.WriteNumber("totalPrice", mixLog.TotalPriceOption.Value.Value); + else + writer.WriteNull("totalPrice"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs new file mode 100644 index 000000000000..674358380306 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedAnyOf + /// + public partial class MixedAnyOf : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// content + [JsonConstructor] + public MixedAnyOf(Option content = default) + { + ContentOption = content; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Content + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ContentOption { get; private set; } + + /// + /// Gets or Sets Content + /// + [JsonPropertyName("content")] + public MixedAnyOfContent Content { get { return this.ContentOption; } set { this.ContentOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedAnyOf {\n"); + sb.Append(" Content: ").Append(Content).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedAnyOfJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option content = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "content": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (content.IsSet && content.Value == null) + throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedAnyOf."); + + return new MixedAnyOf(content); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedAnyOf, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) + throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + + if (mixedAnyOf.ContentOption.IsSet) + { + writer.WritePropertyName("content"); + JsonSerializer.Serialize(writer, mixedAnyOf.Content, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs new file mode 100644 index 000000000000..4d5b99d03e4c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs @@ -0,0 +1,283 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mixed anyOf types for testing + /// + public partial class MixedAnyOfContent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + public MixedAnyOfContent(Option @string, Option @bool, Option @int, Option @decimal, Option mixedSubId) + { + StringOption = @string; + BoolOption = @bool; + IntOption = @int; + DecimalOption = @decimal; + MixedSubIdOption = mixedSubId; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + public string String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Used to track the state of Bool + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BoolOption { get; private set; } + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get { return this.BoolOption; } set { this.BoolOption = new(value); } } + + /// + /// Used to track the state of Int + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntOption { get; private set; } + + /// + /// Gets or Sets Int + /// + public int? Int { get { return this.IntOption; } set { this.IntOption = new(value); } } + + /// + /// Used to track the state of Decimal + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DecimalOption { get; private set; } + + /// + /// Gets or Sets Decimal + /// + public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new(value); } } + + /// + /// Used to track the state of MixedSubId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MixedSubIdOption { get; private set; } + + /// + /// Gets or Sets MixedSubId + /// + public MixedSubId MixedSubId { get { return this.MixedSubIdOption; } set { this.MixedSubIdOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedAnyOfContent {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedAnyOfContentJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedAnyOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string varString = default; + bool? varBool = default; + int? varInt = default; + decimal? varDecimal = default; + MixedSubId mixedSubId = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderInt = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt); + + Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal); + + Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + Option varStringParsedValue = varString == null + ? default + : new Option(varString); + Option varBoolParsedValue = varBool == null + ? default + : new Option(varBool); + Option varIntParsedValue = varInt == null + ? default + : new Option(varInt); + Option varDecimalParsedValue = varDecimal == null + ? default + : new Option(varDecimal); + Option mixedSubIdParsedValue = mixedSubId == null + ? default + : new Option(mixedSubId); + + return new MixedAnyOfContent(varStringParsedValue, varBoolParsedValue, varIntParsedValue, varDecimalParsedValue, mixedSubIdParsedValue); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (mixedAnyOfContent.StringOption.IsSet && mixedAnyOfContent.StringOption.Value != null) + writer.WriteString("content", mixedAnyOfContent.StringOption.Value); + + if (mixedAnyOfContent.BoolOption.IsSet && mixedAnyOfContent.BoolOption.Value != null) + writer.WriteBoolean("content", mixedAnyOfContent.BoolOption.Value.Value); + + if (mixedAnyOfContent.IntOption.IsSet && mixedAnyOfContent.IntOption.Value != null) + writer.WriteNumber("content", mixedAnyOfContent.IntOption.Value.Value); + + if (mixedAnyOfContent.DecimalOption.IsSet && mixedAnyOfContent.DecimalOption.Value != null) + writer.WriteNumber("content", mixedAnyOfContent.DecimalOption.Value.Value); + + if (mixedAnyOfContent.MixedSubIdOption.IsSet && mixedAnyOfContent.MixedSubIdOption.Value != null) + { + MixedSubIdJsonConverter MixedSubIdJsonConverter = (MixedSubIdJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mixedAnyOfContent.MixedSubIdOption.Value.GetType())); + MixedSubIdJsonConverter.WriteProperties(writer, mixedAnyOfContent.MixedSubIdOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, mixedAnyOfContent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs new file mode 100644 index 000000000000..2467daa6e2b3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedOneOf + /// + public partial class MixedOneOf : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// content + [JsonConstructor] + public MixedOneOf(Option content = default) + { + ContentOption = content; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Content + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ContentOption { get; private set; } + + /// + /// Gets or Sets Content + /// + [JsonPropertyName("content")] + public MixedOneOfContent Content { get { return this.ContentOption; } set { this.ContentOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedOneOf {\n"); + sb.Append(" Content: ").Append(Content).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedOneOfJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option content = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "content": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (content.IsSet && content.Value == null) + throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedOneOf."); + + return new MixedOneOf(content); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedOneOf, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) + throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + + if (mixedOneOf.ContentOption.IsSet) + { + writer.WritePropertyName("content"); + JsonSerializer.Serialize(writer, mixedOneOf.Content, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs new file mode 100644 index 000000000000..4cb69dae28cd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs @@ -0,0 +1,261 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mixed oneOf types for testing + /// + public partial class MixedOneOfContent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(string @string) + { + String = @string; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(bool @bool) + { + Bool = @bool; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(int @int) + { + Int = @int; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(decimal @decimal) + { + Decimal = @decimal; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(MixedSubId mixedSubId) + { + MixedSubId = mixedSubId; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets String + /// + public string String { get; set; } + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get; set; } + + /// + /// Gets or Sets Int + /// + public int? Int { get; set; } + + /// + /// Gets or Sets Decimal + /// + public decimal? Decimal { get; set; } + + /// + /// Gets or Sets MixedSubId + /// + public MixedSubId MixedSubId { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedOneOfContent {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedOneOfContentJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedOneOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string varString = default; + bool? varBool = default; + int? varInt = default; + decimal? varDecimal = default; + MixedSubId mixedSubId = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderInt = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt); + + Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal); + + Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varString != null) + return new MixedOneOfContent(varString); + + if (varBool != null) + return new MixedOneOfContent(varBool.Value); + + if (varInt != null) + return new MixedOneOfContent(varInt.Value); + + if (varDecimal != null) + return new MixedOneOfContent(varDecimal.Value); + + if (mixedSubId != null) + return new MixedOneOfContent(mixedSubId); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedOneOfContent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs new file mode 100644 index 000000000000..808a4b66c6f2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -0,0 +1,270 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedPropertiesAndAdditionalPropertiesClass + /// + public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// dateTime + /// map + /// uuid + /// uuidWithPattern + [JsonConstructor] + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) + { + DateTimeOption = dateTime; + MapOption = map; + UuidOption = uuid; + UuidWithPatternOption = uuidWithPattern; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateTimeOption { get; private set; } + + /// + /// Gets or Sets DateTime + /// + [JsonPropertyName("dateTime")] + public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new(value); } } + + /// + /// Used to track the state of Map + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> MapOption { get; private set; } + + /// + /// Gets or Sets Map + /// + [JsonPropertyName("map")] + public Dictionary Map { get { return this.MapOption; } set { this.MapOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Used to track the state of UuidWithPattern + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidWithPatternOption { get; private set; } + + /// + /// Gets or Sets UuidWithPattern + /// + [JsonPropertyName("uuid_with_pattern")] + public Guid? UuidWithPattern { get { return this.UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Map: ").Append(Map).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" UuidWithPattern: ").Append(UuidWithPattern).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + + if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedPropertiesAndAdditionalPropertiesClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateTime + /// + public static string DateTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option dateTime = default; + Option> map = default; + Option uuid = default; + Option uuidWithPattern = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "dateTime": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + case "uuid_with_pattern": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (map.IsSet && map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedPropertiesAndAdditionalPropertiesClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); + + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) + { + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + } + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs new file mode 100644 index 000000000000..05c06c0129ed --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedSubId + /// + public partial class MixedSubId : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + [JsonConstructor] + public MixedSubId(Option id = default) + { + IdOption = id; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public string Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedSubId {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedSubIdJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedSubId Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + id = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixedSubId."); + + return new MixedSubId(id); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedSubId, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) + throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + + if (mixedSubId.IdOption.IsSet) + writer.WriteString("id", mixedSubId.Id); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs new file mode 100644 index 000000000000..8e865d8efae7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs @@ -0,0 +1,201 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name starting with number + /// + public partial class Model200Response : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// class + /// name + [JsonConstructor] + public Model200Response(Option @class = default, Option name = default) + { + ClassOption = @class; + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Class + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ClassOption { get; private set; } + + /// + /// Gets or Sets Class + /// + [JsonPropertyName("class")] + public string Class { get { return this.ClassOption; } set { this.ClassOption = new(value); } } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public int? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Model200Response {\n"); + sb.Append(" Class: ").Append(Class).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class Model200ResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClass = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "class": + varClass = new Option(utf8JsonReader.GetString()); + break; + case "name": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + name = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); + + return new Model200Response(varClass, name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, model200Response, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) + { + if (model200Response.ClassOption.IsSet && model200Response.Class == null) + throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + + if (model200Response.ClassOption.IsSet) + writer.WriteString("class", model200Response.Class); + + if (model200Response.NameOption.IsSet) + writer.WriteNumber("name", model200Response.NameOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs new file mode 100644 index 000000000000..60a778b3a743 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ModelClient + /// + public partial class ModelClient : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varClient + [JsonConstructor] + public ModelClient(Option varClient = default) + { + VarClientOption = varClient; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of VarClient + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarClientOption { get; private set; } + + /// + /// Gets or Sets VarClient + /// + [JsonPropertyName("client")] + public string VarClient { get { return this.VarClientOption; } set { this.VarClientOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ModelClient {\n"); + sb.Append(" VarClient: ").Append(VarClient).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ModelClientJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClient = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "client": + varClient = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (varClient.IsSet && varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); + + return new ModelClient(varClient); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, modelClient, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) + { + if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + + if (modelClient.VarClientOption.IsSet) + writer.WriteString("client", modelClient.VarClient); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs new file mode 100644 index 000000000000..db407f5e3553 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Name.cs @@ -0,0 +1,291 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name same as property name + /// + public partial class Name : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varName + /// property + /// snakeCase + /// var123Number + [JsonConstructor] + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) + { + VarName = varName; + PropertyOption = property; + SnakeCaseOption = snakeCase; + Var123NumberOption = var123Number; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets VarName + /// + [JsonPropertyName("name")] + public int VarName { get; set; } + + /// + /// Used to track the state of Property + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PropertyOption { get; private set; } + + /// + /// Gets or Sets Property + /// + [JsonPropertyName("property")] + public string Property { get { return this.PropertyOption; } set { this.PropertyOption = new(value); } } + + /// + /// Used to track the state of SnakeCase + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SnakeCaseOption { get; } + + /// + /// Gets or Sets SnakeCase + /// + [JsonPropertyName("snake_case")] + public int? SnakeCase { get { return this.SnakeCaseOption; } } + + /// + /// Used to track the state of Var123Number + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Var123NumberOption { get; } + + /// + /// Gets or Sets Var123Number + /// + [JsonPropertyName("123Number")] + public int? Var123Number { get { return this.Var123NumberOption; } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Name {\n"); + sb.Append(" VarName: ").Append(VarName).Append("\n"); + sb.Append(" Property: ").Append(Property).Append("\n"); + sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); + sb.Append(" Var123Number: ").Append(Var123Number).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as Name).AreEqual; + } + + /// + /// Returns true if Name instances are equal + /// + /// Instance of Name to be compared + /// Boolean + public bool Equals(Name input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (SnakeCase != null) + hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); + + if (Var123Number != null) + hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NameJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varName = new Option(utf8JsonReader.GetInt32()); + break; + case "property": + property = new Option(utf8JsonReader.GetString()); + break; + case "snake_case": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + snakeCase = new Option(utf8JsonReader.GetInt32()); + break; + case "123Number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + var123Number = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (!varName.IsSet) + throw new ArgumentException("Property is required for class Name.", nameof(varName)); + + if (varName.IsSet && varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); + + if (property.IsSet && property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); + + if (snakeCase.IsSet && snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); + + if (var123Number.IsSet && var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); + + return new Name(varName.Value.Value, property, snakeCase, var123Number); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, name, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) + { + if (name.PropertyOption.IsSet && name.Property == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + + writer.WriteNumber("name", name.VarName); + + if (name.PropertyOption.IsSet) + writer.WriteString("property", name.Property); + + if (name.SnakeCaseOption.IsSet) + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value.Value); + + if (name.Var123NumberOption.IsSet) + writer.WriteNumber("123Number", name.Var123NumberOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs new file mode 100644 index 000000000000..ea8abdda0d78 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -0,0 +1,192 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NotificationtestGetElementsV1ResponseMPayload + /// + public partial class NotificationtestGetElementsV1ResponseMPayload : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// aObjVariableobject + /// pkiNotificationtestID + [JsonConstructor] + public NotificationtestGetElementsV1ResponseMPayload(List> aObjVariableobject, int pkiNotificationtestID) + { + AObjVariableobject = aObjVariableobject; + PkiNotificationtestID = pkiNotificationtestID; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets AObjVariableobject + /// + [JsonPropertyName("a_objVariableobject")] + public List> AObjVariableobject { get; set; } + + /// + /// Gets or Sets PkiNotificationtestID + /// + [JsonPropertyName("pkiNotificationtestID")] + public int PkiNotificationtestID { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NotificationtestGetElementsV1ResponseMPayload {\n"); + sb.Append(" AObjVariableobject: ").Append(AObjVariableobject).Append("\n"); + sb.Append(" PkiNotificationtestID: ").Append(PkiNotificationtestID).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NotificationtestGetElementsV1ResponseMPayloadJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>> aObjVariableobject = default; + Option pkiNotificationtestID = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "a_objVariableobject": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "pkiNotificationtestID": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (!aObjVariableobject.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); + + if (!pkiNotificationtestID.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); + + if (aObjVariableobject.IsSet && aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value, pkiNotificationtestID.Value.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, notificationtestGetElementsV1ResponseMPayload, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) + { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + + writer.WritePropertyName("a_objVariableobject"); + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs new file mode 100644 index 000000000000..3b9f00ed6666 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs @@ -0,0 +1,496 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NullableClass + /// + public partial class NullableClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayAndItemsNullableProp + /// arrayItemsNullable + /// arrayNullableProp + /// booleanProp + /// dateProp + /// datetimeProp + /// integerProp + /// numberProp + /// objectAndItemsNullableProp + /// objectItemsNullable + /// objectNullableProp + /// stringProp + [JsonConstructor] + public NullableClass(Option> arrayAndItemsNullableProp = default, Option> arrayItemsNullable = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectItemsNullable = default, Option> objectNullableProp = default, Option stringProp = default) + { + ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayItemsNullableOption = arrayItemsNullable; + ArrayNullablePropOption = arrayNullableProp; + BooleanPropOption = booleanProp; + DatePropOption = dateProp; + DatetimePropOption = datetimeProp; + IntegerPropOption = integerProp; + NumberPropOption = numberProp; + ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectItemsNullableOption = objectItemsNullable; + ObjectNullablePropOption = objectNullableProp; + StringPropOption = stringProp; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayAndItemsNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayAndItemsNullablePropOption { get; private set; } + + /// + /// Gets or Sets ArrayAndItemsNullableProp + /// + [JsonPropertyName("array_and_items_nullable_prop")] + public List ArrayAndItemsNullableProp { get { return this.ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } + + /// + /// Used to track the state of ArrayItemsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ArrayItemsNullable + /// + [JsonPropertyName("array_items_nullable")] + public List ArrayItemsNullable { get { return this.ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } + + /// + /// Used to track the state of ArrayNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ArrayNullablePropOption { get; private set; } + + /// + /// Gets or Sets ArrayNullableProp + /// + [JsonPropertyName("array_nullable_prop")] + public List ArrayNullableProp { get { return this.ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } + + /// + /// Used to track the state of BooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BooleanPropOption { get; private set; } + + /// + /// Gets or Sets BooleanProp + /// + [JsonPropertyName("boolean_prop")] + public bool? BooleanProp { get { return this.BooleanPropOption; } set { this.BooleanPropOption = new(value); } } + + /// + /// Used to track the state of DateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DatePropOption { get; private set; } + + /// + /// Gets or Sets DateProp + /// + [JsonPropertyName("date_prop")] + public DateOnly? DateProp { get { return this.DatePropOption; } set { this.DatePropOption = new(value); } } + + /// + /// Used to track the state of DatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DatetimePropOption { get; private set; } + + /// + /// Gets or Sets DatetimeProp + /// + [JsonPropertyName("datetime_prop")] + public DateTime? DatetimeProp { get { return this.DatetimePropOption; } set { this.DatetimePropOption = new(value); } } + + /// + /// Used to track the state of IntegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntegerPropOption { get; private set; } + + /// + /// Gets or Sets IntegerProp + /// + [JsonPropertyName("integer_prop")] + public int? IntegerProp { get { return this.IntegerPropOption; } set { this.IntegerPropOption = new(value); } } + + /// + /// Used to track the state of NumberProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NumberPropOption { get; private set; } + + /// + /// Gets or Sets NumberProp + /// + [JsonPropertyName("number_prop")] + public decimal? NumberProp { get { return this.NumberPropOption; } set { this.NumberPropOption = new(value); } } + + /// + /// Used to track the state of ObjectAndItemsNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ObjectAndItemsNullablePropOption { get; private set; } + + /// + /// Gets or Sets ObjectAndItemsNullableProp + /// + [JsonPropertyName("object_and_items_nullable_prop")] + public Dictionary ObjectAndItemsNullableProp { get { return this.ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } + + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ObjectItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ObjectItemsNullable + /// + [JsonPropertyName("object_items_nullable")] + public Dictionary ObjectItemsNullable { get { return this.ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + + /// + /// Used to track the state of ObjectNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> ObjectNullablePropOption { get; private set; } + + /// + /// Gets or Sets ObjectNullableProp + /// + [JsonPropertyName("object_nullable_prop")] + public Dictionary ObjectNullableProp { get { return this.ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } + + /// + /// Used to track the state of StringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringPropOption { get; private set; } + + /// + /// Gets or Sets StringProp + /// + [JsonPropertyName("string_prop")] + public string StringProp { get { return this.StringPropOption; } set { this.StringPropOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableClass {\n"); + sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append("\n"); + sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); + sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append("\n"); + sb.Append(" BooleanProp: ").Append(BooleanProp).Append("\n"); + sb.Append(" DateProp: ").Append(DateProp).Append("\n"); + sb.Append(" DatetimeProp: ").Append(DatetimeProp).Append("\n"); + sb.Append(" IntegerProp: ").Append(IntegerProp).Append("\n"); + sb.Append(" NumberProp: ").Append(NumberProp).Append("\n"); + sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n"); + sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); + sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n"); + sb.Append(" StringProp: ").Append(StringProp).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateProp + /// + public static string DatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize DatetimeProp + /// + public static string DatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> arrayAndItemsNullableProp = default; + Option> arrayItemsNullable = default; + Option> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option> objectAndItemsNullableProp = default; + Option> objectItemsNullable = default; + Option> objectNullableProp = default; + Option stringProp = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_and_items_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_items_nullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + booleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + integerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "number_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + numberProp = new Option(utf8JsonReader.GetDecimal()); + break; + case "object_and_items_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "object_items_nullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "object_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "string_prop": + stringProp = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (arrayItemsNullable.IsSet && arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); + + if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); + + return new NullableClass(arrayAndItemsNullableProp, arrayItemsNullable, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectItemsNullable, objectNullableProp, stringProp); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, nullableClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) + { + if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) + if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayItemsNullableOption.IsSet) + { + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } + if (nullableClass.ArrayNullablePropOption.IsSet) + if (nullableClass.ArrayNullablePropOption.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanPropOption.IsSet) + if (nullableClass.BooleanPropOption.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value.Value); + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DatePropOption.IsSet) + if (nullableClass.DatePropOption.Value != null) + writer.WriteString("date_prop", nullableClass.DatePropOption.Value.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimePropOption.IsSet) + if (nullableClass.DatetimePropOption.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerPropOption.IsSet) + if (nullableClass.IntegerPropOption.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value.Value); + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberPropOption.IsSet) + if (nullableClass.NumberPropOption.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value.Value); + else + writer.WriteNull("number_prop"); + + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) + if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectItemsNullableOption.IsSet) + { + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } + if (nullableClass.ObjectNullablePropOption.IsSet) + if (nullableClass.ObjectNullablePropOption.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringPropOption.IsSet) + if (nullableClass.StringPropOption.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp); + else + writer.WriteNull("string_prop"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs new file mode 100644 index 000000000000..5f369537bb2a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -0,0 +1,173 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NullableGuidClass + /// + public partial class NullableGuidClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// uuid + [JsonConstructor] + public NullableGuidClass(Option uuid = default) + { + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableGuidClass {\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableGuidClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + return new NullableGuidClass(uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, nullableGuidClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) + { + if (nullableGuidClass.UuidOption.IsSet) + if (nullableGuidClass.UuidOption.Value != null) + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value.Value); + else + writer.WriteNull("uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs new file mode 100644 index 000000000000..9a93cb734e9c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// 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. + /// + public partial class NullableShape : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public NullableShape(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public NullableShape(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableShape {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableShapeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral quadrilateral = null; + Triangle triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("shapeType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("Quadrilateral")) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator.Equals("Triangle")) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); + + if (quadrilateral != null) + return new NullableShape(quadrilateral); + + if (triangle != null) + return new NullableShape(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (nullableShape.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, nullableShape.Triangle, jsonSerializerOptions); + } + + if (nullableShape.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, nullableShape.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, nullableShape, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs new file mode 100644 index 000000000000..f720208fafe0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -0,0 +1,172 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NumberOnly + /// + public partial class NumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// justNumber + [JsonConstructor] + public NumberOnly(Option justNumber = default) + { + JustNumberOption = justNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of JustNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option JustNumberOption { get; private set; } + + /// + /// Gets or Sets JustNumber + /// + [JsonPropertyName("JustNumber")] + public decimal? JustNumber { get { return this.JustNumberOption; } set { this.JustNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NumberOnly {\n"); + sb.Append(" JustNumber: ").Append(JustNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option justNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "JustNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + justNumber = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (justNumber.IsSet && justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); + + return new NumberOnly(justNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, numberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (numberOnly.JustNumberOption.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs new file mode 100644 index 000000000000..50ad5aef5a1b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -0,0 +1,268 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ObjectWithDeprecatedFields + /// + public partial class ObjectWithDeprecatedFields : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bars + /// deprecatedRef + /// id + /// uuid + [JsonConstructor] + public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) + { + BarsOption = bars; + DeprecatedRefOption = deprecatedRef; + IdOption = id; + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bars + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> BarsOption { get; private set; } + + /// + /// Gets or Sets Bars + /// + [JsonPropertyName("bars")] + [Obsolete] + public List Bars { get { return this.BarsOption; } set { this.BarsOption = new(value); } } + + /// + /// Used to track the state of DeprecatedRef + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeprecatedRefOption { get; private set; } + + /// + /// Gets or Sets DeprecatedRef + /// + [JsonPropertyName("deprecatedRef")] + [Obsolete] + public DeprecatedObject DeprecatedRef { get { return this.DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + [Obsolete] + public decimal? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + [JsonPropertyName("uuid")] + public string Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ObjectWithDeprecatedFields {\n"); + sb.Append(" Bars: ").Append(Bars).Append("\n"); + sb.Append(" DeprecatedRef: ").Append(DeprecatedRef).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ObjectWithDeprecatedFieldsJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bars": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "deprecatedRef": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetDecimal()); + break; + case "uuid": + uuid = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (bars.IsSet && bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (deprecatedRef.IsSet && deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); + + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, objectWithDeprecatedFields, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) + { + if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.BarsOption.IsSet) + { + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + } + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) + { + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + } + if (objectWithDeprecatedFields.IdOption.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); + + if (objectWithDeprecatedFields.UuidOption.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs new file mode 100644 index 000000000000..c89963f55a36 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs @@ -0,0 +1,157 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// OneOfString + /// + public partial class OneOfString : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + internal OneOfString(string @string) + { + String = @string; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets String + /// + public string String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OneOfString {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OneOfStringJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string varString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varString != null) + return new OneOfString(varString); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, oneOfString, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs new file mode 100644 index 000000000000..ee5777aabe75 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Order.cs @@ -0,0 +1,396 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Order + /// + public partial class Order : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// complete (default to false) + /// id + /// petId + /// quantity + /// shipDate + /// Order Status + [JsonConstructor] + public Order(Option complete = default, Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default) + { + CompleteOption = complete; + IdOption = id; + PetIdOption = petId; + QuantityOption = quantity; + ShipDateOption = shipDate; + StatusOption = status; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Returns a + /// + /// + /// + /// + public static StatusEnum StatusEnumFromString(string value) + { + if (value.Equals("placed")) + return StatusEnum.Placed; + + if (value.Equals("approved")) + return StatusEnum.Approved; + + if (value.Equals("delivered")) + return StatusEnum.Delivered; + + throw new NotImplementedException($"Could not convert value to type StatusEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static StatusEnum? StatusEnumFromStringOrDefault(string value) + { + if (value.Equals("placed")) + return StatusEnum.Placed; + + if (value.Equals("approved")) + return StatusEnum.Approved; + + if (value.Equals("delivered")) + return StatusEnum.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string StatusEnumToJsonValue(StatusEnum? value) + { + if (value == StatusEnum.Placed) + return "placed"; + + if (value == StatusEnum.Approved) + return "approved"; + + if (value == StatusEnum.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// Order Status + /// + /// Order Status + [JsonPropertyName("status")] + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CompleteOption { get; private set; } + + /// + /// Gets or Sets Complete + /// + [JsonPropertyName("complete")] + public bool? Complete { get { return this.CompleteOption; } set { this.CompleteOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of PetId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PetIdOption { get; private set; } + + /// + /// Gets or Sets PetId + /// + [JsonPropertyName("petId")] + public long? PetId { get { return this.PetIdOption; } set { this.PetIdOption = new(value); } } + + /// + /// Used to track the state of Quantity + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QuantityOption { get; private set; } + + /// + /// Gets or Sets Quantity + /// + [JsonPropertyName("quantity")] + public int? Quantity { get { return this.QuantityOption; } set { this.QuantityOption = new(value); } } + + /// + /// Used to track the state of ShipDate + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShipDateOption { get; private set; } + + /// + /// Gets or Sets ShipDate + /// + /* 2020-02-02T20:20:20.000222Z */ + [JsonPropertyName("shipDate")] + public DateTime? ShipDate { get { return this.ShipDateOption; } set { this.ShipDateOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Order {\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" PetId: ").Append(PetId).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OrderJsonConverter : JsonConverter + { + /// + /// The format to use to serialize ShipDate + /// + public static string ShipDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "complete": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + complete = new Option(utf8JsonReader.GetBoolean()); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "petId": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + petId = new Option(utf8JsonReader.GetInt64()); + break; + case "quantity": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + quantity = new Option(utf8JsonReader.GetInt32()); + break; + case "shipDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "status": + string statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); + break; + default: + break; + } + } + } + + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); + + if (petId.IsSet && petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); + + if (quantity.IsSet && quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); + + if (shipDate.IsSet && shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); + + return new Order(complete, id, petId, quantity, shipDate, status); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, order, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) + { + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value.Value); + + if (order.IdOption.IsSet) + writer.WriteNumber("id", order.IdOption.Value.Value); + + if (order.PetIdOption.IsSet) + writer.WriteNumber("petId", order.PetIdOption.Value.Value); + + if (order.QuantityOption.IsSet) + writer.WriteNumber("quantity", order.QuantityOption.Value.Value); + + if (order.ShipDateOption.IsSet) + writer.WriteString("shipDate", order.ShipDateOption.Value.Value.ToString(ShipDateFormat)); + + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value.Value); + writer.WriteString("status", statusRawValue); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs new file mode 100644 index 000000000000..5a072449fae0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -0,0 +1,228 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// OuterComposite + /// + public partial class OuterComposite : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// myBoolean + /// myNumber + /// myString + [JsonConstructor] + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) + { + MyBooleanOption = myBoolean; + MyNumberOption = myNumber; + MyStringOption = myString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of MyBoolean + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyBooleanOption { get; private set; } + + /// + /// Gets or Sets MyBoolean + /// + [JsonPropertyName("my_boolean")] + public bool? MyBoolean { get { return this.MyBooleanOption; } set { this.MyBooleanOption = new(value); } } + + /// + /// Used to track the state of MyNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyNumberOption { get; private set; } + + /// + /// Gets or Sets MyNumber + /// + [JsonPropertyName("my_number")] + public decimal? MyNumber { get { return this.MyNumberOption; } set { this.MyNumberOption = new(value); } } + + /// + /// Used to track the state of MyString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyStringOption { get; private set; } + + /// + /// Gets or Sets MyString + /// + [JsonPropertyName("my_string")] + public string MyString { get { return this.MyStringOption; } set { this.MyStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OuterComposite {\n"); + sb.Append(" MyBoolean: ").Append(MyBoolean).Append("\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); + sb.Append(" MyString: ").Append(MyString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OuterCompositeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option myBoolean = default; + Option myNumber = default; + Option myString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "my_boolean": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + myBoolean = new Option(utf8JsonReader.GetBoolean()); + break; + case "my_number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + myNumber = new Option(utf8JsonReader.GetDecimal()); + break; + case "my_string": + myString = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (myBoolean.IsSet && myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); + + if (myNumber.IsSet && myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); + + if (myString.IsSet && myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); + + return new OuterComposite(myBoolean, myNumber, myString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, outerComposite, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) + { + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + + if (outerComposite.MyBooleanOption.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); + + if (outerComposite.MyNumberOption.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value.Value); + + if (outerComposite.MyStringOption.IsSet) + writer.WriteString("my_string", outerComposite.MyString); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnum.cs new file mode 100644 index 000000000000..47bb6793c6ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnum + /// + public enum OuterEnum + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnum FromString(string value) + { + if (value.Equals("placed")) + return OuterEnum.Placed; + + if (value.Equals("approved")) + return OuterEnum.Approved; + + if (value.Equals("delivered")) + return OuterEnum.Delivered; + + throw new NotImplementedException($"Could not convert value to type OuterEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnum? FromStringOrDefault(string value) + { + if (value.Equals("placed")) + return OuterEnum.Placed; + + if (value.Equals("approved")) + return OuterEnum.Approved; + + if (value.Equals("delivered")) + return OuterEnum.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnum value) + { + if (value == OuterEnum.Placed) + return "placed"; + + if (value == OuterEnum.Approved) + return "approved"; + + if (value == OuterEnum.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnum? result = rawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnum outerEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnum.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnum from the Json object + /// + /// + /// + /// + /// + public override OuterEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnum? result = rawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnum? outerEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnum?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs new file mode 100644 index 000000000000..136fb4c54c4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumDefaultValue + /// + public enum OuterEnumDefaultValue + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumDefaultValueValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumDefaultValue FromString(string value) + { + if (value.Equals("placed")) + return OuterEnumDefaultValue.Placed; + + if (value.Equals("approved")) + return OuterEnumDefaultValue.Approved; + + if (value.Equals("delivered")) + return OuterEnumDefaultValue.Delivered; + + throw new NotImplementedException($"Could not convert value to type OuterEnumDefaultValue: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumDefaultValue? FromStringOrDefault(string value) + { + if (value.Equals("placed")) + return OuterEnumDefaultValue.Placed; + + if (value.Equals("approved")) + return OuterEnumDefaultValue.Approved; + + if (value.Equals("delivered")) + return OuterEnumDefaultValue.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnumDefaultValue value) + { + if (value == OuterEnumDefaultValue.Placed) + return "placed"; + + if (value == OuterEnumDefaultValue.Approved) + return "approved"; + + if (value == OuterEnumDefaultValue.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumDefaultValueJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumDefaultValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumDefaultValue? result = rawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumDefaultValue to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumDefaultValue outerEnumDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumDefaultValue.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumDefaultValueNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumDefaultValue from the Json object + /// + /// + /// + /// + /// + public override OuterEnumDefaultValue? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumDefaultValue? result = rawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumDefaultValue? outerEnumDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumDefaultValue?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumInteger.cs new file mode 100644 index 000000000000..2ed4f18a657e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumInteger + /// + public enum OuterEnumInteger + { + /// + /// Enum NUMBER_0 for value: 0 + /// + NUMBER_0 = 0, + + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumIntegerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumInteger FromString(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumInteger.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumInteger.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumInteger.NUMBER_2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumInteger: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumInteger? FromStringOrDefault(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumInteger.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumInteger.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumInteger.NUMBER_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(OuterEnumInteger value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumIntegerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumInteger Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumInteger? result = rawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumInteger to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumInteger outerEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumInteger.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumIntegerNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumInteger from the Json object + /// + /// + /// + /// + /// + public override OuterEnumInteger? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumInteger? result = rawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumInteger? outerEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumInteger?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs new file mode 100644 index 000000000000..c6a470cc64d1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumIntegerDefaultValue + /// + public enum OuterEnumIntegerDefaultValue + { + /// + /// Enum NUMBER_0 for value: 0 + /// + NUMBER_0 = 0, + + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumIntegerDefaultValueValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumIntegerDefaultValue FromString(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumIntegerDefaultValue: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumIntegerDefaultValue? FromStringOrDefault(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(OuterEnumIntegerDefaultValue value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumIntegerDefaultValueJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumIntegerDefaultValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumIntegerDefaultValue? result = rawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumIntegerDefaultValue to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumIntegerDefaultValue.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumIntegerDefaultValueNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumIntegerDefaultValue from the Json object + /// + /// + /// + /// + /// + public override OuterEnumIntegerDefaultValue? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumIntegerDefaultValue? result = rawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumIntegerDefaultValue?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumTest.cs new file mode 100644 index 000000000000..a2e789f2edef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -0,0 +1,258 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines Outer_Enum_Test + /// + public enum OuterEnumTest + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumTestValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumTest FromString(string value) + { + if (value.Equals("UPPER")) + return OuterEnumTest.UPPER; + + if (value.Equals("lower")) + return OuterEnumTest.Lower; + + if (value.Equals("")) + return OuterEnumTest.Empty; + + if (value.Equals("Value\twith tab")) + return OuterEnumTest.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return OuterEnumTest.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return OuterEnumTest.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return OuterEnumTest.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return OuterEnumTest.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumTest: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumTest? FromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return OuterEnumTest.UPPER; + + if (value.Equals("lower")) + return OuterEnumTest.Lower; + + if (value.Equals("")) + return OuterEnumTest.Empty; + + if (value.Equals("Value\twith tab")) + return OuterEnumTest.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return OuterEnumTest.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return OuterEnumTest.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return OuterEnumTest.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return OuterEnumTest.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnumTest value) + { + if (value == OuterEnumTest.UPPER) + return "UPPER"; + + if (value == OuterEnumTest.Lower) + return "lower"; + + if (value == OuterEnumTest.Empty) + return ""; + + if (value == OuterEnumTest.ValuewithTab) + return "Value\twith tab"; + + if (value == OuterEnumTest.ValueWithQuote) + return "Value with \" quote"; + + if (value == OuterEnumTest.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == OuterEnumTest.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == OuterEnumTest.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumTestJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumTest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumTest? result = rawValue == null + ? null + : OuterEnumTestValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumTest to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumTest outerEnumTest, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumTest.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumTestNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumTest from the Json object + /// + /// + /// + /// + /// + public override OuterEnumTest? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + OuterEnumTest? result = rawValue == null + ? null + : OuterEnumTestValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumTest? outerEnumTest, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumTest?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ParentPet.cs new file mode 100644 index 000000000000..83104e900d01 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ParentPet.cs @@ -0,0 +1,158 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ParentPet + /// + public partial class ParentPet : GrandparentAnimal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructor] + public ParentPet() : base() + { + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string PetType { get; } = "ParentPet"; + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ParentPet {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class ParentPetJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option petType = default; + + string discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type"); + + if (discriminator != null && discriminator.Equals("ChildCat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pet_type": + petType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + return new ParentPet(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) + { + if (parentPet is ChildCat childCat){ + JsonSerializer.Serialize(writer, childCat, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, parentPet, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("pet_type", parentPet.PetType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs new file mode 100644 index 000000000000..8e7b548b39fd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pet.cs @@ -0,0 +1,396 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Pet + /// + public partial class Pet : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + /// photoUrls + /// category + /// id + /// pet status in the store + /// tags + [JsonConstructor] + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) + { + Name = name; + PhotoUrls = photoUrls; + CategoryOption = category; + IdOption = id; + StatusOption = status; + TagsOption = tags; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + /// + /// Enum Available for value: available + /// + Available = 1, + + /// + /// Enum Pending for value: pending + /// + Pending = 2, + + /// + /// Enum Sold for value: sold + /// + Sold = 3 + } + + /// + /// Returns a + /// + /// + /// + /// + public static StatusEnum StatusEnumFromString(string value) + { + if (value.Equals("available")) + return StatusEnum.Available; + + if (value.Equals("pending")) + return StatusEnum.Pending; + + if (value.Equals("sold")) + return StatusEnum.Sold; + + throw new NotImplementedException($"Could not convert value to type StatusEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static StatusEnum? StatusEnumFromStringOrDefault(string value) + { + if (value.Equals("available")) + return StatusEnum.Available; + + if (value.Equals("pending")) + return StatusEnum.Pending; + + if (value.Equals("sold")) + return StatusEnum.Sold; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string StatusEnumToJsonValue(StatusEnum? value) + { + if (value == StatusEnum.Available) + return "available"; + + if (value == StatusEnum.Pending) + return "pending"; + + if (value == StatusEnum.Sold) + return "sold"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// pet status in the store + /// + /// pet status in the store + [JsonPropertyName("status")] + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Gets or Sets Name + /// + /* doggie */ + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or Sets PhotoUrls + /// + [JsonPropertyName("photoUrls")] + public List PhotoUrls { get; set; } + + /// + /// Used to track the state of Category + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CategoryOption { get; private set; } + + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Category Category { get { return this.CategoryOption; } set { this.CategoryOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Tags + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> TagsOption { get; private set; } + + /// + /// Gets or Sets Tags + /// + [JsonPropertyName("tags")] + public List Tags { get { return this.TagsOption; } set { this.TagsOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Pet {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Tags: ").Append(Tags).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PetJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + Option> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option> tags = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + case "photoUrls": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "status": + string statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); + break; + case "tags": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (!name.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(name)); + + if (!photoUrls.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); + + if (photoUrls.IsSet && photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); + + if (category.IsSet && category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + + if (tags.IsSet && tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + + return new Pet(name.Value, photoUrls.Value, category, id, status, tags); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, pet, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) + { + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.CategoryOption.IsSet && pet.Category == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + + if (pet.TagsOption.IsSet && pet.Tags == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + + writer.WriteString("name", pet.Name); + + writer.WritePropertyName("photoUrls"); + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.CategoryOption.IsSet) + { + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + } + if (pet.IdOption.IsSet) + writer.WriteNumber("id", pet.IdOption.Value.Value); + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value.Value); + writer.WriteString("status", statusRawValue); + if (pet.TagsOption.IsSet) + { + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pig.cs new file mode 100644 index 000000000000..b6f300c94400 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Pig.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Pig + /// + public partial class Pig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Pig(BasquePig basquePig) + { + BasquePig = basquePig; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Pig(DanishPig danishPig) + { + DanishPig = danishPig; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets BasquePig + /// + public BasquePig BasquePig { get; set; } + + /// + /// Gets or Sets DanishPig + /// + public DanishPig DanishPig { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Pig {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + BasquePig basquePig = null; + DanishPig danishPig = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("className")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("BasquePig")) + { + Utf8JsonReader utf8JsonReaderBasquePig = utf8JsonReader; + basquePig = JsonSerializer.Deserialize(ref utf8JsonReaderBasquePig, jsonSerializerOptions); + } + if (discriminator.Equals("DanishPig")) + { + Utf8JsonReader utf8JsonReaderDanishPig = utf8JsonReader; + danishPig = JsonSerializer.Deserialize(ref utf8JsonReaderDanishPig, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Pig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); + + if (basquePig != null) + return new Pig(basquePig); + + if (danishPig != null) + return new Pig(danishPig); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (pig.BasquePig != null) + { + BasquePigJsonConverter basquePigJsonConverter = (BasquePigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.BasquePig.GetType())); + basquePigJsonConverter.WriteProperties(writer, pig.BasquePig, jsonSerializerOptions); + } + + if (pig.DanishPig != null) + { + DanishPigJsonConverter danishPigJsonConverter = (DanishPigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.DanishPig.GetType())); + danishPigJsonConverter.WriteProperties(writer, pig.DanishPig, jsonSerializerOptions); + } + + WriteProperties(writer, pig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs new file mode 100644 index 000000000000..ddea47edf40c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// PolymorphicProperty + /// + public partial class PolymorphicProperty : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(bool @bool) + { + Bool = @bool; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(string @string) + { + String = @string; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(Object @object) + { + Object = @object; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(List list) + { + List = list; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get; set; } + + /// + /// Gets or Sets String + /// + public string String { get; set; } + + /// + /// Gets or Sets Object + /// + public Object Object { get; set; } + + /// + /// Gets or Sets List + /// + public List List { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PolymorphicProperty {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PolymorphicPropertyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + bool? varBool = default; + string varString = default; + Object varObject = default; + List list = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderObject = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderObject, jsonSerializerOptions, out varObject); + + Utf8JsonReader utf8JsonReaderList = utf8JsonReader; + ClientUtils.TryDeserialize>(ref utf8JsonReaderList, jsonSerializerOptions, out list); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varBool != null) + return new PolymorphicProperty(varBool.Value); + + if (varString != null) + return new PolymorphicProperty(varString); + + if (varObject != null) + return new PolymorphicProperty(varObject); + + if (list != null) + return new PolymorphicProperty(list); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, polymorphicProperty, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs new file mode 100644 index 000000000000..e8a2e2439975 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Quadrilateral + /// + public partial class Quadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Quadrilateral(SimpleQuadrilateral simpleQuadrilateral) + { + SimpleQuadrilateral = simpleQuadrilateral; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Quadrilateral(ComplexQuadrilateral complexQuadrilateral) + { + ComplexQuadrilateral = complexQuadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets SimpleQuadrilateral + /// + public SimpleQuadrilateral SimpleQuadrilateral { get; set; } + + /// + /// Gets or Sets ComplexQuadrilateral + /// + public ComplexQuadrilateral ComplexQuadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Quadrilateral {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class QuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + + ComplexQuadrilateral complexQuadrilateral = null; + SimpleQuadrilateral simpleQuadrilateral = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("quadrilateralType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("ComplexQuadrilateral")) + { + Utf8JsonReader utf8JsonReaderComplexQuadrilateral = utf8JsonReader; + complexQuadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderComplexQuadrilateral, jsonSerializerOptions); + } + if (discriminator.Equals("SimpleQuadrilateral")) + { + Utf8JsonReader utf8JsonReaderSimpleQuadrilateral = utf8JsonReader; + simpleQuadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderSimpleQuadrilateral, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); + + if (complexQuadrilateral != null) + return new Quadrilateral(complexQuadrilateral); + + if (simpleQuadrilateral != null) + return new Quadrilateral(simpleQuadrilateral); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (quadrilateral.SimpleQuadrilateral != null) + { + SimpleQuadrilateralJsonConverter simpleQuadrilateralJsonConverter = (SimpleQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.SimpleQuadrilateral.GetType())); + simpleQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.SimpleQuadrilateral, jsonSerializerOptions); + } + + if (quadrilateral.ComplexQuadrilateral != null) + { + ComplexQuadrilateralJsonConverter complexQuadrilateralJsonConverter = (ComplexQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.ComplexQuadrilateral.GetType())); + complexQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.ComplexQuadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, quadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs new file mode 100644 index 000000000000..519ed66393ca --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// QuadrilateralInterface + /// + public partial class QuadrilateralInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + [JsonConstructor] + public QuadrilateralInterface(string quadrilateralType) + { + QuadrilateralType = quadrilateralType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class QuadrilateralInterface {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class QuadrilateralInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + return new QuadrilateralInterface(quadrilateralType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, quadrilateralInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs new file mode 100644 index 000000000000..b1907fda8183 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ReadOnlyFirst + /// + public partial class ReadOnlyFirst : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar + /// baz + [JsonConstructor] + public ReadOnlyFirst(Option bar = default, Option baz = default) + { + BarOption = bar; + BazOption = baz; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string Bar { get { return this.BarOption; } } + + /// + /// Used to track the state of Baz + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BazOption { get; private set; } + + /// + /// Gets or Sets Baz + /// + [JsonPropertyName("baz")] + public string Baz { get { return this.BazOption; } set { this.BazOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ReadOnlyFirst {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Baz: ").Append(Baz).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ReadOnlyFirst).AreEqual; + } + + /// + /// Returns true if ReadOnlyFirst instances are equal + /// + /// Instance of ReadOnlyFirst to be compared + /// Boolean + public bool Equals(ReadOnlyFirst input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ReadOnlyFirstJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + Option baz = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()); + break; + case "baz": + baz = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); + + if (baz.IsSet && baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); + + return new ReadOnlyFirst(bar, baz); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, readOnlyFirst, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) + { + if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BarOption.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar); + + if (readOnlyFirst.BazOption.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..f1483ce99399 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,2378 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + [JsonConstructor] + public RequiredClass(DateOnly requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateOnly? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; + NotRequiredNullableDatePropOption = notRequiredNullableDateProp; + NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; + NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumIntegerOption = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnlyOption = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumStringOption = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValueOption = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringPropOption = notrequiredNullableStringProp; + NotrequiredNullableUuidOption = notrequiredNullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNullableEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateOnly RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Used to track the state of NotRequiredNotnullableDateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNotnullableDatePropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateOnly? NotRequiredNotnullableDateProp { get { return this.NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNotnullableintegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNotnullableintegerPropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this.NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNullableDateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNullableDatePropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public DateOnly? NotRequiredNullableDateProp { get { return this.NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNullableIntegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNullableIntegerPropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this.NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List NotrequiredNotnullableArrayOfString { get { return this.NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableBooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this.NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this.NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableStringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableStringPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string NotrequiredNotnullableStringProp { get { return this.NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableUuidOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this.NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> NotrequiredNullableArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public List NotrequiredNullableArrayOfString { get { return this.NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableBooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableBooleanPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public bool? NotrequiredNullableBooleanProp { get { return this.NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableDatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableDatetimePropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public DateTime? NotrequiredNullableDatetimeProp { get { return this.NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableStringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableStringPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public string NotrequiredNullableStringProp { get { return this.NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableUuidOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("notrequired_nullable_uuid")] + public Guid? NotrequiredNullableUuid { get { return this.NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateOnly? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + Option> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); + + if (requiredNotNullableDateProp.IsSet && requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.IsSet && requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.IsSet && requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.IsSet && requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.IsSet && requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.IsSet && requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.IsSet && requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.IsSet && requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.IsSet && requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.IsSet && requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.IsSet && requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.IsSet && notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.IsSet && notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.IsSet && notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.IsSet && notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.IsSet && notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.IsSet && notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.IsSet && notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.IsSet && notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.IsSet && notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.IsSet && notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); + + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); + + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); + + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); + + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); + + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); + + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); + + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); + + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); + + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) + if (requiredClass.NotRequiredNullableDatePropOption.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); + + if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) + if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); + + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) + if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) + if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + + if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) + if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + + if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); + + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value.Value); + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value != null) + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value.Value); + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringPropOption.IsSet) + if (requiredClass.NotrequiredNullableStringPropOption.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); + else + writer.WriteNull("notrequired_nullable_string_prop"); + + if (requiredClass.NotrequiredNullableUuidOption.IsSet) + if (requiredClass.NotrequiredNullableUuidOption.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value.Value); + else + writer.WriteNull("notrequired_nullable_uuid"); + + if (requiredClass.RequiredNullableArrayOfString != null) + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); + + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); + + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); + + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); + + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); + + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString.Value); + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); + + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); + + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs new file mode 100644 index 000000000000..9d1fbcfd0f6f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Return.cs @@ -0,0 +1,246 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing reserved words + /// + public partial class Return : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lock + /// abstract + /// varReturn + /// unsafe + [JsonConstructor] + public Return(string @lock, string @abstract = default, Option varReturn = default, Option @unsafe = default) + { + Lock = @lock; + Abstract = @abstract; + VarReturnOption = varReturn; + UnsafeOption = @unsafe; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Lock + /// + [JsonPropertyName("lock")] + public string Lock { get; set; } + + /// + /// Gets or Sets Abstract + /// + [JsonPropertyName("abstract")] + public string Abstract { get; set; } + + /// + /// Used to track the state of VarReturn + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarReturnOption { get; private set; } + + /// + /// Gets or Sets VarReturn + /// + [JsonPropertyName("return")] + public int? VarReturn { get { return this.VarReturnOption; } set { this.VarReturnOption = new(value); } } + + /// + /// Used to track the state of Unsafe + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsafeOption { get; private set; } + + /// + /// Gets or Sets Unsafe + /// + [JsonPropertyName("unsafe")] + public string Unsafe { get { return this.UnsafeOption; } set { this.UnsafeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Return {\n"); + sb.Append(" Lock: ").Append(Lock).Append("\n"); + sb.Append(" Abstract: ").Append(Abstract).Append("\n"); + sb.Append(" VarReturn: ").Append(VarReturn).Append("\n"); + sb.Append(" Unsafe: ").Append(Unsafe).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ReturnJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varLock = default; + Option varAbstract = default; + Option varReturn = default; + Option varUnsafe = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lock": + varLock = new Option(utf8JsonReader.GetString()); + break; + case "abstract": + varAbstract = new Option(utf8JsonReader.GetString()); + break; + case "return": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varReturn = new Option(utf8JsonReader.GetInt32()); + break; + case "unsafe": + varUnsafe = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!varLock.IsSet) + throw new ArgumentException("Property is required for class Return.", nameof(varLock)); + + if (!varAbstract.IsSet) + throw new ArgumentException("Property is required for class Return.", nameof(varAbstract)); + + if (varLock.IsSet && varLock.Value == null) + throw new ArgumentNullException(nameof(varLock), "Property is not nullable for class Return."); + + if (varReturn.IsSet && varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); + + if (varUnsafe.IsSet && varUnsafe.Value == null) + throw new ArgumentNullException(nameof(varUnsafe), "Property is not nullable for class Return."); + + return new Return(varLock.Value, varAbstract.Value, varReturn, varUnsafe); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, varReturn, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) + { + if (varReturn.Lock == null) + throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); + + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) + throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + + writer.WriteString("lock", varReturn.Lock); + + if (varReturn.Abstract != null) + writer.WriteString("abstract", varReturn.Abstract); + else + writer.WriteNull("abstract"); + + if (varReturn.VarReturnOption.IsSet) + writer.WriteNumber("return", varReturn.VarReturnOption.Value.Value); + + if (varReturn.UnsafeOption.IsSet) + writer.WriteString("unsafe", varReturn.Unsafe); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs new file mode 100644 index 000000000000..749507fe8e0c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -0,0 +1,204 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Role report Hash + /// + public partial class RolesReportsHash : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// role + /// roleUuid + [JsonConstructor] + public RolesReportsHash(Option role = default, Option roleUuid = default) + { + RoleOption = role; + RoleUuidOption = roleUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Role + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option RoleOption { get; private set; } + + /// + /// Gets or Sets Role + /// + [JsonPropertyName("role")] + public RolesReportsHashRole Role { get { return this.RoleOption; } set { this.RoleOption = new(value); } } + + /// + /// Used to track the state of RoleUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option RoleUuidOption { get; private set; } + + /// + /// Gets or Sets RoleUuid + /// + [JsonPropertyName("role_uuid")] + public Guid? RoleUuid { get { return this.RoleUuidOption; } set { this.RoleUuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RolesReportsHash {\n"); + sb.Append(" Role: ").Append(Role).Append("\n"); + sb.Append(" RoleUuid: ").Append(RoleUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RolesReportsHashJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option role = default; + Option roleUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "role": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "role_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + roleUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (role.IsSet && role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); + + if (roleUuid.IsSet && roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); + + return new RolesReportsHash(role, roleUuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, rolesReportsHash, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) + { + if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + + if (rolesReportsHash.RoleOption.IsSet) + { + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + } + if (rolesReportsHash.RoleUuidOption.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs new file mode 100644 index 000000000000..5b5b7899e3cf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RolesReportsHashRole + /// + public partial class RolesReportsHashRole : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public RolesReportsHashRole(Option name = default) + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RolesReportsHashRole {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RolesReportsHashRoleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); + + return new RolesReportsHashRole(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, rolesReportsHashRole, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) + { + if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + + if (rolesReportsHashRole.NameOption.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs new file mode 100644 index 000000000000..5c960eb54744 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ScaleneTriangle + /// + public partial class ScaleneTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public ScaleneTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ScaleneTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ScaleneTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + return new ScaleneTriangle(shapeType.Value, triangleType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, scaleneTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + + writer.WriteString("triangleType", scaleneTriangle.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Shape.cs new file mode 100644 index 000000000000..c651ac7d2454 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Shape.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Shape + /// + public partial class Shape : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Shape(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Shape(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Shape {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral quadrilateral = null; + Triangle triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("shapeType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("Quadrilateral")) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator.Equals("Triangle")) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); + + if (quadrilateral != null) + return new Shape(quadrilateral); + + if (triangle != null) + return new Shape(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (shape.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, shape.Triangle, jsonSerializerOptions); + } + + if (shape.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, shape.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, shape, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs new file mode 100644 index 000000000000..37db5df64908 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ShapeInterface + /// + public partial class ShapeInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + [JsonConstructor] + public ShapeInterface(string shapeType) + { + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShapeInterface {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + return new ShapeInterface(shapeType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, shapeInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + + writer.WriteString("shapeType", shapeInterface.ShapeType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs new file mode 100644 index 000000000000..1f0b22030070 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + /// + public partial class ShapeOrNull : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public ShapeOrNull(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public ShapeOrNull(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShapeOrNull {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeOrNullJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral quadrilateral = null; + Triangle triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("shapeType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("Quadrilateral")) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator.Equals("Triangle")) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); + + if (quadrilateral != null) + return new ShapeOrNull(quadrilateral); + + if (triangle != null) + return new ShapeOrNull(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (shapeOrNull.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, shapeOrNull.Triangle, jsonSerializerOptions); + } + + if (shapeOrNull.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, shapeOrNull.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, shapeOrNull, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs new file mode 100644 index 000000000000..ffa68d1e75de --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// SimpleQuadrilateral + /// + public partial class SimpleQuadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + /// shapeType + [JsonConstructor] + public SimpleQuadrilateral(string quadrilateralType, string shapeType) + { + QuadrilateralType = quadrilateralType; + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SimpleQuadrilateral {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SimpleQuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()); + break; + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + return new SimpleQuadrilateral(quadrilateralType.Value, shapeType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, simpleQuadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs new file mode 100644 index 000000000000..08b9d580d9f1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -0,0 +1,201 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// SpecialModelName + /// + public partial class SpecialModelName : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varSpecialModelName + /// specialPropertyName + [JsonConstructor] + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) + { + VarSpecialModelNameOption = varSpecialModelName; + SpecialPropertyNameOption = specialPropertyName; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of VarSpecialModelName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarSpecialModelNameOption { get; private set; } + + /// + /// Gets or Sets VarSpecialModelName + /// + [JsonPropertyName("_special_model.name_")] + public string VarSpecialModelName { get { return this.VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } + + /// + /// Used to track the state of SpecialPropertyName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SpecialPropertyNameOption { get; private set; } + + /// + /// Gets or Sets SpecialPropertyName + /// + [JsonPropertyName("$special[property.name]")] + public long? SpecialPropertyName { get { return this.SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SpecialModelName {\n"); + sb.Append(" VarSpecialModelName: ").Append(VarSpecialModelName).Append("\n"); + sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SpecialModelNameJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varSpecialModelName = default; + Option specialPropertyName = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "_special_model.name_": + varSpecialModelName = new Option(utf8JsonReader.GetString()); + break; + case "$special[property.name]": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + specialPropertyName = new Option(utf8JsonReader.GetInt64()); + break; + default: + break; + } + } + } + + if (varSpecialModelName.IsSet && varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); + + if (specialPropertyName.IsSet && specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); + + return new SpecialModelName(varSpecialModelName, specialPropertyName); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, specialModelName, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) + { + if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + + if (specialModelName.VarSpecialModelNameOption.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); + + if (specialModelName.SpecialPropertyNameOption.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs new file mode 100644 index 000000000000..d5fb2f5610ad --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Tag.cs @@ -0,0 +1,201 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Tag + /// + public partial class Tag : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + /// name + [JsonConstructor] + public Tag(Option id = default, Option name = default) + { + IdOption = id; + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Tag {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TagJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "name": + name = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); + + return new Tag(id, name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, tag, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) + { + if (tag.NameOption.IsSet && tag.Name == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + + if (tag.IdOption.IsSet) + writer.WriteNumber("id", tag.IdOption.Value.Value); + + if (tag.NameOption.IsSet) + writer.WriteString("name", tag.Name); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs new file mode 100644 index 000000000000..215caa45302b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestCollectionEndingWithWordList + /// + public partial class TestCollectionEndingWithWordList : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// value + [JsonConstructor] + public TestCollectionEndingWithWordList(Option value = default) + { + ValueOption = value; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Value + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ValueOption { get; private set; } + + /// + /// Gets or Sets Value + /// + [JsonPropertyName("value")] + public string Value { get { return this.ValueOption; } set { this.ValueOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestCollectionEndingWithWordList {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestCollectionEndingWithWordListJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option value = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "value": + value = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (value.IsSet && value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); + + return new TestCollectionEndingWithWordList(value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testCollectionEndingWithWordList, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) + { + if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + + if (testCollectionEndingWithWordList.ValueOption.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs new file mode 100644 index 000000000000..1936341f8ba6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -0,0 +1,178 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestCollectionEndingWithWordListObject + /// + public partial class TestCollectionEndingWithWordListObject : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// testCollectionEndingWithWordList + [JsonConstructor] + public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) + { + TestCollectionEndingWithWordListOption = testCollectionEndingWithWordList; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of TestCollectionEndingWithWordList + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option> TestCollectionEndingWithWordListOption { get; private set; } + + /// + /// Gets or Sets TestCollectionEndingWithWordList + /// + [JsonPropertyName("TestCollectionEndingWithWordList")] + public List TestCollectionEndingWithWordList { get { return this.TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestCollectionEndingWithWordListObject {\n"); + sb.Append(" TestCollectionEndingWithWordList: ").Append(TestCollectionEndingWithWordList).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestCollectionEndingWithWordListObjectJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option> testCollectionEndingWithWordList = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "TestCollectionEndingWithWordList": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); + + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testCollectionEndingWithWordListObject, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) + { + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) + { + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs new file mode 100644 index 000000000000..fbd7dddd9dce --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestInlineFreeformAdditionalPropertiesRequest + /// + public partial class TestInlineFreeformAdditionalPropertiesRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// someProperty + [JsonConstructor] + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) + { + SomePropertyOption = someProperty; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of SomeProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SomePropertyOption { get; private set; } + + /// + /// Gets or Sets SomeProperty + /// + [JsonPropertyName("someProperty")] + public string SomeProperty { get { return this.SomePropertyOption; } set { this.SomePropertyOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.Append(" SomeProperty: ").Append(SomeProperty).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestInlineFreeformAdditionalPropertiesRequestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option someProperty = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "someProperty": + someProperty = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (someProperty.IsSet && someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); + + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testInlineFreeformAdditionalPropertiesRequest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) + { + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Triangle.cs new file mode 100644 index 000000000000..cf22051519ad --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Triangle.cs @@ -0,0 +1,269 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Triangle + /// + public partial class Triangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(EquilateralTriangle equilateralTriangle) + { + EquilateralTriangle = equilateralTriangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(IsoscelesTriangle isoscelesTriangle) + { + IsoscelesTriangle = isoscelesTriangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(ScaleneTriangle scaleneTriangle) + { + ScaleneTriangle = scaleneTriangle; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets EquilateralTriangle + /// + public EquilateralTriangle EquilateralTriangle { get; set; } + + /// + /// Gets or Sets IsoscelesTriangle + /// + public IsoscelesTriangle IsoscelesTriangle { get; set; } + + /// + /// Gets or Sets ScaleneTriangle + /// + public ScaleneTriangle ScaleneTriangle { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Triangle {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option triangleType = default; + + EquilateralTriangle equilateralTriangle = null; + IsoscelesTriangle isoscelesTriangle = null; + ScaleneTriangle scaleneTriangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName.Equals("triangleType")) + { + string discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator.Equals("EquilateralTriangle")) + { + Utf8JsonReader utf8JsonReaderEquilateralTriangle = utf8JsonReader; + equilateralTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderEquilateralTriangle, jsonSerializerOptions); + } + if (discriminator.Equals("IsoscelesTriangle")) + { + Utf8JsonReader utf8JsonReaderIsoscelesTriangle = utf8JsonReader; + isoscelesTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderIsoscelesTriangle, jsonSerializerOptions); + } + if (discriminator.Equals("ScaleneTriangle")) + { + Utf8JsonReader utf8JsonReaderScaleneTriangle = utf8JsonReader; + scaleneTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderScaleneTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); + + if (equilateralTriangle != null) + return new Triangle(equilateralTriangle); + + if (isoscelesTriangle != null) + return new Triangle(isoscelesTriangle); + + if (scaleneTriangle != null) + return new Triangle(scaleneTriangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (triangle.EquilateralTriangle != null) + { + EquilateralTriangleJsonConverter equilateralTriangleJsonConverter = (EquilateralTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.EquilateralTriangle.GetType())); + equilateralTriangleJsonConverter.WriteProperties(writer, triangle.EquilateralTriangle, jsonSerializerOptions); + } + + if (triangle.IsoscelesTriangle != null) + { + IsoscelesTriangleJsonConverter isoscelesTriangleJsonConverter = (IsoscelesTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.IsoscelesTriangle.GetType())); + isoscelesTriangleJsonConverter.WriteProperties(writer, triangle.IsoscelesTriangle, jsonSerializerOptions); + } + + if (triangle.ScaleneTriangle != null) + { + ScaleneTriangleJsonConverter scaleneTriangleJsonConverter = (ScaleneTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.ScaleneTriangle.GetType())); + scaleneTriangleJsonConverter.WriteProperties(writer, triangle.ScaleneTriangle, jsonSerializerOptions); + } + + WriteProperties(writer, triangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) + { + + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs new file mode 100644 index 000000000000..0f13b0e77451 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -0,0 +1,169 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TriangleInterface + /// + public partial class TriangleInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// triangleType + [JsonConstructor] + public TriangleInterface(string triangleType) + { + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TriangleInterface {\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TriangleInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + return new TriangleInterface(triangleType.Value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, triangleInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + + writer.WriteString("triangleType", triangleInterface.TriangleType); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs new file mode 100644 index 000000000000..0c2e096925ef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/User.cs @@ -0,0 +1,497 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// User + /// + public partial class User : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// 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 + /// 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. + /// email + /// firstName + /// id + /// lastName + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// password + /// phone + /// User Status + /// username + [JsonConstructor] + public User(Option anyTypeProp = default, Option anyTypePropNullable = default, Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option objectWithNoDeclaredPropsNullable = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default) + { + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; + EmailOption = email; + FirstNameOption = firstName; + IdOption = id; + LastNameOption = lastName; + ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; + PasswordOption = password; + PhoneOption = phone; + UserStatusOption = userStatus; + UsernameOption = username; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropOption { get; private set; } + + /// + /// 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 + /// + /// 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 + [JsonPropertyName("anyTypeProp")] + public Object AnyTypeProp { get { return this.AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropNullableOption { get; private set; } + + /// + /// 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. + /// + /// 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. + [JsonPropertyName("anyTypePropNullable")] + public Object AnyTypePropNullable { get { return this.AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } + + /// + /// Used to track the state of Email + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EmailOption { get; private set; } + + /// + /// Gets or Sets Email + /// + [JsonPropertyName("email")] + public string Email { get { return this.EmailOption; } set { this.EmailOption = new(value); } } + + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FirstNameOption { get; private set; } + + /// + /// Gets or Sets FirstName + /// + [JsonPropertyName("firstName")] + public string FirstName { get { return this.FirstNameOption; } set { this.FirstNameOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option LastNameOption { get; private set; } + + /// + /// Gets or Sets LastName + /// + [JsonPropertyName("lastName")] + public string LastName { get { return this.LastNameOption; } set { this.LastNameOption = new(value); } } + + /// + /// Used to track the state of ObjectWithNoDeclaredProps + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsOption { get; private set; } + + /// + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + [JsonPropertyName("objectWithNoDeclaredProps")] + public Object ObjectWithNoDeclaredProps { get { return this.ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } + + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } + + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + [JsonPropertyName("objectWithNoDeclaredPropsNullable")] + public Object ObjectWithNoDeclaredPropsNullable { get { return this.ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } + + /// + /// Used to track the state of Password + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PasswordOption { get; private set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get { return this.PasswordOption; } set { this.PasswordOption = new(value); } } + + /// + /// Used to track the state of Phone + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PhoneOption { get; private set; } + + /// + /// Gets or Sets Phone + /// + [JsonPropertyName("phone")] + public string Phone { get { return this.PhoneOption; } set { this.PhoneOption = new(value); } } + + /// + /// Used to track the state of UserStatus + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UserStatusOption { get; private set; } + + /// + /// User Status + /// + /// User Status + [JsonPropertyName("userStatus")] + public int? UserStatus { get { return this.UserStatusOption; } set { this.UserStatusOption = new(value); } } + + /// + /// Used to track the state of Username + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UsernameOption { get; private set; } + + /// + /// Gets or Sets Username + /// + [JsonPropertyName("username")] + public string Username { get { return this.UsernameOption; } set { this.UsernameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class User {\n"); + sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); + sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append("\n"); + sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); + sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class UserJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option objectWithNoDeclaredPropsNullable = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "anyTypeProp": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "anyTypePropNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "email": + email = new Option(utf8JsonReader.GetString()); + break; + case "firstName": + firstName = new Option(utf8JsonReader.GetString()); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "lastName": + lastName = new Option(utf8JsonReader.GetString()); + break; + case "objectWithNoDeclaredProps": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "objectWithNoDeclaredPropsNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "password": + password = new Option(utf8JsonReader.GetString()); + break; + case "phone": + phone = new Option(utf8JsonReader.GetString()); + break; + case "userStatus": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + userStatus = new Option(utf8JsonReader.GetInt32()); + break; + case "username": + username = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (email.IsSet && email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); + + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); + + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); + + if (objectWithNoDeclaredProps.IsSet && objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); + + if (phone.IsSet && phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); + + if (userStatus.IsSet && userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); + + if (username.IsSet && username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); + + return new User(anyTypeProp, anyTypePropNullable, email, firstName, id, lastName, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, password, phone, userStatus, username); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, user, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) + { + if (user.EmailOption.IsSet && user.Email == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstNameOption.IsSet && user.FirstName == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastNameOption.IsSet && user.LastName == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.PasswordOption.IsSet && user.Password == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.PhoneOption.IsSet && user.Phone == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.UsernameOption.IsSet && user.Username == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + + if (user.AnyTypePropOption.IsSet) + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.EmailOption.IsSet) + writer.WriteString("email", user.Email); + + if (user.FirstNameOption.IsSet) + writer.WriteString("firstName", user.FirstName); + + if (user.IdOption.IsSet) + writer.WriteNumber("id", user.IdOption.Value.Value); + + if (user.LastNameOption.IsSet) + writer.WriteString("lastName", user.LastName); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet) + { + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + } + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); + if (user.PasswordOption.IsSet) + writer.WriteString("password", user.Password); + + if (user.PhoneOption.IsSet) + writer.WriteString("phone", user.Phone); + + if (user.UserStatusOption.IsSet) + writer.WriteNumber("userStatus", user.UserStatusOption.Value.Value); + + if (user.UsernameOption.IsSet) + writer.WriteString("username", user.Username); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs new file mode 100644 index 000000000000..a445c5ac182b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Whale.cs @@ -0,0 +1,223 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Whale + /// + public partial class Whale : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + /// hasBaleen + /// hasTeeth + [JsonConstructor] + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) + { + ClassName = className; + HasBaleenOption = hasBaleen; + HasTeethOption = hasTeeth; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Used to track the state of HasBaleen + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option HasBaleenOption { get; private set; } + + /// + /// Gets or Sets HasBaleen + /// + [JsonPropertyName("hasBaleen")] + public bool? HasBaleen { get { return this.HasBaleenOption; } set { this.HasBaleenOption = new(value); } } + + /// + /// Used to track the state of HasTeeth + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option HasTeethOption { get; private set; } + + /// + /// Gets or Sets HasTeeth + /// + [JsonPropertyName("hasTeeth")] + public bool? HasTeeth { get { return this.HasTeethOption; } set { this.HasTeethOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Whale {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" HasBaleen: ").Append(HasBaleen).Append("\n"); + sb.Append(" HasTeeth: ").Append(HasTeeth).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class WhaleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "hasBaleen": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + hasBaleen = new Option(utf8JsonReader.GetBoolean()); + break; + case "hasTeeth": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + hasTeeth = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Whale.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); + + if (hasBaleen.IsSet && hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); + + if (hasTeeth.IsSet && hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); + + return new Whale(className.Value, hasBaleen, hasTeeth); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, whale, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) + { + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + + writer.WriteString("className", whale.ClassName); + + if (whale.HasBaleenOption.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value.Value); + + if (whale.HasTeethOption.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value.Value); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs new file mode 100644 index 000000000000..0efe7f985a3a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/Zebra.cs @@ -0,0 +1,277 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Zebra + /// + public partial class Zebra : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + /// type + [JsonConstructor] + public Zebra(string className, Option type = default) + { + ClassName = className; + TypeOption = type; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines Type + /// + public enum TypeEnum + { + /// + /// Enum Plains for value: plains + /// + Plains = 1, + + /// + /// Enum Mountain for value: mountain + /// + Mountain = 2, + + /// + /// Enum Grevys for value: grevys + /// + Grevys = 3 + } + + /// + /// Returns a + /// + /// + /// + /// + public static TypeEnum TypeEnumFromString(string value) + { + if (value.Equals("plains")) + return TypeEnum.Plains; + + if (value.Equals("mountain")) + return TypeEnum.Mountain; + + if (value.Equals("grevys")) + return TypeEnum.Grevys; + + throw new NotImplementedException($"Could not convert value to type TypeEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static TypeEnum? TypeEnumFromStringOrDefault(string value) + { + if (value.Equals("plains")) + return TypeEnum.Plains; + + if (value.Equals("mountain")) + return TypeEnum.Mountain; + + if (value.Equals("grevys")) + return TypeEnum.Grevys; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string TypeEnumToJsonValue(TypeEnum? value) + { + if (value == TypeEnum.Plains) + return "plains"; + + if (value == TypeEnum.Mountain) + return "mountain"; + + if (value == TypeEnum.Grevys) + return "grevys"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TypeOption { get; private set; } + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Zebra {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ZebraJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option type = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()); + break; + case "type": + string typeRawValue = utf8JsonReader.GetString(); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + + return new Zebra(className.Value, type); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, zebra, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) + { + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + + writer.WriteString("className", zebra.ClassName); + + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); + writer.WriteString("type", typeRawValue); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs new file mode 100644 index 000000000000..34a044fb8b13 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + } + + /// + /// Converts to and from the JSON value + /// + public static class ZeroBasedEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnum FromString(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnum? FromStringOrDefault(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnum.NotUnknown; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(ZeroBasedEnum value) + { + if (value == ZeroBasedEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class ZeroBasedEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the ZeroBasedEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnum zeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnum.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class ZeroBasedEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a ZeroBasedEnum from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string rawValue = reader.GetString(); + + ZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnum? zeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnum?.ToString() ?? "null"); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 000000000000..9722305fcb2a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,239 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + public partial class ZeroBasedEnumClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum + [JsonConstructor] + public ZeroBasedEnumClass(Option zeroBasedEnum = default) + { + ZeroBasedEnumOption = zeroBasedEnum; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + } + + /// + /// Returns a + /// + /// + /// + /// + public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnumEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnumEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnumEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static ZeroBasedEnumEnum? ZeroBasedEnumEnumFromStringOrDefault(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnumEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnumEnum.NotUnknown; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) + { + if (value == ZeroBasedEnumEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnumEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of ZeroBasedEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ZeroBasedEnumOption { get; private set; } + + /// + /// Gets or Sets ZeroBasedEnum + /// + [JsonPropertyName("ZeroBasedEnum")] + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ZeroBasedEnumClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option zeroBasedEnum = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ZeroBasedEnum": + string zeroBasedEnumRawValue = utf8JsonReader.GetString(); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); + break; + default: + break; + } + } + } + + if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); + + return new ZeroBasedEnumClass(zeroBasedEnum); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, zeroBasedEnumClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); + writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..cd46b39d2076 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,31 @@ + + + + true + net9.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + false + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..5d92cf7b732d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/README.md @@ -0,0 +1,223 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net9.0', + 'validatable=true', + 'nullableReferenceTypes=false', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + Call123TestSpecialTagsApiResponse apiResponse = await api.Call123TestSpecialTagsAsync("todo"); + ModelClient model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + // the type of token here depends on the api security specifications + ApiKeyToken token = new("", ClientUtils.ApiKeyHeader.Authorization); + options.AddTokens(token); + + // optionally choose the method the tokens will be provided with, default is RateLimitProvider + options.UseProvider, ApiKeyToken>(); + + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: +- write:pets: modify pets in your account +- read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api-key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: Bearer Authentication + + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.11.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: OpenAPI Petstore +- appVersion: 1.0.0 +- appDescription: This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: false +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: false +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net9.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.gitignore b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/FILES new file mode 100644 index 000000000000..afb25a1c17e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/FILES @@ -0,0 +1,246 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/AnotherFakeApi.md +docs/apis/DefaultApi.md +docs/apis/FakeApi.md +docs/apis/FakeClassnameTags123Api.md +docs/apis/PetApi.md +docs/apis/StoreApi.md +docs/apis/UserApi.md +docs/models/Activity.md +docs/models/ActivityOutputElementRepresentation.md +docs/models/AdditionalPropertiesClass.md +docs/models/Animal.md +docs/models/ApiResponse.md +docs/models/Apple.md +docs/models/AppleReq.md +docs/models/ArrayOfArrayOfNumberOnly.md +docs/models/ArrayOfNumberOnly.md +docs/models/ArrayTest.md +docs/models/Banana.md +docs/models/BananaReq.md +docs/models/BasquePig.md +docs/models/Capitalization.md +docs/models/Cat.md +docs/models/Category.md +docs/models/ChildCat.md +docs/models/ClassModel.md +docs/models/ComplexQuadrilateral.md +docs/models/DanishPig.md +docs/models/DateOnlyClass.md +docs/models/DeprecatedObject.md +docs/models/Dog.md +docs/models/Drawing.md +docs/models/EnumArrays.md +docs/models/EnumClass.md +docs/models/EnumTest.md +docs/models/EquilateralTriangle.md +docs/models/File.md +docs/models/FileSchemaTestClass.md +docs/models/Foo.md +docs/models/FooGetDefaultResponse.md +docs/models/FormatTest.md +docs/models/Fruit.md +docs/models/FruitReq.md +docs/models/GmFruit.md +docs/models/GrandparentAnimal.md +docs/models/HasOnlyReadOnly.md +docs/models/HealthCheckResult.md +docs/models/IsoscelesTriangle.md +docs/models/List.md +docs/models/LiteralStringClass.md +docs/models/Mammal.md +docs/models/MapTest.md +docs/models/MixLog.md +docs/models/MixedAnyOf.md +docs/models/MixedAnyOfContent.md +docs/models/MixedOneOf.md +docs/models/MixedOneOfContent.md +docs/models/MixedPropertiesAndAdditionalPropertiesClass.md +docs/models/MixedSubId.md +docs/models/Model200Response.md +docs/models/ModelClient.md +docs/models/Name.md +docs/models/NotificationtestGetElementsV1ResponseMPayload.md +docs/models/NullableClass.md +docs/models/NullableGuidClass.md +docs/models/NullableShape.md +docs/models/NumberOnly.md +docs/models/ObjectWithDeprecatedFields.md +docs/models/OneOfString.md +docs/models/Order.md +docs/models/OuterComposite.md +docs/models/OuterEnum.md +docs/models/OuterEnumDefaultValue.md +docs/models/OuterEnumInteger.md +docs/models/OuterEnumIntegerDefaultValue.md +docs/models/OuterEnumTest.md +docs/models/ParentPet.md +docs/models/Pet.md +docs/models/Pig.md +docs/models/PolymorphicProperty.md +docs/models/Quadrilateral.md +docs/models/QuadrilateralInterface.md +docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md +docs/models/Return.md +docs/models/RolesReportsHash.md +docs/models/RolesReportsHashRole.md +docs/models/ScaleneTriangle.md +docs/models/Shape.md +docs/models/ShapeInterface.md +docs/models/ShapeOrNull.md +docs/models/SimpleQuadrilateral.md +docs/models/SpecialModelName.md +docs/models/Tag.md +docs/models/TestCollectionEndingWithWordList.md +docs/models/TestCollectionEndingWithWordListObject.md +docs/models/TestInlineFreeformAdditionalPropertiesRequest.md +docs/models/Triangle.md +docs/models/TriangleInterface.md +docs/models/User.md +docs/models/Whale.md +docs/models/Zebra.md +docs/models/ZeroBasedEnum.md +docs/models/ZeroBasedEnumClass.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/AnotherFakeApi.cs +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/FakeApi.cs +src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Api/PetApi.cs +src/Org.OpenAPITools/Api/StoreApi.cs +src/Org.OpenAPITools/Api/UserApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiKeyToken.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/BasicToken.cs +src/Org.OpenAPITools/Client/BearerToken.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs +src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +src/Org.OpenAPITools/Client/HttpSigningToken.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/OAuthToken.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/Activity.cs +src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/Animal.cs +src/Org.OpenAPITools/Model/ApiResponse.cs +src/Org.OpenAPITools/Model/Apple.cs +src/Org.OpenAPITools/Model/AppleReq.cs +src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayTest.cs +src/Org.OpenAPITools/Model/Banana.cs +src/Org.OpenAPITools/Model/BananaReq.cs +src/Org.OpenAPITools/Model/BasquePig.cs +src/Org.OpenAPITools/Model/Capitalization.cs +src/Org.OpenAPITools/Model/Cat.cs +src/Org.OpenAPITools/Model/Category.cs +src/Org.OpenAPITools/Model/ChildCat.cs +src/Org.OpenAPITools/Model/ClassModel.cs +src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +src/Org.OpenAPITools/Model/DanishPig.cs +src/Org.OpenAPITools/Model/DateOnlyClass.cs +src/Org.OpenAPITools/Model/DeprecatedObject.cs +src/Org.OpenAPITools/Model/Dog.cs +src/Org.OpenAPITools/Model/Drawing.cs +src/Org.OpenAPITools/Model/EnumArrays.cs +src/Org.OpenAPITools/Model/EnumClass.cs +src/Org.OpenAPITools/Model/EnumTest.cs +src/Org.OpenAPITools/Model/EquilateralTriangle.cs +src/Org.OpenAPITools/Model/File.cs +src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +src/Org.OpenAPITools/Model/FormatTest.cs +src/Org.OpenAPITools/Model/Fruit.cs +src/Org.OpenAPITools/Model/FruitReq.cs +src/Org.OpenAPITools/Model/GmFruit.cs +src/Org.OpenAPITools/Model/GrandparentAnimal.cs +src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +src/Org.OpenAPITools/Model/HealthCheckResult.cs +src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs +src/Org.OpenAPITools/Model/Mammal.cs +src/Org.OpenAPITools/Model/MapTest.cs +src/Org.OpenAPITools/Model/MixLog.cs +src/Org.OpenAPITools/Model/MixedAnyOf.cs +src/Org.OpenAPITools/Model/MixedAnyOfContent.cs +src/Org.OpenAPITools/Model/MixedOneOf.cs +src/Org.OpenAPITools/Model/MixedOneOfContent.cs +src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/MixedSubId.cs +src/Org.OpenAPITools/Model/Model200Response.cs +src/Org.OpenAPITools/Model/ModelClient.cs +src/Org.OpenAPITools/Model/Name.cs +src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +src/Org.OpenAPITools/Model/NullableClass.cs +src/Org.OpenAPITools/Model/NullableGuidClass.cs +src/Org.OpenAPITools/Model/NullableShape.cs +src/Org.OpenAPITools/Model/NumberOnly.cs +src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +src/Org.OpenAPITools/Model/OneOfString.cs +src/Org.OpenAPITools/Model/Order.cs +src/Org.OpenAPITools/Model/OuterComposite.cs +src/Org.OpenAPITools/Model/OuterEnum.cs +src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumInteger.cs +src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumTest.cs +src/Org.OpenAPITools/Model/ParentPet.cs +src/Org.OpenAPITools/Model/Pet.cs +src/Org.OpenAPITools/Model/Pig.cs +src/Org.OpenAPITools/Model/PolymorphicProperty.cs +src/Org.OpenAPITools/Model/Quadrilateral.cs +src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs +src/Org.OpenAPITools/Model/Return.cs +src/Org.OpenAPITools/Model/RolesReportsHash.cs +src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +src/Org.OpenAPITools/Model/ScaleneTriangle.cs +src/Org.OpenAPITools/Model/Shape.cs +src/Org.OpenAPITools/Model/ShapeInterface.cs +src/Org.OpenAPITools/Model/ShapeOrNull.cs +src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +src/Org.OpenAPITools/Model/SpecialModelName.cs +src/Org.OpenAPITools/Model/Tag.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +src/Org.OpenAPITools/Model/Triangle.cs +src/Org.OpenAPITools/Model/TriangleInterface.cs +src/Org.OpenAPITools/Model/User.cs +src/Org.OpenAPITools/Model/Whale.cs +src/Org.OpenAPITools/Model/Zebra.cs +src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/README.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml new file mode 100644 index 000000000000..780d21e19bfa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml @@ -0,0 +1,3088 @@ +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: + /roles/report: + get: + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/RolesReport' + type: array + description: returns report + /hello: + get: + description: Hello + operationId: Hello + responses: + "200": + content: + application/json: + schema: + items: + format: uuid + type: string + type: array + description: UUIDs + summary: Hello + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/_foo_get_default_response' + description: response + /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 + 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 + 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: + "2XX": + description: Anything within 200-299 + "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 + "4XX": + description: Anything within 400-499 + security: + - http_signature_test: [] + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /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 + /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 + 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: [] + - api_key_query: [] + summary: Find pet by ID + tags: + - pet + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/updatePetWithForm_request' + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + 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 + /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 + /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 + /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 + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate 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 + /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 + /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 + /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 + /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: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + 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 + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /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 + 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 + "598": + description: Not a real HTTP status code + "599": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Not a real HTTP status code with a return object + summary: Get user by user name + tags: + - user + 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 + /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#$%^ + /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: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + 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: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEnumParameters_request' + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + 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 + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEndpointParameters_request' + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + /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 + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + parameters: + - description: Required UUID String + explode: true + in: query + name: required_string_uuid + required: true + schema: + format: uuid + type: string + style: form + 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 + /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 + /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 + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testJsonFormData_request' + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MapOfString' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + /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 + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/testInlineFreeformAdditionalProperties_request' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + /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 + /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? + /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 + /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 + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form + responses: + "200": + description: Success + tags: + - fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFileWithRequiredFile_request' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + /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 + /fake/mixed/anyOf: + get: + operationId: getMixedAnyOf + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MixedAnyOf' + description: Got mixed anyOf + summary: Test mixed type anyOf deserialization + tags: + - fake + /fake/mixed/oneOf: + get: + operationId: getMixedOneOf + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MixedOneOf' + description: Got mixed oneOf + summary: Test mixed type oneOf deserialization + tags: + - fake + /country: + post: + operationId: getCountry + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/getCountry_request' + responses: + "200": + description: OK + /test: + get: + operationId: Test + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/notificationtest-getElements-v1-Response-mPayload' + description: Successful response + summary: Retrieve an existing Notificationtest's Elements +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 + schemas: + RolesReport: + description: Roles report + items: + $ref: '#/components/schemas/RolesReportsHash' + type: array + RolesReportsHash: + description: Role report Hash + example: + role: + name: name + role_uuid: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + role_uuid: + format: uuid + type: string + role: + $ref: '#/components/schemas/RolesReportsHash_role' + type: object + 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 + lock: + type: string + abstract: + nullable: true + type: string + unsafe: + type: string + required: + - abstract + - lock + 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' + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' + - properties: + declawed: + type: boolean + type: object + 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 + int32Range: + maximum: 2147483647 + minimum: -2147483648 + type: integer + int64Positive: + minimum: 2147483648 + type: integer + int64Negative: + maximum: -2147483649 + type: integer + int64PositiveExclusive: + exclusiveMinimum: true + minimum: 2147483647 + type: integer + int64NegativeExclusive: + exclusiveMaximum: true + maximum: -2147483648 + type: integer + unsigned_integer: + format: int32 + maximum: 200 + minimum: 20 + type: integer + x-unsigned: true + int64: + format: int64 + type: integer + unsigned_long: + format: int64 + type: integer + x-unsigned: true + 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 + pattern_with_backslash: + description: None + pattern: "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\\\ + /([0-9]|[1-2][0-9]|3[0-2]))$" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Outer_Enum_Test: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + 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_with_pattern: + format: uuid + pattern: "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + type: string + 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 + x-cls-compliant: true + x-com-visible: true + 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 + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + 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 + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + 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 + color_code: + pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$" + 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 + nullable: true + oneOf: + - $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 + nullable: true + oneOf: + - $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' + - properties: + name: + type: string + pet_type: + default: ChildCat + enum: + - ChildCat + type: string + x-enum-as-string: true + required: + - pet_type + type: object + 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 + PolymorphicProperty: + oneOf: + - type: boolean + - type: string + - type: object + - items: + $ref: '#/components/schemas/StringArrayItem' + type: array + StringArrayItem: + format: string + type: string + Activity: + description: test map of maps + properties: + activity_outputs: + additionalProperties: + $ref: '#/components/schemas/ActivityOutputRepresentation' + type: object + type: object + ActivityOutputRepresentation: + items: + $ref: '#/components/schemas/ActivityOutputElementRepresentation' + type: array + ActivityOutputElementRepresentation: + properties: + prop1: + type: string + prop2: + type: object + type: object + NullableGuidClass: + properties: + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + type: object + DateOnlyClass: + properties: + dateOnlyProperty: + example: 2017-07-21 + format: date + type: string + type: object + TestCollectionEndingWithWordListObject: + properties: + TestCollectionEndingWithWordList: + items: + $ref: '#/components/schemas/TestCollectionEndingWithWordList' + type: array + type: object + TestCollectionEndingWithWordList: + properties: + value: + type: string + type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object + OneOfString: + oneOf: + - pattern: ^a + type: string + - pattern: ^b + type: string + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object + Custom-Variableobject-Response: + additionalProperties: true + description: A Variable object without predefined property names + type: object + Field-pkiNotificationtestID: + type: integer + notificationtest-getElements-v1-Response-mPayload: + example: + a_objVariableobject: + - null + - null + pkiNotificationtestID: 0 + properties: + pkiNotificationtestID: + type: integer + a_objVariableobject: + items: + $ref: '#/components/schemas/Custom-Variableobject-Response' + type: array + required: + - a_objVariableobject + - pkiNotificationtestID + type: object + MixedOneOf: + example: + content: MixedOneOf_content + properties: + content: + $ref: '#/components/schemas/MixedOneOf_content' + MixedAnyOf: + example: + content: MixedAnyOf_content + properties: + content: + $ref: '#/components/schemas/MixedAnyOf_content' + MixedSubId: + properties: + id: + type: string + MixLog: + properties: + id: + format: uuid + type: string + description: + type: string + mixDate: + format: date-time + type: string + shopId: + format: uuid + type: string + totalPrice: + format: float + nullable: true + type: number + totalRecalculations: + format: int32 + type: integer + totalOverPoors: + format: int32 + type: integer + totalSkips: + format: int32 + type: integer + totalUnderPours: + format: int32 + type: integer + formulaVersionDate: + format: date-time + type: string + someCode: + description: SomeCode is only required for color mixes + nullable: true + type: string + batchNumber: + type: string + brandCode: + description: BrandCode is only required for non-color mixes + type: string + brandId: + description: BrandId is only required for color mixes + type: string + brandName: + description: BrandName is only required for color mixes + type: string + categoryCode: + description: CategoryCode is not used anymore + type: string + color: + description: Color is only required for color mixes + type: string + colorDescription: + type: string + comment: + type: string + commercialProductCode: + type: string + productLineCode: + description: ProductLineCode is only required for color mixes + type: string + country: + type: string + createdBy: + type: string + createdByFirstName: + type: string + createdByLastName: + type: string + deltaECalculationRepaired: + type: string + deltaECalculationSprayout: + type: string + ownColorVariantNumber: + format: int32 + nullable: true + type: integer + primerProductId: + type: string + productId: + description: ProductId is only required for color mixes + type: string + productName: + description: ProductName is only required for color mixes + type: string + selectedVersionIndex: + format: int32 + type: integer + required: + - description + - formulaVersionDate + - id + - mixDate + - totalOverPoors + - totalRecalculations + - totalSkips + - totalUnderPours + type: object + uuid: + format: uuid + type: string + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + 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 + testEndpointParameters_request: + 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 + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + getCountry_request: + allOf: + - properties: + country: + type: string + required: + - country + type: object + RolesReportsHash_role: + example: + name: name + properties: + name: + type: string + type: object + MixedOneOf_content: + description: Mixed oneOf types for testing + oneOf: + - type: string + - type: boolean + - format: uint8 + type: integer + - format: float32 + type: number + - $ref: '#/components/schemas/MixedSubId' + MixedAnyOf_content: + anyOf: + - type: string + - type: boolean + - format: uint8 + type: integer + - format: float32 + type: number + - $ref: '#/components/schemas/MixedSubId' + description: Mixed anyOf types for testing + 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/csharp/generichost/net9/SourceGeneration/appveyor.yml b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/AnotherFakeApi.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/AnotherFakeApi.md new file mode 100644 index 000000000000..369488986579 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/AnotherFakeApi.md @@ -0,0 +1,99 @@ +# Org.OpenAPITools.Api.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** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class Call123TestSpecialTagsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new AnotherFakeApi(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test special tags + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the Call123TestSpecialTagsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test special tags + ApiResponse response = apiInstance.Call123TestSpecialTagsWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTagsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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/csharp/generichost/net9/SourceGeneration/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/DefaultApi.md new file mode 100644 index 000000000000..0bdfd6af3474 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/DefaultApi.md @@ -0,0 +1,429 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**FooGet**](DefaultApi.md#fooget) | **GET** /foo | | +| [**GetCountry**](DefaultApi.md#getcountry) | **POST** /country | | +| [**Hello**](DefaultApi.md#hello) | **GET** /hello | Hello | +| [**RolesReportGet**](DefaultApi.md#rolesreportget) | **GET** /roles/report | | +| [**Test**](DefaultApi.md#test) | **GET** /test | Retrieve an existing Notificationtest's Elements | + + +# **FooGet** +> FooGetDefaultResponse FooGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FooGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + FooGetDefaultResponse result = apiInstance.FooGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.FooGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FooGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FooGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.FooGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**FooGetDefaultResponse**](FooGetDefaultResponse.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 | - | + +[[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) + + +# **GetCountry** +> void GetCountry (string country) + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetCountryExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + var country = "country_example"; // string | + + try + { + apiInstance.GetCountry(country); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.GetCountry: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetCountryWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.GetCountryWithHttpInfo(country); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.GetCountryWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **country** | **string** | | | + +### Return type + +void (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** | OK | - | + +[[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) + + +# **Hello** +> List<Guid> Hello () + +Hello + +Hello + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class HelloExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + // Hello + List result = apiInstance.Hello(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.Hello: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the HelloWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Hello + ApiResponse> response = apiInstance.HelloWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.HelloWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**List** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | UUIDs | - | + +[[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) + + +# **RolesReportGet** +> List<List<RolesReportsHash>> RolesReportGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class RolesReportGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + List> result = apiInstance.RolesReportGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.RolesReportGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the RolesReportGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse>> response = apiInstance.RolesReportGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.RolesReportGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**List>** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | returns report | - | + +[[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** +> NotificationtestGetElementsV1ResponseMPayload Test () + +Retrieve an existing Notificationtest's Elements + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new DefaultApi(config); + + try + { + // Retrieve an existing Notificationtest's Elements + NotificationtestGetElementsV1ResponseMPayload result = apiInstance.Test(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.Test: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Retrieve an existing Notificationtest's Elements + ApiResponse response = apiInstance.TestWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.TestWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**NotificationtestGetElementsV1ResponseMPayload**](NotificationtestGetElementsV1ResponseMPayload.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Successful response | - | + +[[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/csharp/generichost/net9/SourceGeneration/docs/apis/FakeApi.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/FakeApi.md new file mode 100644 index 000000000000..ba7ed134222e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/FakeApi.md @@ -0,0 +1,1830 @@ +# Org.OpenAPITools.Api.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 | +| [**GetMixedAnyOf**](FakeApi.md#getmixedanyof) | **GET** /fake/mixed/anyOf | Test mixed type anyOf deserialization | +| [**GetMixedOneOf**](FakeApi.md#getmixedoneof) | **GET** /fake/mixed/oneOf | Test mixed type oneOf deserialization | +| [**TestAdditionalPropertiesReference**](FakeApi.md#testadditionalpropertiesreference) | **POST** /fake/additionalProperties-reference | test referenced additionalProperties | +| [**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 | +| [**TestInlineFreeformAdditionalProperties**](FakeApi.md#testinlinefreeformadditionalproperties) | **POST** /fake/inline-freeform-additionalProperties | test inline free-form additionalProperties | +| [**TestJsonFormData**](FakeApi.md#testjsonformdata) | **GET** /fake/jsonFormData | test json serialization of form data | +| [**TestQueryParameterCollectionFormat**](FakeApi.md#testqueryparametercollectionformat) | **PUT** /fake/test-query-parameters | | +| [**TestStringMapReference**](FakeApi.md#teststringmapreference) | **POST** /fake/stringMap-reference | test referenced string map | + + +# **FakeHealthGet** +> HealthCheckResult FakeHealthGet () + +Health check endpoint + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeHealthGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Health check endpoint + HealthCheckResult result = apiInstance.FakeHealthGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeHealthGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeHealthGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Health check endpoint + ApiResponse response = apiInstance.FakeHealthGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeHealthGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **FakeOuterBooleanSerialize** +> bool FakeOuterBooleanSerialize (bool body = null) + + + +Test serialization of outer boolean types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterBooleanSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var body = true; // bool | Input boolean as post body (optional) + + try + { + bool result = apiInstance.FakeOuterBooleanSerialize(body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterBooleanSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterBooleanSerializeWithHttpInfo(body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **body** | **bool** | Input boolean as post body | [optional] | + +### Return type + +**bool** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + +[[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) + + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize (OuterComposite outerComposite = null) + + + +Test serialization of object with outer number type + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterCompositeSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body (optional) + + try + { + OuterComposite result = apiInstance.FakeOuterCompositeSerialize(outerComposite); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterCompositeSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterCompositeSerializeWithHttpInfo(outerComposite); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **FakeOuterNumberSerialize** +> decimal FakeOuterNumberSerialize (decimal body = null) + + + +Test serialization of outer number types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterNumberSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var body = 8.14D; // decimal | Input number as post body (optional) + + try + { + decimal result = apiInstance.FakeOuterNumberSerialize(body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterNumberSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterNumberSerializeWithHttpInfo(body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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**: */* + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + +[[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) + + +# **FakeOuterStringSerialize** +> string FakeOuterStringSerialize (Guid requiredStringUuid, string body = null) + + + +Test serialization of outer string types + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FakeOuterStringSerializeExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requiredStringUuid = "requiredStringUuid_example"; // Guid | Required UUID String + var body = "body_example"; // string | Input string as post body (optional) + + try + { + string result = apiInstance.FakeOuterStringSerialize(requiredStringUuid, body); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FakeOuterStringSerializeWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.FakeOuterStringSerializeWithHttpInfo(requiredStringUuid, body); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerializeWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requiredStringUuid** | **Guid** | Required UUID String | | +| **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 | - | + +[[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) + + +# **GetArrayOfEnums** +> List<OuterEnum> GetArrayOfEnums () + +Array of Enums + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetArrayOfEnumsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Array of Enums + List result = apiInstance.GetArrayOfEnums(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetArrayOfEnums: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetArrayOfEnumsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Array of Enums + ApiResponse> response = apiInstance.GetArrayOfEnumsWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetArrayOfEnumsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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) + + +# **GetMixedAnyOf** +> MixedAnyOf GetMixedAnyOf () + +Test mixed type anyOf deserialization + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetMixedAnyOfExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Test mixed type anyOf deserialization + MixedAnyOf result = apiInstance.GetMixedAnyOf(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetMixedAnyOf: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetMixedAnyOfWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Test mixed type anyOf deserialization + ApiResponse response = apiInstance.GetMixedAnyOfWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetMixedAnyOfWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**MixedAnyOf**](MixedAnyOf.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 mixed anyOf | - | + +[[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) + + +# **GetMixedOneOf** +> MixedOneOf GetMixedOneOf () + +Test mixed type oneOf deserialization + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetMixedOneOfExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + + try + { + // Test mixed type oneOf deserialization + MixedOneOf result = apiInstance.GetMixedOneOf(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.GetMixedOneOf: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetMixedOneOfWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Test mixed type oneOf deserialization + ApiResponse response = apiInstance.GetMixedOneOfWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.GetMixedOneOfWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**MixedOneOf**](MixedOneOf.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 mixed oneOf | - | + +[[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) + + +# **TestAdditionalPropertiesReference** +> void TestAdditionalPropertiesReference (Dictionary requestBody) + +test referenced additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestAdditionalPropertiesReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestAdditionalPropertiesReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced additionalProperties + apiInstance.TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestAdditionalPropertiesReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, Object>**](Object.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestBodyWithFileSchema** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestBodyWithFileSchemaWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchemaWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestBodyWithQueryParams** +> void TestBodyWithQueryParams (string query, User user) + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithQueryParamsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var query = "query_example"; // string | + var user = new User(); // User | + + try + { + apiInstance.TestBodyWithQueryParams(query, user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParams: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestBodyWithQueryParamsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestBodyWithQueryParamsWithHttpInfo(query, user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParamsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestClientModel** +> ModelClient TestClientModel (ModelClient modelClient) + +To test \"client\" model + +To test \"client\" model + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClientModelExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test \"client\" model + ModelClient result = apiInstance.TestClientModel(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestClientModelWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test \"client\" model + ApiResponse response = apiInstance.TestClientModelWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestClientModelWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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) + + +# **TestEndpointParameters** +> void TestEndpointParameters (decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, System.IO.Stream binary = null, string callback = null, DateOnly date = null, DateTime dateTime = null, int int32 = null, long int64 = null, int integer = null, string password = null, float varFloat = null, string varString = null) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEndpointParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure HTTP basic authorization: http_basic_test + config.Username = "YOUR_USERNAME"; + config.Password = "YOUR_PASSWORD"; + + var apiInstance = new FakeApi(config); + var number = 8.14D; // decimal | None + var patternWithoutDelimiter = "patternWithoutDelimiter_example"; // string | None + var varByte = System.Text.Encoding.ASCII.GetBytes("BYTE_ARRAY_DATA_HERE"); // byte[] | None + var varDouble = 1.2D; // double | None + var binary = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | None (optional) + var callback = "callback_example"; // string | None (optional) + var date = DateOnly.Parse("2013-10-20"); // DateOnly | None (optional) + var dateTime = DateTime.Parse(""2010-02-01T10:20:10.111110+01:00""); // DateTime | None (optional) (default to "2010-02-01T10:20:10.111110+01:00") + var int32 = 56; // int | None (optional) + var int64 = 789L; // long | None (optional) + var integer = 56; // int | None (optional) + var password = "password_example"; // string | None (optional) + var varFloat = 3.4F; // float | None (optional) + var varString = "varString_example"; // string | None (optional) + + try + { + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + apiInstance.TestEndpointParameters(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestEndpointParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + apiInstance.TestEndpointParametersWithHttpInfo(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestEndpointParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **number** | **decimal** | None | | +| **patternWithoutDelimiter** | **string** | None | | +| **varByte** | **byte[]** | None | | +| **varDouble** | **double** | None | | +| **binary** | **System.IO.Stream****System.IO.Stream** | None | [optional] | +| **callback** | **string** | None | [optional] | +| **date** | **DateOnly** | None | [optional] | +| **dateTime** | **DateTime** | None | [optional] [default to "2010-02-01T10:20:10.111110+01:00"] | +| **int32** | **int** | None | [optional] | +| **int64** | **long** | None | [optional] | +| **integer** | **int** | None | [optional] | +| **password** | **string** | None | [optional] | +| **varFloat** | **float** | None | [optional] | +| **varString** | **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 + + +### 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) + + +# **TestEnumParameters** +> void TestEnumParameters (string enumFormString = null, List enumFormStringArray = null, string enumHeaderString = null, List enumHeaderStringArray = null, double enumQueryDouble = null, int enumQueryInteger = null, string enumQueryString = null, List enumQueryStringArray = null) + +To test enum parameters + +To test enum parameters + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestEnumParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var enumFormString = "_abc"; // string | Form parameter enum test (string) (optional) (default to -efg) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) + var enumHeaderString = "_abc"; // string | Header parameter enum test (string) (optional) (default to -efg) + var enumHeaderStringArray = new List(); // List | Header parameter enum test (string array) (optional) + var enumQueryDouble = 1.1D; // double | Query parameter enum test (double) (optional) + var enumQueryInteger = 1; // int | Query parameter enum test (double) (optional) + var enumQueryString = "_abc"; // string | Query parameter enum test (string) (optional) (default to -efg) + var enumQueryStringArray = new List(); // List | Query parameter enum test (string array) (optional) + + try + { + // To test enum parameters + apiInstance.TestEnumParameters(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestEnumParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test enum parameters + apiInstance.TestEnumParametersWithHttpInfo(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestEnumParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **enumFormString** | **string** | Form parameter enum test (string) | [optional] [default to -efg] | +| **enumFormStringArray** | [**List<string>**](string.md) | Form parameter enum test (string array) | [optional] [default to $] | +| **enumHeaderString** | **string** | Header parameter enum test (string) | [optional] [default to -efg] | +| **enumHeaderStringArray** | [**List<string>**](string.md) | Header parameter enum test (string array) | [optional] | +| **enumQueryDouble** | **double** | Query parameter enum test (double) | [optional] | +| **enumQueryInteger** | **int** | Query parameter enum test (double) | [optional] | +| **enumQueryString** | **string** | Query parameter enum test (string) | [optional] [default to -efg] | +| **enumQueryStringArray** | [**List<string>**](string.md) | Query parameter enum test (string array) | [optional] | + +### Return type + +void (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 | - | + +[[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) + + +# **TestGroupParameters** +> void TestGroupParameters (bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, bool booleanGroup = null, long int64Group = null, int stringGroup = null) + +Fake endpoint to test group parameters (optional) + +Fake endpoint to test group parameters (optional) + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestGroupParametersExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure Bearer token for authorization: bearer_test + config.AccessToken = "YOUR_BEARER_TOKEN"; + + var apiInstance = new FakeApi(config); + var requiredBooleanGroup = true; // bool | Required Boolean in group parameters + var requiredInt64Group = 789L; // long | Required Integer in group parameters + var requiredStringGroup = 56; // int | Required String in group parameters + var booleanGroup = true; // bool | Boolean in group parameters (optional) + var int64Group = 789L; // long | Integer in group parameters (optional) + var stringGroup = 56; // int | String in group parameters (optional) + + try + { + // Fake endpoint to test group parameters (optional) + apiInstance.TestGroupParameters(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestGroupParameters: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestGroupParametersWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Fake endpoint to test group parameters (optional) + apiInstance.TestGroupParametersWithHttpInfo(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestGroupParametersWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requiredBooleanGroup** | **bool** | Required Boolean in group parameters | | +| **requiredInt64Group** | **long** | Required Integer in group parameters | | +| **requiredStringGroup** | **int** | Required String in group parameters | | +| **booleanGroup** | **bool** | Boolean in group parameters | [optional] | +| **int64Group** | **long** | Integer in group parameters | [optional] | +| **stringGroup** | **int** | String 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 + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Something wrong | - | + +[[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) + + +# **TestInlineAdditionalProperties** +> void TestInlineAdditionalProperties (Dictionary requestBody) + +test inline additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestInlineAdditionalPropertiesExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test inline additionalProperties + apiInstance.TestInlineAdditionalProperties(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestInlineAdditionalPropertiesWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test inline additionalProperties + apiInstance.TestInlineAdditionalPropertiesWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestInlineAdditionalPropertiesWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, string>**](string.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestInlineFreeformAdditionalProperties** +> void TestInlineFreeformAdditionalProperties (TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + +test inline free-form additionalProperties + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestInlineFreeformAdditionalPropertiesExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var testInlineFreeformAdditionalPropertiesRequest = new TestInlineFreeformAdditionalPropertiesRequest(); // TestInlineFreeformAdditionalPropertiesRequest | request body + + try + { + // test inline free-form additionalProperties + apiInstance.TestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalProperties: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestInlineFreeformAdditionalPropertiesWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test inline free-form additionalProperties + apiInstance.TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestInlineFreeformAdditionalPropertiesWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **testInlineFreeformAdditionalPropertiesRequest** | [**TestInlineFreeformAdditionalPropertiesRequest**](TestInlineFreeformAdditionalPropertiesRequest.md) | request body | | + +### Return type + +void (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 | - | + +[[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) + + +# **TestJsonFormData** +> void TestJsonFormData (string param, string param2) + +test json serialization of form data + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestJsonFormDataExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var param = "param_example"; // string | field1 + var param2 = "param2_example"; // string | field2 + + try + { + // test json serialization of form data + apiInstance.TestJsonFormData(param, param2); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestJsonFormDataWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test json serialization of form data + apiInstance.TestJsonFormDataWithHttpInfo(param, param2); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestJsonFormDataWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 + + +### 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) + + +# **TestQueryParameterCollectionFormat** +> void TestQueryParameterCollectionFormat (List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, string notRequiredNotNullable = null, string notRequiredNullable = null, string requiredNullable) + + + +To test the collection format in query parameters + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestQueryParameterCollectionFormatExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var context = new List(); // List | + var http = new List(); // List | + var ioutil = new List(); // List | + var pipe = new List(); // List | + var requiredNotNullable = "requiredNotNullable_example"; // string | + var url = new List(); // List | + var notRequiredNotNullable = "notRequiredNotNullable_example"; // string | (optional) + var notRequiredNullable = "notRequiredNullable_example"; // string | (optional) + var requiredNullable = "requiredNullable_example"; // string | + + try + { + apiInstance.TestQueryParameterCollectionFormat(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestQueryParameterCollectionFormat: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestQueryParameterCollectionFormatWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + apiInstance.TestQueryParameterCollectionFormatWithHttpInfo(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestQueryParameterCollectionFormatWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **context** | [**List<string>**](string.md) | | | +| **http** | [**List<string>**](string.md) | | | +| **ioutil** | [**List<string>**](string.md) | | | +| **pipe** | [**List<string>**](string.md) | | | +| **requiredNotNullable** | **string** | | | +| **url** | [**List<string>**](string.md) | | | +| **notRequiredNotNullable** | **string** | | [optional] | +| **notRequiredNullable** | **string** | | [optional] | +| **requiredNullable** | **string** | | | + +### 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 | +|-------------|-------------|------------------| +| **200** | Success | - | + +[[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) + + +# **TestStringMapReference** +> void TestStringMapReference (Dictionary requestBody) + +test referenced string map + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestStringMapReferenceExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(config); + var requestBody = new Dictionary(); // Dictionary | request body + + try + { + // test referenced string map + apiInstance.TestStringMapReference(requestBody); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeApi.TestStringMapReference: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestStringMapReferenceWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // test referenced string map + apiInstance.TestStringMapReferenceWithHttpInfo(requestBody); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeApi.TestStringMapReferenceWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **requestBody** | [**Dictionary<string, string>**](string.md) | request body | | + +### Return type + +void (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 | - | + +[[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/csharp/generichost/net9/SourceGeneration/docs/apis/FakeClassnameTags123Api.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/FakeClassnameTags123Api.md new file mode 100644 index 000000000000..dfe1adefd0a7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/FakeClassnameTags123Api.md @@ -0,0 +1,104 @@ +# Org.OpenAPITools.Api.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** +> ModelClient TestClassname (ModelClient modelClient) + +To test class name in snake case + +To test class name in snake case + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestClassnameExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key_query + config.AddApiKey("api_key_query", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key_query", "Bearer"); + + var apiInstance = new FakeClassnameTags123Api(config); + var modelClient = new ModelClient(); // ModelClient | client model + + try + { + // To test class name in snake case + ModelClient result = apiInstance.TestClassname(modelClient); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the TestClassnameWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // To test class name in snake case + ApiResponse response = apiInstance.TestClassnameWithHttpInfo(modelClient); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassnameWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **modelClient** | [**ModelClient**](ModelClient.md) | client model | | + +### Return type + +[**ModelClient**](ModelClient.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 | - | + +[[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/csharp/generichost/net9/SourceGeneration/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/PetApi.md new file mode 100644 index 000000000000..92e5a48277df --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/PetApi.md @@ -0,0 +1,862 @@ +# Org.OpenAPITools.Api.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** +> void AddPet (Pet pet) + +Add a new pet to the store + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class AddPetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(pet); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the AddPetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Add a new pet to the store + apiInstance.AddPetWithHttpInfo(pet); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.AddPetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **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) + + +# **DeletePet** +> void DeletePet (long petId, string apiKey = null) + +Deletes a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeletePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | Pet id to delete + var apiKey = "apiKey_example"; // string | (optional) + + try + { + // Deletes a pet + apiInstance.DeletePet(petId, apiKey); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeletePetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Deletes a pet + apiInstance.DeletePetWithHttpInfo(petId, apiKey); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.DeletePetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | Pet id to delete | | +| **apiKey** | **string** | | [optional] | + +### 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** +> List<Pet> FindPetsByStatus (List status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByStatusExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var status = new List(); // List | Status values that need to be considered for filter + + try + { + // Finds Pets by status + List result = apiInstance.FindPetsByStatus(status); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FindPetsByStatusWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Finds Pets by status + ApiResponse> response = apiInstance.FindPetsByStatusWithHttpInfo(status); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.FindPetsByStatusWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **status** | [**List<string>**](string.md) | Status values that need to be considered for filter | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 | - | +| **2XX** | Anything within 200-299 | - | +| **4XX** | Anything within 400-499 | - | + +[[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** +> List<Pet> FindPetsByTags (List tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByTagsExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var tags = new List(); // List | Tags to filter by + + try + { + // Finds Pets by tags + List result = apiInstance.FindPetsByTags(tags); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the FindPetsByTagsWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Finds Pets by tags + ApiResponse> response = apiInstance.FindPetsByTagsWithHttpInfo(tags); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.FindPetsByTagsWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **tags** | [**List<string>**](string.md) | Tags to filter by | | + +### Return type + +[**List<Pet>**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 (long petId) + +Find pet by ID + +Returns a single pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetPetByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api-key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api-key", "Bearer"); + // Configure API key authorization: api_key_query + config.AddApiKey("api_key_query", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api_key_query", "Bearer"); + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to return + + try + { + // Find pet by ID + Pet result = apiInstance.GetPetById(petId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetPetByIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Find pet by ID + ApiResponse response = apiInstance.GetPetByIdWithHttpInfo(petId); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.GetPetByIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to return | | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key), [api_key_query](../README.md#api_key_query) + +### 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** +> void UpdatePet (Pet pet) + +Update an existing pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + apiInstance.UpdatePet(pet); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdatePetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Update an existing pet + apiInstance.UpdatePetWithHttpInfo(pet); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UpdatePetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) + +### 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 | - | + +[[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** +> void UpdatePetWithForm (long petId, string name = null, string status = null) + +Updates a pet in the store with form data + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetWithFormExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet that needs to be updated + var name = "name_example"; // string | Updated name of the pet (optional) + var status = "status_example"; // string | Updated status of the pet (optional) + + try + { + // Updates a pet in the store with form data + apiInstance.UpdatePetWithForm(petId, name, status); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdatePetWithFormWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Updates a pet in the store with form data + apiInstance.UpdatePetWithFormWithHttpInfo(petId, name, status); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UpdatePetWithFormWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet that needs to be updated | | +| **name** | **string** | Updated name of the pet | [optional] | +| **status** | **string** | Updated status of the pet | [optional] | + +### Return type + +void (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 (long petId, string additionalMetadata = null, System.IO.Stream file = null) + +uploads an image + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to update + var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional) + var file = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload (optional) + + try + { + // uploads an image + ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UploadFileWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // uploads an image + ApiResponse response = apiInstance.UploadFileWithHttpInfo(petId, additionalMetadata, file); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UploadFileWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to update | | +| **additionalMetadata** | **string** | Additional data to pass to server | [optional] | +| **file** | **System.IO.Stream****System.IO.Stream** | file to upload | [optional] | + +### Return type + +[**ApiResponse**](ApiResponse.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 | - | + +[[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) + + +# **UploadFileWithRequiredFile** +> ApiResponse UploadFileWithRequiredFile (long petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure OAuth2 access token for authorization: petstore_auth + config.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(config); + var petId = 789L; // long | ID of pet to update + var requiredFile = new System.IO.MemoryStream(System.IO.File.ReadAllBytes("/path/to/file.txt")); // System.IO.Stream | file to upload + var additionalMetadata = "additionalMetadata_example"; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UploadFileWithRequiredFileWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // uploads an image (required) + ApiResponse response = apiInstance.UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFileWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **petId** | **long** | ID of pet to update | | +| **requiredFile** | **System.IO.Stream****System.IO.Stream** | file to upload | | +| **additionalMetadata** | **string** | Additional data to pass to server | [optional] | + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + + +### 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/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/StoreApi.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/StoreApi.md new file mode 100644 index 000000000000..e169ad74f907 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/StoreApi.md @@ -0,0 +1,373 @@ +# Org.OpenAPITools.Api.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** +> void DeleteOrder (string 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 +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var orderId = "orderId_example"; // string | ID of the order that needs to be deleted + + try + { + // Delete purchase order by ID + apiInstance.DeleteOrder(orderId); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeleteOrderWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Delete purchase order by ID + apiInstance.DeleteOrderWithHttpInfo(orderId); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.DeleteOrderWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **orderId** | **string** | ID of the order that needs to be deleted | | + +### 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** +> Dictionary<string, int> GetInventory () + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetInventoryExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + // Configure API key authorization: api_key + config.AddApiKey("api-key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // config.AddApiKeyPrefix("api-key", "Bearer"); + + var apiInstance = new StoreApi(config); + + try + { + // Returns pet inventories by status + Dictionary result = apiInstance.GetInventory(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetInventoryWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Returns pet inventories by status + ApiResponse> response = apiInstance.GetInventoryWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.GetInventoryWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +**Dictionary** + +### 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 (long orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetOrderByIdExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var orderId = 789L; // long | ID of pet that needs to be fetched + + try + { + // Find purchase order by ID + Order result = apiInstance.GetOrderById(orderId); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetOrderByIdWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Find purchase order by ID + ApiResponse response = apiInstance.GetOrderByIdWithHttpInfo(orderId); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.GetOrderByIdWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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 order) + +Place an order for a pet + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class PlaceOrderExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(config); + var order = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + Order result = apiInstance.PlaceOrder(order); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the PlaceOrderWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Place an order for a pet + ApiResponse response = apiInstance.PlaceOrderWithHttpInfo(order); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling StoreApi.PlaceOrderWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | + +[[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/csharp/generichost/net9/SourceGeneration/docs/apis/UserApi.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/UserApi.md new file mode 100644 index 000000000000..34064e25c4a8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/UserApi.md @@ -0,0 +1,715 @@ +# Org.OpenAPITools.Api.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** +> void CreateUser (User user) + +Create user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Create user + apiInstance.CreateUserWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**User**](User.md) | Created user object | | + +### Return type + +void (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 | - | + +[[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** +> void CreateUsersWithArrayInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithArrayInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUsersWithArrayInputWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInputWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInputWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**List<User>**](User.md) | List of user object | | + +### Return type + +void (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 | - | + +[[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** +> void CreateUsersWithListInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithListInputExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(user); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the CreateUsersWithListInputWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Creates list of users with given input array + apiInstance.CreateUsersWithListInputWithHttpInfo(user); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.CreateUsersWithListInputWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**List<User>**](User.md) | List of user object | | + +### Return type + +void (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 | - | + +[[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** +> void DeleteUser (string username) + +Delete user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var username = "username_example"; // string | The name that needs to be deleted + + try + { + // Delete user + apiInstance.DeleteUser(username); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the DeleteUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Delete user + apiInstance.DeleteUserWithHttpInfo(username); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.DeleteUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **username** | **string** | The name that needs to be deleted | | + +### 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 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 (string username) + +Get user by user name + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetUserByNameExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var username = "username_example"; // string | The name that needs to be fetched. Use user1 for testing. + + try + { + // Get user by user name + User result = apiInstance.GetUserByName(username); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the GetUserByNameWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Get user by user name + ApiResponse response = apiInstance.GetUserByNameWithHttpInfo(username); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.GetUserByNameWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### 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 | - | +| **598** | Not a real HTTP status code | - | +| **599** | Not a real HTTP status code with a return object | - | + +[[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 (string password, string username) + +Logs user into the system + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LoginUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var password = "password_example"; // string | The password for login in clear text + var username = "username_example"; // string | The user name for login + + try + { + // Logs user into the system + string result = apiInstance.LoginUser(password, username); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the LoginUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Logs user into the system + ApiResponse response = apiInstance.LoginUserWithHttpInfo(password, username); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.LoginUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **password** | **string** | The password for login in clear text | | +| **username** | **string** | The user name for login | | + +### 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** +> void LogoutUser () + +Logs out current logged in user session + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LogoutUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + + try + { + // Logs out current logged in user session + apiInstance.LogoutUser(); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the LogoutUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Logs out current logged in user session + apiInstance.LogoutUserWithHttpInfo(); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.LogoutUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### 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 | +|-------------|-------------|------------------| +| **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** +> void UpdateUser (User user, string username) + +Updated user + +This can only be done by the logged in user. + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdateUserExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(config); + var user = new User(); // User | Updated user object + var username = "username_example"; // string | name that need to be deleted + + try + { + // Updated user + apiInstance.UpdateUser(user, username); + } + catch (ApiException e) + { + Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the UpdateUserWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + // Updated user + apiInstance.UpdateUserWithHttpInfo(user, username); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling UserApi.UpdateUserWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters + +| Name | Type | Description | Notes | +|------|------|-------------|-------| +| **user** | [**User**](User.md) | Updated user object | | +| **username** | **string** | name that need to be deleted | | + +### Return type + +void (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 | - | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/Activity.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Activity.md new file mode 100644 index 000000000000..6f69ec32545d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Activity.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Activity +test map of maps + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ActivityOutputs** | **Dictionary<string, List<ActivityOutputElementRepresentation>>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ActivityOutputElementRepresentation.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ActivityOutputElementRepresentation.md new file mode 100644 index 000000000000..33d79a27692f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ActivityOutputElementRepresentation.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ActivityOutputElementRepresentation + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Prop1** | **string** | | [optional] +**Prop2** | **Object** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/AdditionalPropertiesClass.md new file mode 100644 index 000000000000..2bbe882fcfcc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/AdditionalPropertiesClass.md @@ -0,0 +1,17 @@ +# Org.OpenAPITools.Model.AdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Anytype1** | **Object** | | [optional] +**EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] +**MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MapProperty** | **Dictionary<string, string>** | | [optional] +**MapWithUndeclaredPropertiesAnytype1** | **Object** | | [optional] +**MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] +**MapWithUndeclaredPropertiesAnytype3** | **Dictionary<string, Object>** | | [optional] +**MapWithUndeclaredPropertiesString** | **Dictionary<string, string>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Animal.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Animal.md new file mode 100644 index 000000000000..1a1760bd8697 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Animal.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Animal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/ApiResponse.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ApiResponse.md new file mode 100644 index 000000000000..d89ed1a25dc7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ApiResponse.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.ApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int** | | [optional] +**Message** | **string** | | [optional] +**Type** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Apple.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Apple.md new file mode 100644 index 000000000000..9ad1da8cd688 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Apple.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Apple + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ColorCode** | **string** | | [optional] +**Cultivar** | **string** | | [optional] +**Origin** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/AppleReq.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/AppleReq.md new file mode 100644 index 000000000000..325521123f12 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/AppleReq.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.AppleReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Cultivar** | **string** | | +**Mealy** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 000000000000..a23ba59e609c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ArrayOfArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayNumber** | **List<List<decimal>>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ArrayOfNumberOnly.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ArrayOfNumberOnly.md new file mode 100644 index 000000000000..10b8413439b8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ArrayOfNumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayNumber** | **List<decimal>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ArrayTest.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ArrayTest.md new file mode 100644 index 000000000000..ed572120cd6d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ArrayTest.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.ArrayTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayArrayOfInteger** | **List<List<long>>** | | [optional] +**ArrayArrayOfModel** | **List<List<ReadOnlyFirst>>** | | [optional] +**ArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Banana.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Banana.md new file mode 100644 index 000000000000..d32e90cf2985 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Banana.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Banana + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/BananaReq.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/BananaReq.md new file mode 100644 index 000000000000..c8372b73c5f7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/BananaReq.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.BananaReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**LengthCm** | **decimal** | | +**Sweet** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/BasquePig.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/BasquePig.md new file mode 100644 index 000000000000..db4f7a362268 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/BasquePig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.BasquePig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/Capitalization.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Capitalization.md new file mode 100644 index 000000000000..9e225c17232a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Capitalization.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Capitalization + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ATT_NAME** | **string** | Name of the pet | [optional] +**CapitalCamel** | **string** | | [optional] +**CapitalSnake** | **string** | | [optional] +**SCAETHFlowPoints** | **string** | | [optional] +**SmallCamel** | **string** | | [optional] +**SmallSnake** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Cat.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Cat.md new file mode 100644 index 000000000000..310a5e6575ec --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Cat.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Cat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Declawed** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Category.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Category.md new file mode 100644 index 000000000000..6eb0a2e13eaa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Category.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/ChildCat.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ChildCat.md new file mode 100644 index 000000000000..88fe8f7a7fdd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ChildCat.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ChildCat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] +**PetType** | **string** | | [default to PetTypeEnum.ChildCat] + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/ClassModel.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ClassModel.md new file mode 100644 index 000000000000..bb35816c9148 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ClassModel.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ClassModel +Model for testing model with \"_class\" property + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ComplexQuadrilateral.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ComplexQuadrilateral.md new file mode 100644 index 000000000000..fb00d4ebf089 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ComplexQuadrilateral.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ComplexQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/DanishPig.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/DanishPig.md new file mode 100644 index 000000000000..4d6ec1400a7e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/DanishPig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DanishPig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/DateOnlyClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/DateOnlyClass.md new file mode 100644 index 000000000000..4fc3775ed87d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/DateOnlyClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DateOnlyClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateOnlyProperty** | **DateOnly** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/DeprecatedObject.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/DeprecatedObject.md new file mode 100644 index 000000000000..e90c59555a0d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/DeprecatedObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.DeprecatedObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Dog.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Dog.md new file mode 100644 index 000000000000..70cdc80e83e0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Dog.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Dog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Color** | **string** | | [optional] [default to "red"] +**Breed** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Drawing.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Drawing.md new file mode 100644 index 000000000000..95f49b2ed600 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Drawing.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.Drawing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MainShape** | [**Shape**](Shape.md) | | [optional] +**NullableShape** | [**NullableShape**](NullableShape.md) | | [optional] +**ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**Shapes** | [**List<Shape>**](Shape.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumArrays.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumArrays.md new file mode 100644 index 000000000000..7467f67978c5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumArrays.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.EnumArrays + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayEnum** | **List<EnumArrays.ArrayEnumEnum>** | | [optional] +**JustSymbol** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumClass.md new file mode 100644 index 000000000000..d259f0f46968 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumClass.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.EnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/EnumTest.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumTest.md new file mode 100644 index 000000000000..ebd7ccf2c864 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EnumTest.md @@ -0,0 +1,18 @@ +# Org.OpenAPITools.Model.EnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | +**EnumInteger** | **int** | | [optional] +**EnumIntegerOnly** | **int** | | [optional] +**EnumNumber** | **double** | | [optional] +**EnumString** | **string** | | [optional] +**OuterEnum** | **OuterEnum** | | [optional] +**OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**OuterEnumInteger** | **OuterEnumInteger** | | [optional] +**OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EquilateralTriangle.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EquilateralTriangle.md new file mode 100644 index 000000000000..8360b5c16a5b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/EquilateralTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.EquilateralTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/File.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/File.md new file mode 100644 index 000000000000..58b9c2fc3698 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/File.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.File +Must be named `File` for test. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SourceURI** | **string** | Test capitalization | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FileSchemaTestClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FileSchemaTestClass.md new file mode 100644 index 000000000000..a47efad77d8a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FileSchemaTestClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | [**File**](File.md) | | [optional] +**Files** | [**List<File>**](File.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Foo.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Foo.md new file mode 100644 index 000000000000..b9e7d261736f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Foo.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Foo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [default to "bar"] + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/FooGetDefaultResponse.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FooGetDefaultResponse.md new file mode 100644 index 000000000000..47e50daca3e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FooGetDefaultResponse.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FooGetDefaultResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**String** | [**Foo**](Foo.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FormatTest.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FormatTest.md new file mode 100644 index 000000000000..1009f35198fb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FormatTest.md @@ -0,0 +1,33 @@ +# Org.OpenAPITools.Model.FormatTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Byte** | **byte[]** | | +**Date** | **DateOnly** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] +**DateTime** | **DateTime** | | [optional] +**Decimal** | **decimal** | | [optional] +**Double** | **double** | | [optional] +**Float** | **float** | | [optional] +**Int32** | **int** | | [optional] +**Int32Range** | **int** | | [optional] +**Int64** | **long** | | [optional] +**Int64Negative** | **long** | | [optional] +**Int64NegativeExclusive** | **long** | | [optional] +**Int64Positive** | **long** | | [optional] +**Int64PositiveExclusive** | **long** | | [optional] +**Integer** | **int** | | [optional] +**PatternWithBackslash** | **string** | None | [optional] +**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] +**String** | **string** | | [optional] +**UnsignedInteger** | **uint** | | [optional] +**UnsignedLong** | **ulong** | | [optional] +**Uuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Fruit.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Fruit.md new file mode 100644 index 000000000000..b3bee18f7ba0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Fruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Fruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FruitReq.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FruitReq.md new file mode 100644 index 000000000000..38ab0c1a6caa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/FruitReq.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.FruitReq + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/GmFruit.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/GmFruit.md new file mode 100644 index 000000000000..584c4fd323d8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/GmFruit.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.GmFruit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Color** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/GrandparentAnimal.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/GrandparentAnimal.md new file mode 100644 index 000000000000..eca96162b6f8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/GrandparentAnimal.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.GrandparentAnimal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/HasOnlyReadOnly.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/HasOnlyReadOnly.md new file mode 100644 index 000000000000..060a614a6981 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.HasOnlyReadOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [readonly] +**Foo** | **string** | | [optional] [readonly] + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/HealthCheckResult.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/HealthCheckResult.md new file mode 100644 index 000000000000..682cfc50e3a4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/HealthCheckResult.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.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] + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/IsoscelesTriangle.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/IsoscelesTriangle.md new file mode 100644 index 000000000000..07c62ac93382 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/IsoscelesTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.IsoscelesTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/List.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/List.md new file mode 100644 index 000000000000..0b54858ac247 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/List.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.List + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Var123List** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/LiteralStringClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/LiteralStringClass.md new file mode 100644 index 000000000000..782021909655 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/LiteralStringClass.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.LiteralStringClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**EscapedLiteralString** | **string** | | [optional] [default to "C:\\Users\\username"] +**UnescapedLiteralString** | **string** | | [optional] [default to "C:\Users\username"] + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/Mammal.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Mammal.md new file mode 100644 index 000000000000..ac14f00c0ff0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Mammal.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Mammal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/MapTest.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MapTest.md new file mode 100644 index 000000000000..5dd27228bb06 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MapTest.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.MapTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DirectMap** | **Dictionary<string, bool>** | | [optional] +**IndirectMap** | **Dictionary<string, bool>** | | [optional] +**MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] +**MapOfEnumString** | **Dictionary<string, MapTest.InnerEnum>** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixLog.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixLog.md new file mode 100644 index 000000000000..5184c03bea97 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixLog.md @@ -0,0 +1,41 @@ +# Org.OpenAPITools.Model.MixLog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Description** | **string** | | +**FormulaVersionDate** | **DateTime** | | +**Id** | **Guid** | | +**MixDate** | **DateTime** | | +**TotalOverPoors** | **int** | | +**TotalRecalculations** | **int** | | +**TotalSkips** | **int** | | +**TotalUnderPours** | **int** | | +**BatchNumber** | **string** | | [optional] +**BrandCode** | **string** | BrandCode is only required for non-color mixes | [optional] +**BrandId** | **string** | BrandId is only required for color mixes | [optional] +**BrandName** | **string** | BrandName is only required for color mixes | [optional] +**CategoryCode** | **string** | CategoryCode is not used anymore | [optional] +**Color** | **string** | Color is only required for color mixes | [optional] +**ColorDescription** | **string** | | [optional] +**Comment** | **string** | | [optional] +**CommercialProductCode** | **string** | | [optional] +**Country** | **string** | | [optional] +**CreatedBy** | **string** | | [optional] +**CreatedByFirstName** | **string** | | [optional] +**CreatedByLastName** | **string** | | [optional] +**DeltaECalculationRepaired** | **string** | | [optional] +**DeltaECalculationSprayout** | **string** | | [optional] +**OwnColorVariantNumber** | **int** | | [optional] +**PrimerProductId** | **string** | | [optional] +**ProductId** | **string** | ProductId is only required for color mixes | [optional] +**ProductLineCode** | **string** | ProductLineCode is only required for color mixes | [optional] +**ProductName** | **string** | ProductName is only required for color mixes | [optional] +**SelectedVersionIndex** | **int** | | [optional] +**ShopId** | **Guid** | | [optional] +**SomeCode** | **string** | SomeCode is only required for color mixes | [optional] +**TotalPrice** | **float** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedAnyOf.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedAnyOf.md new file mode 100644 index 000000000000..2e9a2ca23f67 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedAnyOf.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedAnyOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Content** | [**MixedAnyOfContent**](MixedAnyOfContent.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedAnyOfContent.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedAnyOfContent.md new file mode 100644 index 000000000000..141ffe5a41dc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedAnyOfContent.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedAnyOfContent +Mixed anyOf types for testing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/MixedOneOf.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedOneOf.md new file mode 100644 index 000000000000..6cb1d5adff01 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedOneOf.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Content** | [**MixedOneOfContent**](MixedOneOfContent.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedOneOfContent.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedOneOfContent.md new file mode 100644 index 000000000000..168d5ee83628 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedOneOfContent.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedOneOfContent +Mixed oneOf types for testing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 000000000000..1bc0740add9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.MixedPropertiesAndAdditionalPropertiesClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**DateTime** | **DateTime** | | [optional] +**Map** | [**Dictionary<string, Animal>**](Animal.md) | | [optional] +**Uuid** | **Guid** | | [optional] +**UuidWithPattern** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedSubId.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedSubId.md new file mode 100644 index 000000000000..1df3d4002bf5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/MixedSubId.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.MixedSubId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Model200Response.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Model200Response.md new file mode 100644 index 000000000000..2752a0d87c82 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Model200Response.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Model200Response +Model for testing model name starting with number + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Class** | **string** | | [optional] +**Name** | **int** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ModelClient.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ModelClient.md new file mode 100644 index 000000000000..c658e84ef57e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ModelClient.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ModelClient + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarClient** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Name.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Name.md new file mode 100644 index 000000000000..ffe61a31d61b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Name.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Name +Model for testing model name same as property name + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarName** | **int** | | +**Property** | **string** | | [optional] +**SnakeCase** | **int** | | [optional] [readonly] +**Var123Number** | **int** | | [optional] [readonly] + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/NotificationtestGetElementsV1ResponseMPayload.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NotificationtestGetElementsV1ResponseMPayload.md new file mode 100644 index 000000000000..25f223a8360a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NotificationtestGetElementsV1ResponseMPayload.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**AObjVariableobject** | **List<Dictionary<string, Object>>** | | +**PkiNotificationtestID** | **int** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/NullableClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NullableClass.md new file mode 100644 index 000000000000..c9afe86510da --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NullableClass.md @@ -0,0 +1,21 @@ +# Org.OpenAPITools.Model.NullableClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ArrayAndItemsNullableProp** | **List<Object>** | | [optional] +**ArrayItemsNullable** | **List<Object>** | | [optional] +**ArrayNullableProp** | **List<Object>** | | [optional] +**BooleanProp** | **bool** | | [optional] +**DateProp** | **DateOnly** | | [optional] +**DatetimeProp** | **DateTime** | | [optional] +**IntegerProp** | **int** | | [optional] +**NumberProp** | **decimal** | | [optional] +**ObjectAndItemsNullableProp** | **Dictionary<string, Object>** | | [optional] +**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] +**ObjectNullableProp** | **Dictionary<string, Object>** | | [optional] +**StringProp** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NullableGuidClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NullableGuidClass.md new file mode 100644 index 000000000000..8d939afe9984 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NullableGuidClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.NullableGuidClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Uuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NullableShape.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NullableShape.md new file mode 100644 index 000000000000..2720167ccaaa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NullableShape.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.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. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/NumberOnly.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NumberOnly.md new file mode 100644 index 000000000000..1b83cce764d3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/NumberOnly.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.NumberOnly + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**JustNumber** | **decimal** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ObjectWithDeprecatedFields.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ObjectWithDeprecatedFields.md new file mode 100644 index 000000000000..9f44c24d19ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ObjectWithDeprecatedFields.md @@ -0,0 +1,13 @@ +# Org.OpenAPITools.Model.ObjectWithDeprecatedFields + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bars** | **List<string>** | | [optional] +**DeprecatedRef** | [**DeprecatedObject**](DeprecatedObject.md) | | [optional] +**Id** | **decimal** | | [optional] +**Uuid** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OneOfString.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OneOfString.md new file mode 100644 index 000000000000..54caf618776c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OneOfString.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OneOfString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/Order.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Order.md new file mode 100644 index 000000000000..f7d6827ed5c9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Order.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Complete** | **bool** | | [optional] [default to false] +**Id** | **long** | | [optional] +**PetId** | **long** | | [optional] +**Quantity** | **int** | | [optional] +**ShipDate** | **DateTime** | | [optional] +**Status** | **string** | Order Status | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterComposite.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterComposite.md new file mode 100644 index 000000000000..8985c59d094f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterComposite.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.OuterComposite + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyBoolean** | **bool** | | [optional] +**MyNumber** | **decimal** | | [optional] +**MyString** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnum.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnum.md new file mode 100644 index 000000000000..36844bc4b175 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnum.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumDefaultValue.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumDefaultValue.md new file mode 100644 index 000000000000..351383f0aeae --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumDefaultValue.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumInteger.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumInteger.md new file mode 100644 index 000000000000..1013b5b19565 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumInteger.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumIntegerDefaultValue.md new file mode 100644 index 000000000000..55e314e3102d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumIntegerDefaultValue.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumIntegerDefaultValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumTest.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumTest.md new file mode 100644 index 000000000000..b99d27c2c2e7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/OuterEnumTest.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.OuterEnumTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/ParentPet.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ParentPet.md new file mode 100644 index 000000000000..bdf570056372 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ParentPet.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ParentPet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PetType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/Pet.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Pet.md new file mode 100644 index 000000000000..4f019b613bd7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Pet.md @@ -0,0 +1,15 @@ +# Org.OpenAPITools.Model.Pet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] +**Status** | **string** | pet status in the store | [optional] +**Tags** | [**List<Tag>**](Tag.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Pig.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Pig.md new file mode 100644 index 000000000000..fd7bb9359ac4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Pig.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Pig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/PolymorphicProperty.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/PolymorphicProperty.md new file mode 100644 index 000000000000..4507ec41cd51 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/PolymorphicProperty.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.PolymorphicProperty + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/Quadrilateral.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Quadrilateral.md new file mode 100644 index 000000000000..fbbf4f81cec6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Quadrilateral.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Quadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/QuadrilateralInterface.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/QuadrilateralInterface.md new file mode 100644 index 000000000000..756ba09c6ddf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/QuadrilateralInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.QuadrilateralInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/ReadOnlyFirst.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ReadOnlyFirst.md new file mode 100644 index 000000000000..afaf2ee4fb6c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ReadOnlyFirst.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ReadOnlyFirst + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Bar** | **string** | | [optional] [readonly] +**Baz** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/RequiredClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/RequiredClass.md new file mode 100644 index 000000000000..990aeb5de3d7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateOnly** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateOnly** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotRequiredNullableDateProp** | **DateOnly** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateOnly** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/Return.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Return.md new file mode 100644 index 000000000000..ad96a170bbbb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Return.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Return +Model for testing reserved words + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Lock** | **string** | | +**Abstract** | **string** | | +**VarReturn** | **int** | | [optional] +**Unsafe** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/RolesReportsHash.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/RolesReportsHash.md new file mode 100644 index 000000000000..d92c01de9ef7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/RolesReportsHash.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.RolesReportsHash +Role report Hash + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Role** | [**RolesReportsHashRole**](RolesReportsHashRole.md) | | [optional] +**RoleUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/RolesReportsHashRole.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/RolesReportsHashRole.md new file mode 100644 index 000000000000..760f77b30e78 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/RolesReportsHashRole.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.RolesReportsHashRole + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ScaleneTriangle.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ScaleneTriangle.md new file mode 100644 index 000000000000..d3f15354bccc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ScaleneTriangle.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ScaleneTriangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/Shape.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Shape.md new file mode 100644 index 000000000000..ae75c5925401 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Shape.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Shape + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/ShapeInterface.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ShapeInterface.md new file mode 100644 index 000000000000..882d31868305 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ShapeInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ShapeInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/ShapeOrNull.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ShapeOrNull.md new file mode 100644 index 000000000000..7fcd31a3a5e1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ShapeOrNull.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.ShapeOrNull +The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/SimpleQuadrilateral.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/SimpleQuadrilateral.md new file mode 100644 index 000000000000..a9c7f93b67ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/SimpleQuadrilateral.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.SimpleQuadrilateral + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**QuadrilateralType** | **string** | | +**ShapeType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/SpecialModelName.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/SpecialModelName.md new file mode 100644 index 000000000000..890bcd923dee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/SpecialModelName.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.SpecialModelName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**VarSpecialModelName** | **string** | | [optional] +**SpecialPropertyName** | **long** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Tag.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Tag.md new file mode 100644 index 000000000000..2b2d9674d619 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Tag.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long** | | [optional] +**Name** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TestCollectionEndingWithWordList.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TestCollectionEndingWithWordList.md new file mode 100644 index 000000000000..5c5eb22d9a8a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TestCollectionEndingWithWordList.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestCollectionEndingWithWordList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Value** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TestCollectionEndingWithWordListObject.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TestCollectionEndingWithWordListObject.md new file mode 100644 index 000000000000..cfa933cc576e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TestCollectionEndingWithWordListObject.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestCollectionEndingWithWordListObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TestCollectionEndingWithWordList** | [**List<TestCollectionEndingWithWordList>**](TestCollectionEndingWithWordList.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md new file mode 100644 index 000000000000..b6f9fc948474 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TestInlineFreeformAdditionalPropertiesRequest.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TestInlineFreeformAdditionalPropertiesRequest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SomeProperty** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Triangle.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Triangle.md new file mode 100644 index 000000000000..e15109911958 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Triangle.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Triangle + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/TriangleInterface.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TriangleInterface.md new file mode 100644 index 000000000000..4127c08b14f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/TriangleInterface.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.TriangleInterface + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**TriangleType** | **string** | | + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/User.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/User.md new file mode 100644 index 000000000000..b5700f1c75d9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/User.md @@ -0,0 +1,21 @@ +# Org.OpenAPITools.Model.User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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] +**Email** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**Id** | **long** | | [optional] +**LastName** | **string** | | [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] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int** | User Status | [optional] +**Username** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Whale.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Whale.md new file mode 100644 index 000000000000..1c633fdce61b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Whale.md @@ -0,0 +1,12 @@ +# Org.OpenAPITools.Model.Whale + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**HasBaleen** | **bool** | | [optional] +**HasTeeth** | **bool** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Zebra.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Zebra.md new file mode 100644 index 000000000000..aef3866b92c9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/Zebra.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.Zebra + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Type** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ZeroBasedEnum.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ZeroBasedEnum.md new file mode 100644 index 000000000000..cb71966c4c81 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ZeroBasedEnum.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.ZeroBasedEnum + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[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/csharp/generichost/net9/SourceGeneration/docs/models/ZeroBasedEnumClass.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ZeroBasedEnumClass.md new file mode 100644 index 000000000000..614d00cbe878 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/models/ZeroBasedEnumClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.ZeroBasedEnumClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ZeroBasedEnum** | **string** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs new file mode 100644 index 000000000000..53d2c74655f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing AnotherFakeApi + /// + public sealed class AnotherFakeApiTests : ApiTestsBase + { + private readonly IAnotherFakeApi _instance; + + public AnotherFakeApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test Call123TestSpecialTags + /// + [Fact (Skip = "not implemented")] + public async Task Call123TestSpecialTagsAsyncTest() + { + ModelClient modelClient = default!; + var response = await _instance.Call123TestSpecialTagsAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..03ad026fa146 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,81 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + string apiKeyTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken1 = new(apiKeyTokenValue1, ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + string apiKeyTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + ApiKeyToken apiKeyToken2 = new(apiKeyTokenValue2, ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + string bearerTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + BearerToken bearerToken1 = new(bearerTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + string basicTokenUsername1 = context.Configuration[""] ?? throw new Exception("Username not found."); + string basicTokenPassword1 = context.Configuration[""] ?? throw new Exception("Password not found."); + BasicToken basicToken1 = new(basicTokenUsername1, basicTokenPassword1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, new List(), HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 000000000000..3e6e9af57c4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing DefaultApi + /// + public sealed class DefaultApiTests : ApiTestsBase + { + private readonly IDefaultApi _instance; + + public DefaultApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test FooGet + /// + [Fact (Skip = "not implemented")] + public async Task FooGetAsyncTest() + { + var response = await _instance.FooGetAsync(); + var model = response.Default(); + Assert.IsType(model); + } + + /// + /// Test GetCountry + /// + [Fact (Skip = "not implemented")] + public async Task GetCountryAsyncTest() + { + string country = default!; + await _instance.GetCountryAsync(country); + } + + /// + /// Test Hello + /// + [Fact (Skip = "not implemented")] + public async Task HelloAsyncTest() + { + var response = await _instance.HelloAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test RolesReportGet + /// + [Fact (Skip = "not implemented")] + public async Task RolesReportGetAsyncTest() + { + var response = await _instance.RolesReportGetAsync(); + var model = response.Ok(); + Assert.IsType>>(model); + } + + /// + /// Test Test + /// + [Fact (Skip = "not implemented")] + public async Task TestAsyncTest() + { + var response = await _instance.TestAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..028d71f43359 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,243 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + ApiKeyToken apiKeyToken1 = new("", ClientUtils.ApiKeyHeader.Api_key, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken1); + + ApiKeyToken apiKeyToken2 = new("", ClientUtils.ApiKeyHeader.Api_key_query, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(apiKeyToken2); + + BearerToken bearerToken1 = new("", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(bearerToken1); + + BasicToken basicToken1 = new("", "", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(basicToken1); + + HttpSigningConfiguration config1 = new("", "", null, [], HashAlgorithmName.SHA256, "", 0); + HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(httpSignatureToken1); + + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var anotherFakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var anotherFakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var anotherFakeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var anotherFakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(anotherFakeApi.HttpClient.BaseAddress != null); + + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + + var fakeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeApi.HttpClient.BaseAddress != null); + + var fakeClassnameTags123Api = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(fakeClassnameTags123Api.HttpClient.BaseAddress != null); + + var petApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(petApi.HttpClient.BaseAddress != null); + + var storeApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(storeApi.HttpClient.BaseAddress != null); + + var userApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(userApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs new file mode 100644 index 000000000000..406dbc964a6d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -0,0 +1,303 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing FakeApi + /// + public sealed class FakeApiTests : ApiTestsBase + { + private readonly IFakeApi _instance; + + public FakeApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test FakeHealthGet + /// + [Fact (Skip = "not implemented")] + public async Task FakeHealthGetAsyncTest() + { + var response = await _instance.FakeHealthGetAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterBooleanSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterBooleanSerializeAsyncTest() + { + Client.Option body = default!; + var response = await _instance.FakeOuterBooleanSerializeAsync(body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterCompositeSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterCompositeSerializeAsyncTest() + { + Client.Option outerComposite = default!; + var response = await _instance.FakeOuterCompositeSerializeAsync(outerComposite); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterNumberSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterNumberSerializeAsyncTest() + { + Client.Option body = default!; + var response = await _instance.FakeOuterNumberSerializeAsync(body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test FakeOuterStringSerialize + /// + [Fact (Skip = "not implemented")] + public async Task FakeOuterStringSerializeAsyncTest() + { + Guid requiredStringUuid = default!; + Client.Option body = default!; + var response = await _instance.FakeOuterStringSerializeAsync(requiredStringUuid, body); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test GetArrayOfEnums + /// + [Fact (Skip = "not implemented")] + public async Task GetArrayOfEnumsAsyncTest() + { + var response = await _instance.GetArrayOfEnumsAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetMixedAnyOf + /// + [Fact (Skip = "not implemented")] + public async Task GetMixedAnyOfAsyncTest() + { + var response = await _instance.GetMixedAnyOfAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test GetMixedOneOf + /// + [Fact (Skip = "not implemented")] + public async Task GetMixedOneOfAsyncTest() + { + var response = await _instance.GetMixedOneOfAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test TestAdditionalPropertiesReference + /// + [Fact (Skip = "not implemented")] + public async Task TestAdditionalPropertiesReferenceAsyncTest() + { + Dictionary requestBody = default!; + await _instance.TestAdditionalPropertiesReferenceAsync(requestBody); + } + + /// + /// Test TestBodyWithFileSchema + /// + [Fact (Skip = "not implemented")] + public async Task TestBodyWithFileSchemaAsyncTest() + { + FileSchemaTestClass fileSchemaTestClass = default!; + await _instance.TestBodyWithFileSchemaAsync(fileSchemaTestClass); + } + + /// + /// Test TestBodyWithQueryParams + /// + [Fact (Skip = "not implemented")] + public async Task TestBodyWithQueryParamsAsyncTest() + { + string query = default!; + User user = default!; + await _instance.TestBodyWithQueryParamsAsync(query, user); + } + + /// + /// Test TestClientModel + /// + [Fact (Skip = "not implemented")] + public async Task TestClientModelAsyncTest() + { + ModelClient modelClient = default!; + var response = await _instance.TestClientModelAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test TestEndpointParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestEndpointParametersAsyncTest() + { + decimal number = default!; + string patternWithoutDelimiter = default!; + byte[] varByte = default!; + double varDouble = default!; + Client.Option binary = default!; + Client.Option callback = default!; + Client.Option date = default!; + Client.Option dateTime = default!; + Client.Option int32 = default!; + Client.Option int64 = default!; + Client.Option integer = default!; + Client.Option password = default!; + Client.Option varFloat = default!; + Client.Option varString = default!; + await _instance.TestEndpointParametersAsync(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + } + + /// + /// Test TestEnumParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestEnumParametersAsyncTest() + { + Client.Option enumFormString = default!; + Client.Option> enumFormStringArray = default!; + Client.Option enumHeaderString = default!; + Client.Option> enumHeaderStringArray = default!; + Client.Option enumQueryDouble = default!; + Client.Option enumQueryInteger = default!; + Client.Option enumQueryString = default!; + Client.Option> enumQueryStringArray = default!; + await _instance.TestEnumParametersAsync(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + } + + /// + /// Test TestGroupParameters + /// + [Fact (Skip = "not implemented")] + public async Task TestGroupParametersAsyncTest() + { + bool requiredBooleanGroup = default!; + long requiredInt64Group = default!; + int requiredStringGroup = default!; + Client.Option booleanGroup = default!; + Client.Option int64Group = default!; + Client.Option stringGroup = default!; + await _instance.TestGroupParametersAsync(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + } + + /// + /// Test TestInlineAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineAdditionalPropertiesAsyncTest() + { + Dictionary requestBody = default!; + await _instance.TestInlineAdditionalPropertiesAsync(requestBody); + } + + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default!; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + + /// + /// Test TestJsonFormData + /// + [Fact (Skip = "not implemented")] + public async Task TestJsonFormDataAsyncTest() + { + string param = default!; + string param2 = default!; + await _instance.TestJsonFormDataAsync(param, param2); + } + + /// + /// Test TestQueryParameterCollectionFormat + /// + [Fact (Skip = "not implemented")] + public async Task TestQueryParameterCollectionFormatAsyncTest() + { + List context = default!; + List http = default!; + List ioutil = default!; + List pipe = default!; + string requiredNotNullable = default!; + List url = default!; + Client.Option notRequiredNotNullable = default!; + Client.Option notRequiredNullable = default!; + string? requiredNullable = default!; + await _instance.TestQueryParameterCollectionFormatAsync(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + } + + /// + /// Test TestStringMapReference + /// + [Fact (Skip = "not implemented")] + public async Task TestStringMapReferenceAsyncTest() + { + Dictionary requestBody = default!; + await _instance.TestStringMapReferenceAsync(requestBody); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs new file mode 100644 index 000000000000..626331ef9b7f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing FakeClassnameTags123Api + /// + public sealed class FakeClassnameTags123ApiTests : ApiTestsBase + { + private readonly IFakeClassnameTags123Api _instance; + + public FakeClassnameTags123ApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test TestClassname + /// + [Fact (Skip = "not implemented")] + public async Task TestClassnameAsyncTest() + { + ModelClient modelClient = default!; + var response = await _instance.TestClassnameAsync(modelClient); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/PetApiTests.cs new file mode 100644 index 000000000000..49e7b21b53c2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -0,0 +1,160 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing PetApi + /// + public sealed class PetApiTests : ApiTestsBase + { + private readonly IPetApi _instance; + + public PetApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test AddPet + /// + [Fact (Skip = "not implemented")] + public async Task AddPetAsyncTest() + { + Pet pet = default!; + await _instance.AddPetAsync(pet); + } + + /// + /// Test DeletePet + /// + [Fact (Skip = "not implemented")] + public async Task DeletePetAsyncTest() + { + long petId = default!; + Client.Option apiKey = default!; + await _instance.DeletePetAsync(petId, apiKey); + } + + /// + /// Test FindPetsByStatus + /// + [Fact (Skip = "not implemented")] + public async Task FindPetsByStatusAsyncTest() + { + List status = default!; + var response = await _instance.FindPetsByStatusAsync(status); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test FindPetsByTags + /// + [Fact (Skip = "not implemented")] + public async Task FindPetsByTagsAsyncTest() + { + List tags = default!; + var response = await _instance.FindPetsByTagsAsync(tags); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetPetById + /// + [Fact (Skip = "not implemented")] + public async Task GetPetByIdAsyncTest() + { + long petId = default!; + var response = await _instance.GetPetByIdAsync(petId); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test UpdatePet + /// + [Fact (Skip = "not implemented")] + public async Task UpdatePetAsyncTest() + { + Pet pet = default!; + await _instance.UpdatePetAsync(pet); + } + + /// + /// Test UpdatePetWithForm + /// + [Fact (Skip = "not implemented")] + public async Task UpdatePetWithFormAsyncTest() + { + long petId = default!; + Client.Option name = default!; + Client.Option status = default!; + await _instance.UpdatePetWithFormAsync(petId, name, status); + } + + /// + /// Test UploadFile + /// + [Fact (Skip = "not implemented")] + public async Task UploadFileAsyncTest() + { + long petId = default!; + Client.Option additionalMetadata = default!; + Client.Option file = default!; + var response = await _instance.UploadFileAsync(petId, additionalMetadata, file); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test UploadFileWithRequiredFile + /// + [Fact (Skip = "not implemented")] + public async Task UploadFileWithRequiredFileAsyncTest() + { + long petId = default!; + System.IO.Stream requiredFile = default!; + Client.Option additionalMetadata = default!; + var response = await _instance.UploadFileWithRequiredFileAsync(petId, requiredFile, additionalMetadata); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs new file mode 100644 index 000000000000..b2a25a3e6f07 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing StoreApi + /// + public sealed class StoreApiTests : ApiTestsBase + { + private readonly IStoreApi _instance; + + public StoreApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test DeleteOrder + /// + [Fact (Skip = "not implemented")] + public async Task DeleteOrderAsyncTest() + { + string orderId = default!; + await _instance.DeleteOrderAsync(orderId); + } + + /// + /// Test GetInventory + /// + [Fact (Skip = "not implemented")] + public async Task GetInventoryAsyncTest() + { + var response = await _instance.GetInventoryAsync(); + var model = response.Ok(); + Assert.IsType>(model); + } + + /// + /// Test GetOrderById + /// + [Fact (Skip = "not implemented")] + public async Task GetOrderByIdAsyncTest() + { + long orderId = default!; + var response = await _instance.GetOrderByIdAsync(orderId); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test PlaceOrder + /// + [Fact (Skip = "not implemented")] + public async Task PlaceOrderAsyncTest() + { + Order order = default!; + var response = await _instance.PlaceOrderAsync(order); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/UserApiTests.cs new file mode 100644 index 000000000000..bc750295c346 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/UserApiTests.cs @@ -0,0 +1,138 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing UserApi + /// + public sealed class UserApiTests : ApiTestsBase + { + private readonly IUserApi _instance; + + public UserApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test CreateUser + /// + [Fact (Skip = "not implemented")] + public async Task CreateUserAsyncTest() + { + User user = default!; + await _instance.CreateUserAsync(user); + } + + /// + /// Test CreateUsersWithArrayInput + /// + [Fact (Skip = "not implemented")] + public async Task CreateUsersWithArrayInputAsyncTest() + { + List user = default!; + await _instance.CreateUsersWithArrayInputAsync(user); + } + + /// + /// Test CreateUsersWithListInput + /// + [Fact (Skip = "not implemented")] + public async Task CreateUsersWithListInputAsyncTest() + { + List user = default!; + await _instance.CreateUsersWithListInputAsync(user); + } + + /// + /// Test DeleteUser + /// + [Fact (Skip = "not implemented")] + public async Task DeleteUserAsyncTest() + { + string username = default!; + await _instance.DeleteUserAsync(username); + } + + /// + /// Test GetUserByName + /// + [Fact (Skip = "not implemented")] + public async Task GetUserByNameAsyncTest() + { + string username = default!; + var response = await _instance.GetUserByNameAsync(username); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test LoginUser + /// + [Fact (Skip = "not implemented")] + public async Task LoginUserAsyncTest() + { + string password = default!; + string username = default!; + var response = await _instance.LoginUserAsync(password, username); + var model = response.Ok(); + Assert.IsType(model); + } + + /// + /// Test LogoutUser + /// + [Fact (Skip = "not implemented")] + public async Task LogoutUserAsyncTest() + { + await _instance.LogoutUserAsync(); + } + + /// + /// Test UpdateUser + /// + [Fact (Skip = "not implemented")] + public async Task UpdateUserAsyncTest() + { + User user = default!; + string username = default!; + await _instance.UpdateUserAsync(user, username); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs new file mode 100644 index 000000000000..adbf639fd720 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ActivityOutputElementRepresentation + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActivityOutputElementRepresentationTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ActivityOutputElementRepresentation + //private ActivityOutputElementRepresentation instance; + + public ActivityOutputElementRepresentationTests() + { + // TODO uncomment below to create an instance of ActivityOutputElementRepresentation + //instance = new ActivityOutputElementRepresentation(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ActivityOutputElementRepresentation + /// + [Fact] + public void ActivityOutputElementRepresentationInstanceTest() + { + // TODO uncomment below to test "IsType" ActivityOutputElementRepresentation + //Assert.IsType(instance); + } + + /// + /// Test the property 'Prop1' + /// + [Fact] + public void Prop1Test() + { + // TODO unit test for the property 'Prop1' + } + + /// + /// Test the property 'Prop2' + /// + [Fact] + public void Prop2Test() + { + // TODO unit test for the property 'Prop2' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ActivityTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ActivityTests.cs new file mode 100644 index 000000000000..6cc2927eaaf3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ActivityTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Activity + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ActivityTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Activity + //private Activity instance; + + public ActivityTests() + { + // TODO uncomment below to create an instance of Activity + //instance = new Activity(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Activity + /// + [Fact] + public void ActivityInstanceTest() + { + // TODO uncomment below to test "IsType" Activity + //Assert.IsType(instance); + } + + /// + /// Test the property 'ActivityOutputs' + /// + [Fact] + public void ActivityOutputsTest() + { + // TODO unit test for the property 'ActivityOutputs' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs new file mode 100644 index 000000000000..e157b477193e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -0,0 +1,128 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing AdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for AdditionalPropertiesClass + //private AdditionalPropertiesClass instance; + + public AdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of AdditionalPropertiesClass + //instance = new AdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AdditionalPropertiesClass + /// + [Fact] + public void AdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsType" AdditionalPropertiesClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'Anytype1' + /// + [Fact] + public void Anytype1Test() + { + // TODO unit test for the property 'Anytype1' + } + + /// + /// Test the property 'EmptyMap' + /// + [Fact] + public void EmptyMapTest() + { + // TODO unit test for the property 'EmptyMap' + } + + /// + /// Test the property 'MapOfMapProperty' + /// + [Fact] + public void MapOfMapPropertyTest() + { + // TODO unit test for the property 'MapOfMapProperty' + } + + /// + /// Test the property 'MapProperty' + /// + [Fact] + public void MapPropertyTest() + { + // TODO unit test for the property 'MapProperty' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype1' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype1Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype1' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype2' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype2Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype2' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesAnytype3' + /// + [Fact] + public void MapWithUndeclaredPropertiesAnytype3Test() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesAnytype3' + } + + /// + /// Test the property 'MapWithUndeclaredPropertiesString' + /// + [Fact] + public void MapWithUndeclaredPropertiesStringTest() + { + // TODO unit test for the property 'MapWithUndeclaredPropertiesString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AnimalTests.cs new file mode 100644 index 000000000000..1db9725afb85 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AnimalTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Animal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AnimalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Animal + //private Animal instance; + + public AnimalTests() + { + // TODO uncomment below to create an instance of Animal + //instance = new Animal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Animal + /// + [Fact] + public void AnimalInstanceTest() + { + // TODO uncomment below to test "IsType" Animal + //Assert.IsType(instance); + } + + /// + /// Test deserialize a Cat from type Animal + /// + [Fact] + public void CatDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Cat from type Animal + //Assert.IsType(JsonConvert.DeserializeObject(new Cat().ToJson())); + } + + /// + /// Test deserialize a Dog from type Animal + /// + [Fact] + public void DogDeserializeFromAnimalTest() + { + // TODO uncomment below to test deserialize a Dog from type Animal + //Assert.IsType(JsonConvert.DeserializeObject(new Dog().ToJson())); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs new file mode 100644 index 000000000000..c296a82116a7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ApiResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ApiResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ApiResponse + //private ApiResponse instance; + + public ApiResponseTests() + { + // TODO uncomment below to create an instance of ApiResponse + //instance = new ApiResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ApiResponse + /// + [Fact] + public void ApiResponseInstanceTest() + { + // TODO uncomment below to test "IsType" ApiResponse + //Assert.IsType(instance); + } + + /// + /// Test the property 'Code' + /// + [Fact] + public void CodeTest() + { + // TODO unit test for the property 'Code' + } + + /// + /// Test the property 'Message' + /// + [Fact] + public void MessageTest() + { + // TODO unit test for the property 'Message' + } + + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs new file mode 100644 index 000000000000..d698ee445048 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing AppleReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for AppleReq + //private AppleReq instance; + + public AppleReqTests() + { + // TODO uncomment below to create an instance of AppleReq + //instance = new AppleReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of AppleReq + /// + [Fact] + public void AppleReqInstanceTest() + { + // TODO uncomment below to test "IsType" AppleReq + //Assert.IsType(instance); + } + + /// + /// Test the property 'Cultivar' + /// + [Fact] + public void CultivarTest() + { + // TODO unit test for the property 'Cultivar' + } + + /// + /// Test the property 'Mealy' + /// + [Fact] + public void MealyTest() + { + // TODO unit test for the property 'Mealy' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AppleTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AppleTests.cs new file mode 100644 index 000000000000..c7c8ccd47c11 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/AppleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Apple + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class AppleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Apple + //private Apple instance; + + public AppleTests() + { + // TODO uncomment below to create an instance of Apple + //instance = new Apple(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Apple + /// + [Fact] + public void AppleInstanceTest() + { + // TODO uncomment below to test "IsType" Apple + //Assert.IsType(instance); + } + + /// + /// Test the property 'ColorCode' + /// + [Fact] + public void ColorCodeTest() + { + // TODO unit test for the property 'ColorCode' + } + + /// + /// Test the property 'Cultivar' + /// + [Fact] + public void CultivarTest() + { + // TODO unit test for the property 'Cultivar' + } + + /// + /// Test the property 'Origin' + /// + [Fact] + public void OriginTest() + { + // TODO unit test for the property 'Origin' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs new file mode 100644 index 000000000000..29fe9cfb1d47 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayOfArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfArrayOfNumberOnly + //private ArrayOfArrayOfNumberOnly instance; + + public ArrayOfArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfArrayOfNumberOnly + //instance = new ArrayOfArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfArrayOfNumberOnly + /// + [Fact] + public void ArrayOfArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayOfArrayOfNumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayArrayNumber' + /// + [Fact] + public void ArrayArrayNumberTest() + { + // TODO unit test for the property 'ArrayArrayNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs new file mode 100644 index 000000000000..2b0956c0b984 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayOfNumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayOfNumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayOfNumberOnly + //private ArrayOfNumberOnly instance; + + public ArrayOfNumberOnlyTests() + { + // TODO uncomment below to create an instance of ArrayOfNumberOnly + //instance = new ArrayOfNumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayOfNumberOnly + /// + [Fact] + public void ArrayOfNumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayOfNumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayNumber' + /// + [Fact] + public void ArrayNumberTest() + { + // TODO unit test for the property 'ArrayNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs new file mode 100644 index 000000000000..3b01d0b7abbc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ArrayTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ArrayTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ArrayTest + //private ArrayTest instance; + + public ArrayTestTests() + { + // TODO uncomment below to create an instance of ArrayTest + //instance = new ArrayTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ArrayTest + /// + [Fact] + public void ArrayTestInstanceTest() + { + // TODO uncomment below to test "IsType" ArrayTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayArrayOfInteger' + /// + [Fact] + public void ArrayArrayOfIntegerTest() + { + // TODO unit test for the property 'ArrayArrayOfInteger' + } + + /// + /// Test the property 'ArrayArrayOfModel' + /// + [Fact] + public void ArrayArrayOfModelTest() + { + // TODO unit test for the property 'ArrayArrayOfModel' + } + + /// + /// Test the property 'ArrayOfString' + /// + [Fact] + public void ArrayOfStringTest() + { + // TODO unit test for the property 'ArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs new file mode 100644 index 000000000000..1e54c1f3e41d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing BananaReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for BananaReq + //private BananaReq instance; + + public BananaReqTests() + { + // TODO uncomment below to create an instance of BananaReq + //instance = new BananaReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of BananaReq + /// + [Fact] + public void BananaReqInstanceTest() + { + // TODO uncomment below to test "IsType" BananaReq + //Assert.IsType(instance); + } + + /// + /// Test the property 'LengthCm' + /// + [Fact] + public void LengthCmTest() + { + // TODO unit test for the property 'LengthCm' + } + + /// + /// Test the property 'Sweet' + /// + [Fact] + public void SweetTest() + { + // TODO unit test for the property 'Sweet' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/BananaTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/BananaTests.cs new file mode 100644 index 000000000000..5a88e9dabbdf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/BananaTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Banana + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BananaTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Banana + //private Banana instance; + + public BananaTests() + { + // TODO uncomment below to create an instance of Banana + //instance = new Banana(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Banana + /// + [Fact] + public void BananaInstanceTest() + { + // TODO uncomment below to test "IsType" Banana + //Assert.IsType(instance); + } + + /// + /// Test the property 'LengthCm' + /// + [Fact] + public void LengthCmTest() + { + // TODO unit test for the property 'LengthCm' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs new file mode 100644 index 000000000000..4ffd6c2c0c87 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing BasquePig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class BasquePigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for BasquePig + //private BasquePig instance; + + public BasquePigTests() + { + // TODO uncomment below to create an instance of BasquePig + //instance = new BasquePig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of BasquePig + /// + [Fact] + public void BasquePigInstanceTest() + { + // TODO uncomment below to test "IsType" BasquePig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs new file mode 100644 index 000000000000..d0391fb47f8f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Capitalization + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CapitalizationTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Capitalization + //private Capitalization instance; + + public CapitalizationTests() + { + // TODO uncomment below to create an instance of Capitalization + //instance = new Capitalization(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Capitalization + /// + [Fact] + public void CapitalizationInstanceTest() + { + // TODO uncomment below to test "IsType" Capitalization + //Assert.IsType(instance); + } + + /// + /// Test the property 'ATT_NAME' + /// + [Fact] + public void ATT_NAMETest() + { + // TODO unit test for the property 'ATT_NAME' + } + + /// + /// Test the property 'CapitalCamel' + /// + [Fact] + public void CapitalCamelTest() + { + // TODO unit test for the property 'CapitalCamel' + } + + /// + /// Test the property 'CapitalSnake' + /// + [Fact] + public void CapitalSnakeTest() + { + // TODO unit test for the property 'CapitalSnake' + } + + /// + /// Test the property 'SCAETHFlowPoints' + /// + [Fact] + public void SCAETHFlowPointsTest() + { + // TODO unit test for the property 'SCAETHFlowPoints' + } + + /// + /// Test the property 'SmallCamel' + /// + [Fact] + public void SmallCamelTest() + { + // TODO unit test for the property 'SmallCamel' + } + + /// + /// Test the property 'SmallSnake' + /// + [Fact] + public void SmallSnakeTest() + { + // TODO unit test for the property 'SmallSnake' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CatTests.cs new file mode 100644 index 000000000000..a5d4bf43bbfd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CatTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Cat + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CatTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Cat + //private Cat instance; + + public CatTests() + { + // TODO uncomment below to create an instance of Cat + //instance = new Cat(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Cat + /// + [Fact] + public void CatInstanceTest() + { + // TODO uncomment below to test "IsType" Cat + //Assert.IsType(instance); + } + + /// + /// Test the property 'Declawed' + /// + [Fact] + public void DeclawedTest() + { + // TODO unit test for the property 'Declawed' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CategoryTests.cs new file mode 100644 index 000000000000..7fe8f333c81a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Category + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class CategoryTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Category + //private Category instance; + + public CategoryTests() + { + // TODO uncomment below to create an instance of Category + //instance = new Category(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Category + /// + [Fact] + public void CategoryInstanceTest() + { + // TODO uncomment below to test "IsType" Category + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs new file mode 100644 index 000000000000..2c02364a9f76 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ChildCat + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ChildCatTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ChildCat + //private ChildCat instance; + + public ChildCatTests() + { + // TODO uncomment below to create an instance of ChildCat + //instance = new ChildCat(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ChildCat + /// + [Fact] + public void ChildCatInstanceTest() + { + // TODO uncomment below to test "IsType" ChildCat + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + /// + /// Test the property 'PetType' + /// + [Fact] + public void PetTypeTest() + { + // TODO unit test for the property 'PetType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs new file mode 100644 index 000000000000..a866bfbe242d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ClassModel + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ClassModelTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ClassModel + //private ClassModel instance; + + public ClassModelTests() + { + // TODO uncomment below to create an instance of ClassModel + //instance = new ClassModel(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ClassModel + /// + [Fact] + public void ClassModelInstanceTest() + { + // TODO uncomment below to test "IsType" ClassModel + //Assert.IsType(instance); + } + + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs new file mode 100644 index 000000000000..a7a864154acf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ComplexQuadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ComplexQuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ComplexQuadrilateral + //private ComplexQuadrilateral instance; + + public ComplexQuadrilateralTests() + { + // TODO uncomment below to create an instance of ComplexQuadrilateral + //instance = new ComplexQuadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ComplexQuadrilateral + /// + [Fact] + public void ComplexQuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" ComplexQuadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs new file mode 100644 index 000000000000..e7c505b5136d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DanishPig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DanishPigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DanishPig + //private DanishPig instance; + + public DanishPigTests() + { + // TODO uncomment below to create an instance of DanishPig + //instance = new DanishPig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DanishPig + /// + [Fact] + public void DanishPigInstanceTest() + { + // TODO uncomment below to test "IsType" DanishPig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs new file mode 100644 index 000000000000..83a4185e53d2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DateOnlyClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DateOnlyClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DateOnlyClass + //private DateOnlyClass instance; + + public DateOnlyClassTests() + { + // TODO uncomment below to create an instance of DateOnlyClass + //instance = new DateOnlyClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DateOnlyClass + /// + [Fact] + public void DateOnlyClassInstanceTest() + { + // TODO uncomment below to test "IsType" DateOnlyClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'DateOnlyProperty' + /// + [Fact] + public void DateOnlyPropertyTest() + { + // TODO unit test for the property 'DateOnlyProperty' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs new file mode 100644 index 000000000000..95e56f782da3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing DeprecatedObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DeprecatedObjectTests : IDisposable + { + // TODO uncomment below to declare an instance variable for DeprecatedObject + //private DeprecatedObject instance; + + public DeprecatedObjectTests() + { + // TODO uncomment below to create an instance of DeprecatedObject + //instance = new DeprecatedObject(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of DeprecatedObject + /// + [Fact] + public void DeprecatedObjectInstanceTest() + { + // TODO uncomment below to test "IsType" DeprecatedObject + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DogTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DogTests.cs new file mode 100644 index 000000000000..b8e8bca05384 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DogTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Dog + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DogTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Dog + //private Dog instance; + + public DogTests() + { + // TODO uncomment below to create an instance of Dog + //instance = new Dog(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Dog + /// + [Fact] + public void DogInstanceTest() + { + // TODO uncomment below to test "IsType" Dog + //Assert.IsType(instance); + } + + /// + /// Test the property 'Breed' + /// + [Fact] + public void BreedTest() + { + // TODO unit test for the property 'Breed' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DrawingTests.cs new file mode 100644 index 000000000000..a2de4a1b97b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/DrawingTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Drawing + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class DrawingTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Drawing + //private Drawing instance; + + public DrawingTests() + { + // TODO uncomment below to create an instance of Drawing + //instance = new Drawing(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Drawing + /// + [Fact] + public void DrawingInstanceTest() + { + // TODO uncomment below to test "IsType" Drawing + //Assert.IsType(instance); + } + + /// + /// Test the property 'MainShape' + /// + [Fact] + public void MainShapeTest() + { + // TODO unit test for the property 'MainShape' + } + + /// + /// Test the property 'NullableShape' + /// + [Fact] + public void NullableShapeTest() + { + // TODO unit test for the property 'NullableShape' + } + + /// + /// Test the property 'ShapeOrNull' + /// + [Fact] + public void ShapeOrNullTest() + { + // TODO unit test for the property 'ShapeOrNull' + } + + /// + /// Test the property 'Shapes' + /// + [Fact] + public void ShapesTest() + { + // TODO unit test for the property 'Shapes' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs new file mode 100644 index 000000000000..c6fee27690b7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumArrays + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumArraysTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumArrays + //private EnumArrays instance; + + public EnumArraysTests() + { + // TODO uncomment below to create an instance of EnumArrays + //instance = new EnumArrays(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumArrays + /// + [Fact] + public void EnumArraysInstanceTest() + { + // TODO uncomment below to test "IsType" EnumArrays + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayEnum' + /// + [Fact] + public void ArrayEnumTest() + { + // TODO unit test for the property 'ArrayEnum' + } + + /// + /// Test the property 'JustSymbol' + /// + [Fact] + public void JustSymbolTest() + { + // TODO unit test for the property 'JustSymbol' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs new file mode 100644 index 000000000000..44dbbe4d324a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumClass + //private EnumClass instance; + + public EnumClassTests() + { + // TODO uncomment below to create an instance of EnumClass + //instance = new EnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumClass + /// + [Fact] + public void EnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" EnumClass + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs new file mode 100644 index 000000000000..3781eebbfcf2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EnumTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EnumTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EnumTest + //private EnumTest instance; + + public EnumTestTests() + { + // TODO uncomment below to create an instance of EnumTest + //instance = new EnumTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EnumTest + /// + [Fact] + public void EnumTestInstanceTest() + { + // TODO uncomment below to test "IsType" EnumTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + + /// + /// Test the property 'EnumInteger' + /// + [Fact] + public void EnumIntegerTest() + { + // TODO unit test for the property 'EnumInteger' + } + + /// + /// Test the property 'EnumIntegerOnly' + /// + [Fact] + public void EnumIntegerOnlyTest() + { + // TODO unit test for the property 'EnumIntegerOnly' + } + + /// + /// Test the property 'EnumNumber' + /// + [Fact] + public void EnumNumberTest() + { + // TODO unit test for the property 'EnumNumber' + } + + /// + /// Test the property 'EnumString' + /// + [Fact] + public void EnumStringTest() + { + // TODO unit test for the property 'EnumString' + } + + /// + /// Test the property 'OuterEnum' + /// + [Fact] + public void OuterEnumTest() + { + // TODO unit test for the property 'OuterEnum' + } + + /// + /// Test the property 'OuterEnumDefaultValue' + /// + [Fact] + public void OuterEnumDefaultValueTest() + { + // TODO unit test for the property 'OuterEnumDefaultValue' + } + + /// + /// Test the property 'OuterEnumInteger' + /// + [Fact] + public void OuterEnumIntegerTest() + { + // TODO unit test for the property 'OuterEnumInteger' + } + + /// + /// Test the property 'OuterEnumIntegerDefaultValue' + /// + [Fact] + public void OuterEnumIntegerDefaultValueTest() + { + // TODO unit test for the property 'OuterEnumIntegerDefaultValue' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs new file mode 100644 index 000000000000..f8d3daec3fe1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing EquilateralTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class EquilateralTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for EquilateralTriangle + //private EquilateralTriangle instance; + + public EquilateralTriangleTests() + { + // TODO uncomment below to create an instance of EquilateralTriangle + //instance = new EquilateralTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of EquilateralTriangle + /// + [Fact] + public void EquilateralTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" EquilateralTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 000000000000..e2685848d5ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FileSchemaTestClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + public FileSchemaTestClassTests() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Fact] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsType" FileSchemaTestClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'File' + /// + [Fact] + public void FileTest() + { + // TODO unit test for the property 'File' + } + + /// + /// Test the property 'Files' + /// + [Fact] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 000000000000..c305c5356b05 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FileTests : IDisposable + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + public FileTests() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of File + /// + [Fact] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsType" File + //Assert.IsType(instance); + } + + /// + /// Test the property 'SourceURI' + /// + [Fact] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs new file mode 100644 index 000000000000..55086a7cf24b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FooGetDefaultResponse + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooGetDefaultResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FooGetDefaultResponse + //private FooGetDefaultResponse instance; + + public FooGetDefaultResponseTests() + { + // TODO uncomment below to create an instance of FooGetDefaultResponse + //instance = new FooGetDefaultResponse(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FooGetDefaultResponse + /// + [Fact] + public void FooGetDefaultResponseInstanceTest() + { + // TODO uncomment below to test "IsType" FooGetDefaultResponse + //Assert.IsType(instance); + } + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FooTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FooTests.cs new file mode 100644 index 000000000000..871506eeaac5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FooTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Foo + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FooTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Foo + //private Foo instance; + + public FooTests() + { + // TODO uncomment below to create an instance of Foo + //instance = new Foo(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Foo + /// + [Fact] + public void FooInstanceTest() + { + // TODO uncomment below to test "IsType" Foo + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs new file mode 100644 index 000000000000..7dad1b08bc02 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FormatTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FormatTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FormatTest + //private FormatTest instance; + + public FormatTestTests() + { + // TODO uncomment below to create an instance of FormatTest + //instance = new FormatTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FormatTest + /// + [Fact] + public void FormatTestInstanceTest() + { + // TODO uncomment below to test "IsType" FormatTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'Byte' + /// + [Fact] + public void ByteTest() + { + // TODO unit test for the property 'Byte' + } + + /// + /// Test the property 'Date' + /// + [Fact] + public void DateTest() + { + // TODO unit test for the property 'Date' + } + + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + + /// + /// Test the property 'Decimal' + /// + [Fact] + public void DecimalTest() + { + // TODO unit test for the property 'Decimal' + } + + /// + /// Test the property 'Double' + /// + [Fact] + public void DoubleTest() + { + // TODO unit test for the property 'Double' + } + + /// + /// Test the property 'Float' + /// + [Fact] + public void FloatTest() + { + // TODO unit test for the property 'Float' + } + + /// + /// Test the property 'Int32' + /// + [Fact] + public void Int32Test() + { + // TODO unit test for the property 'Int32' + } + + /// + /// Test the property 'Int32Range' + /// + [Fact] + public void Int32RangeTest() + { + // TODO unit test for the property 'Int32Range' + } + + /// + /// Test the property 'Int64' + /// + [Fact] + public void Int64Test() + { + // TODO unit test for the property 'Int64' + } + + /// + /// Test the property 'Int64Negative' + /// + [Fact] + public void Int64NegativeTest() + { + // TODO unit test for the property 'Int64Negative' + } + + /// + /// Test the property 'Int64NegativeExclusive' + /// + [Fact] + public void Int64NegativeExclusiveTest() + { + // TODO unit test for the property 'Int64NegativeExclusive' + } + + /// + /// Test the property 'Int64Positive' + /// + [Fact] + public void Int64PositiveTest() + { + // TODO unit test for the property 'Int64Positive' + } + + /// + /// Test the property 'Int64PositiveExclusive' + /// + [Fact] + public void Int64PositiveExclusiveTest() + { + // TODO unit test for the property 'Int64PositiveExclusive' + } + + /// + /// Test the property 'Integer' + /// + [Fact] + public void IntegerTest() + { + // TODO unit test for the property 'Integer' + } + + /// + /// Test the property 'PatternWithBackslash' + /// + [Fact] + public void PatternWithBackslashTest() + { + // TODO unit test for the property 'PatternWithBackslash' + } + + /// + /// Test the property 'PatternWithDigits' + /// + [Fact] + public void PatternWithDigitsTest() + { + // TODO unit test for the property 'PatternWithDigits' + } + + /// + /// Test the property 'PatternWithDigitsAndDelimiter' + /// + [Fact] + public void PatternWithDigitsAndDelimiterTest() + { + // TODO unit test for the property 'PatternWithDigitsAndDelimiter' + } + + /// + /// Test the property 'String' + /// + [Fact] + public void StringTest() + { + // TODO unit test for the property 'String' + } + + /// + /// Test the property 'UnsignedInteger' + /// + [Fact] + public void UnsignedIntegerTest() + { + // TODO unit test for the property 'UnsignedInteger' + } + + /// + /// Test the property 'UnsignedLong' + /// + [Fact] + public void UnsignedLongTest() + { + // TODO unit test for the property 'UnsignedLong' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs new file mode 100644 index 000000000000..a33c55ae4875 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing FruitReq + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitReqTests : IDisposable + { + // TODO uncomment below to declare an instance variable for FruitReq + //private FruitReq instance; + + public FruitReqTests() + { + // TODO uncomment below to create an instance of FruitReq + //instance = new FruitReq(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of FruitReq + /// + [Fact] + public void FruitReqInstanceTest() + { + // TODO uncomment below to test "IsType" FruitReq + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FruitTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FruitTests.cs new file mode 100644 index 000000000000..46448efc62f4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/FruitTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Fruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class FruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Fruit + //private Fruit instance; + + public FruitTests() + { + // TODO uncomment below to create an instance of Fruit + //instance = new Fruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Fruit + /// + [Fact] + public void FruitInstanceTest() + { + // TODO uncomment below to test "IsType" Fruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs new file mode 100644 index 000000000000..7e79cd067925 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing GmFruit + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class GmFruitTests : IDisposable + { + // TODO uncomment below to declare an instance variable for GmFruit + //private GmFruit instance; + + public GmFruitTests() + { + // TODO uncomment below to create an instance of GmFruit + //instance = new GmFruit(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of GmFruit + /// + [Fact] + public void GmFruitInstanceTest() + { + // TODO uncomment below to test "IsType" GmFruit + //Assert.IsType(instance); + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs new file mode 100644 index 000000000000..5f0e8672ed5f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing GrandparentAnimal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class GrandparentAnimalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for GrandparentAnimal + //private GrandparentAnimal instance; + + public GrandparentAnimalTests() + { + // TODO uncomment below to create an instance of GrandparentAnimal + //instance = new GrandparentAnimal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of GrandparentAnimal + /// + [Fact] + public void GrandparentAnimalInstanceTest() + { + // TODO uncomment below to test "IsType" GrandparentAnimal + //Assert.IsType(instance); + } + + /// + /// Test deserialize a ChildCat from type ParentPet + /// + [Fact] + public void ChildCatDeserializeFromParentPetTest() + { + // TODO uncomment below to test deserialize a ChildCat from type ParentPet + //Assert.IsType(JsonConvert.DeserializeObject(new ChildCat().ToJson())); + } + + /// + /// Test deserialize a ParentPet from type GrandparentAnimal + /// + [Fact] + public void ParentPetDeserializeFromGrandparentAnimalTest() + { + // TODO uncomment below to test deserialize a ParentPet from type GrandparentAnimal + //Assert.IsType(JsonConvert.DeserializeObject(new ParentPet().ToJson())); + } + + /// + /// Test the property 'PetType' + /// + [Fact] + public void PetTypeTest() + { + // TODO unit test for the property 'PetType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs new file mode 100644 index 000000000000..134a7d515ebb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing HasOnlyReadOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class HasOnlyReadOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for HasOnlyReadOnly + //private HasOnlyReadOnly instance; + + public HasOnlyReadOnlyTests() + { + // TODO uncomment below to create an instance of HasOnlyReadOnly + //instance = new HasOnlyReadOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of HasOnlyReadOnly + /// + [Fact] + public void HasOnlyReadOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" HasOnlyReadOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + /// + /// Test the property 'Foo' + /// + [Fact] + public void FooTest() + { + // TODO unit test for the property 'Foo' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs new file mode 100644 index 000000000000..18bb8672e980 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing HealthCheckResult + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class HealthCheckResultTests : IDisposable + { + // TODO uncomment below to declare an instance variable for HealthCheckResult + //private HealthCheckResult instance; + + public HealthCheckResultTests() + { + // TODO uncomment below to create an instance of HealthCheckResult + //instance = new HealthCheckResult(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of HealthCheckResult + /// + [Fact] + public void HealthCheckResultInstanceTest() + { + // TODO uncomment below to test "IsType" HealthCheckResult + //Assert.IsType(instance); + } + + /// + /// Test the property 'NullableMessage' + /// + [Fact] + public void NullableMessageTest() + { + // TODO unit test for the property 'NullableMessage' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs new file mode 100644 index 000000000000..464750233cd2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing IsoscelesTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class IsoscelesTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for IsoscelesTriangle + //private IsoscelesTriangle instance; + + public IsoscelesTriangleTests() + { + // TODO uncomment below to create an instance of IsoscelesTriangle + //instance = new IsoscelesTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of IsoscelesTriangle + /// + [Fact] + public void IsoscelesTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" IsoscelesTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ListTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ListTests.cs new file mode 100644 index 000000000000..d95303d97517 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ListTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing List + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ListTests : IDisposable + { + // TODO uncomment below to declare an instance variable for List + //private List instance; + + public ListTests() + { + // TODO uncomment below to create an instance of List + //instance = new List(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of List + /// + [Fact] + public void ListInstanceTest() + { + // TODO uncomment below to test "IsType" List + //Assert.IsType(instance); + } + + /// + /// Test the property 'Var123List' + /// + [Fact] + public void Var123ListTest() + { + // TODO unit test for the property 'Var123List' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs new file mode 100644 index 000000000000..31d21de5b60c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing LiteralStringClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class LiteralStringClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for LiteralStringClass + //private LiteralStringClass instance; + + public LiteralStringClassTests() + { + // TODO uncomment below to create an instance of LiteralStringClass + //instance = new LiteralStringClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of LiteralStringClass + /// + [Fact] + public void LiteralStringClassInstanceTest() + { + // TODO uncomment below to test "IsType" LiteralStringClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'EscapedLiteralString' + /// + [Fact] + public void EscapedLiteralStringTest() + { + // TODO unit test for the property 'EscapedLiteralString' + } + + /// + /// Test the property 'UnescapedLiteralString' + /// + [Fact] + public void UnescapedLiteralStringTest() + { + // TODO unit test for the property 'UnescapedLiteralString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MammalTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MammalTests.cs new file mode 100644 index 000000000000..64bd9e890343 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MammalTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Mammal + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MammalTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Mammal + //private Mammal instance; + + public MammalTests() + { + // TODO uncomment below to create an instance of Mammal + //instance = new Mammal(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Mammal + /// + [Fact] + public void MammalInstanceTest() + { + // TODO uncomment below to test "IsType" Mammal + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MapTestTests.cs new file mode 100644 index 000000000000..2dc6d8d8e04b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MapTestTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MapTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MapTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MapTest + //private MapTest instance; + + public MapTestTests() + { + // TODO uncomment below to create an instance of MapTest + //instance = new MapTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MapTest + /// + [Fact] + public void MapTestInstanceTest() + { + // TODO uncomment below to test "IsType" MapTest + //Assert.IsType(instance); + } + + /// + /// Test the property 'DirectMap' + /// + [Fact] + public void DirectMapTest() + { + // TODO unit test for the property 'DirectMap' + } + + /// + /// Test the property 'IndirectMap' + /// + [Fact] + public void IndirectMapTest() + { + // TODO unit test for the property 'IndirectMap' + } + + /// + /// Test the property 'MapMapOfString' + /// + [Fact] + public void MapMapOfStringTest() + { + // TODO unit test for the property 'MapMapOfString' + } + + /// + /// Test the property 'MapOfEnumString' + /// + [Fact] + public void MapOfEnumStringTest() + { + // TODO unit test for the property 'MapOfEnumString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixLogTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixLogTests.cs new file mode 100644 index 000000000000..3f108758fd2e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixLogTests.cs @@ -0,0 +1,344 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixLog + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixLogTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixLog + //private MixLog instance; + + public MixLogTests() + { + // TODO uncomment below to create an instance of MixLog + //instance = new MixLog(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixLog + /// + [Fact] + public void MixLogInstanceTest() + { + // TODO uncomment below to test "IsType" MixLog + //Assert.IsType(instance); + } + + /// + /// Test the property 'Description' + /// + [Fact] + public void DescriptionTest() + { + // TODO unit test for the property 'Description' + } + + /// + /// Test the property 'FormulaVersionDate' + /// + [Fact] + public void FormulaVersionDateTest() + { + // TODO unit test for the property 'FormulaVersionDate' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'MixDate' + /// + [Fact] + public void MixDateTest() + { + // TODO unit test for the property 'MixDate' + } + + /// + /// Test the property 'TotalOverPoors' + /// + [Fact] + public void TotalOverPoorsTest() + { + // TODO unit test for the property 'TotalOverPoors' + } + + /// + /// Test the property 'TotalRecalculations' + /// + [Fact] + public void TotalRecalculationsTest() + { + // TODO unit test for the property 'TotalRecalculations' + } + + /// + /// Test the property 'TotalSkips' + /// + [Fact] + public void TotalSkipsTest() + { + // TODO unit test for the property 'TotalSkips' + } + + /// + /// Test the property 'TotalUnderPours' + /// + [Fact] + public void TotalUnderPoursTest() + { + // TODO unit test for the property 'TotalUnderPours' + } + + /// + /// Test the property 'BatchNumber' + /// + [Fact] + public void BatchNumberTest() + { + // TODO unit test for the property 'BatchNumber' + } + + /// + /// Test the property 'BrandCode' + /// + [Fact] + public void BrandCodeTest() + { + // TODO unit test for the property 'BrandCode' + } + + /// + /// Test the property 'BrandId' + /// + [Fact] + public void BrandIdTest() + { + // TODO unit test for the property 'BrandId' + } + + /// + /// Test the property 'BrandName' + /// + [Fact] + public void BrandNameTest() + { + // TODO unit test for the property 'BrandName' + } + + /// + /// Test the property 'CategoryCode' + /// + [Fact] + public void CategoryCodeTest() + { + // TODO unit test for the property 'CategoryCode' + } + + /// + /// Test the property 'Color' + /// + [Fact] + public void ColorTest() + { + // TODO unit test for the property 'Color' + } + + /// + /// Test the property 'ColorDescription' + /// + [Fact] + public void ColorDescriptionTest() + { + // TODO unit test for the property 'ColorDescription' + } + + /// + /// Test the property 'Comment' + /// + [Fact] + public void CommentTest() + { + // TODO unit test for the property 'Comment' + } + + /// + /// Test the property 'CommercialProductCode' + /// + [Fact] + public void CommercialProductCodeTest() + { + // TODO unit test for the property 'CommercialProductCode' + } + + /// + /// Test the property 'Country' + /// + [Fact] + public void CountryTest() + { + // TODO unit test for the property 'Country' + } + + /// + /// Test the property 'CreatedBy' + /// + [Fact] + public void CreatedByTest() + { + // TODO unit test for the property 'CreatedBy' + } + + /// + /// Test the property 'CreatedByFirstName' + /// + [Fact] + public void CreatedByFirstNameTest() + { + // TODO unit test for the property 'CreatedByFirstName' + } + + /// + /// Test the property 'CreatedByLastName' + /// + [Fact] + public void CreatedByLastNameTest() + { + // TODO unit test for the property 'CreatedByLastName' + } + + /// + /// Test the property 'DeltaECalculationRepaired' + /// + [Fact] + public void DeltaECalculationRepairedTest() + { + // TODO unit test for the property 'DeltaECalculationRepaired' + } + + /// + /// Test the property 'DeltaECalculationSprayout' + /// + [Fact] + public void DeltaECalculationSprayoutTest() + { + // TODO unit test for the property 'DeltaECalculationSprayout' + } + + /// + /// Test the property 'OwnColorVariantNumber' + /// + [Fact] + public void OwnColorVariantNumberTest() + { + // TODO unit test for the property 'OwnColorVariantNumber' + } + + /// + /// Test the property 'PrimerProductId' + /// + [Fact] + public void PrimerProductIdTest() + { + // TODO unit test for the property 'PrimerProductId' + } + + /// + /// Test the property 'ProductId' + /// + [Fact] + public void ProductIdTest() + { + // TODO unit test for the property 'ProductId' + } + + /// + /// Test the property 'ProductLineCode' + /// + [Fact] + public void ProductLineCodeTest() + { + // TODO unit test for the property 'ProductLineCode' + } + + /// + /// Test the property 'ProductName' + /// + [Fact] + public void ProductNameTest() + { + // TODO unit test for the property 'ProductName' + } + + /// + /// Test the property 'SelectedVersionIndex' + /// + [Fact] + public void SelectedVersionIndexTest() + { + // TODO unit test for the property 'SelectedVersionIndex' + } + + /// + /// Test the property 'ShopId' + /// + [Fact] + public void ShopIdTest() + { + // TODO unit test for the property 'ShopId' + } + + /// + /// Test the property 'SomeCode' + /// + [Fact] + public void SomeCodeTest() + { + // TODO unit test for the property 'SomeCode' + } + + /// + /// Test the property 'TotalPrice' + /// + [Fact] + public void TotalPriceTest() + { + // TODO unit test for the property 'TotalPrice' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs new file mode 100644 index 000000000000..4ce302d1d047 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedAnyOfContent + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedAnyOfContentTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedAnyOfContent + //private MixedAnyOfContent instance; + + public MixedAnyOfContentTests() + { + // TODO uncomment below to create an instance of MixedAnyOfContent + //instance = new MixedAnyOfContent(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedAnyOfContent + /// + [Fact] + public void MixedAnyOfContentInstanceTest() + { + // TODO uncomment below to test "IsType" MixedAnyOfContent + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs new file mode 100644 index 000000000000..53b28cc0658d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedAnyOf + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedAnyOfTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedAnyOf + //private MixedAnyOf instance; + + public MixedAnyOfTests() + { + // TODO uncomment below to create an instance of MixedAnyOf + //instance = new MixedAnyOf(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedAnyOf + /// + [Fact] + public void MixedAnyOfInstanceTest() + { + // TODO uncomment below to test "IsType" MixedAnyOf + //Assert.IsType(instance); + } + + /// + /// Test the property 'Content' + /// + [Fact] + public void ContentTest() + { + // TODO unit test for the property 'Content' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs new file mode 100644 index 000000000000..781b72025008 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedOneOfContent + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedOneOfContentTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedOneOfContent + //private MixedOneOfContent instance; + + public MixedOneOfContentTests() + { + // TODO uncomment below to create an instance of MixedOneOfContent + //instance = new MixedOneOfContent(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedOneOfContent + /// + [Fact] + public void MixedOneOfContentInstanceTest() + { + // TODO uncomment below to test "IsType" MixedOneOfContent + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs new file mode 100644 index 000000000000..ee8b73d44f24 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedOneOf + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedOneOfTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedOneOf + //private MixedOneOf instance; + + public MixedOneOfTests() + { + // TODO uncomment below to create an instance of MixedOneOf + //instance = new MixedOneOf(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedOneOf + /// + [Fact] + public void MixedOneOfInstanceTest() + { + // TODO uncomment below to test "IsType" MixedOneOf + //Assert.IsType(instance); + } + + /// + /// Test the property 'Content' + /// + [Fact] + public void ContentTest() + { + // TODO unit test for the property 'Content' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs new file mode 100644 index 000000000000..d3689c15f401 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedPropertiesAndAdditionalPropertiesClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedPropertiesAndAdditionalPropertiesClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedPropertiesAndAdditionalPropertiesClass + //private MixedPropertiesAndAdditionalPropertiesClass instance; + + public MixedPropertiesAndAdditionalPropertiesClassTests() + { + // TODO uncomment below to create an instance of MixedPropertiesAndAdditionalPropertiesClass + //instance = new MixedPropertiesAndAdditionalPropertiesClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedPropertiesAndAdditionalPropertiesClass + /// + [Fact] + public void MixedPropertiesAndAdditionalPropertiesClassInstanceTest() + { + // TODO uncomment below to test "IsType" MixedPropertiesAndAdditionalPropertiesClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'DateTime' + /// + [Fact] + public void DateTimeTest() + { + // TODO unit test for the property 'DateTime' + } + + /// + /// Test the property 'Map' + /// + [Fact] + public void MapTest() + { + // TODO unit test for the property 'Map' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + + /// + /// Test the property 'UuidWithPattern' + /// + [Fact] + public void UuidWithPatternTest() + { + // TODO unit test for the property 'UuidWithPattern' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs new file mode 100644 index 000000000000..2ed728a41b84 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing MixedSubId + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class MixedSubIdTests : IDisposable + { + // TODO uncomment below to declare an instance variable for MixedSubId + //private MixedSubId instance; + + public MixedSubIdTests() + { + // TODO uncomment below to create an instance of MixedSubId + //instance = new MixedSubId(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of MixedSubId + /// + [Fact] + public void MixedSubIdInstanceTest() + { + // TODO uncomment below to test "IsType" MixedSubId + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs new file mode 100644 index 000000000000..3b5e94c5f8f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Model200Response + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class Model200ResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Model200Response + //private Model200Response instance; + + public Model200ResponseTests() + { + // TODO uncomment below to create an instance of Model200Response + //instance = new Model200Response(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Model200Response + /// + [Fact] + public void Model200ResponseInstanceTest() + { + // TODO uncomment below to test "IsType" Model200Response + //Assert.IsType(instance); + } + + /// + /// Test the property 'Class' + /// + [Fact] + public void ClassTest() + { + // TODO unit test for the property 'Class' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs new file mode 100644 index 000000000000..5a986cfdc6c2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ModelClient + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ModelClientTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ModelClient + //private ModelClient instance; + + public ModelClientTests() + { + // TODO uncomment below to create an instance of ModelClient + //instance = new ModelClient(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ModelClient + /// + [Fact] + public void ModelClientInstanceTest() + { + // TODO uncomment below to test "IsType" ModelClient + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarClient' + /// + [Fact] + public void VarClientTest() + { + // TODO unit test for the property 'VarClient' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NameTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NameTests.cs new file mode 100644 index 000000000000..3aac92ae4683 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NameTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Name + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Name + //private Name instance; + + public NameTests() + { + // TODO uncomment below to create an instance of Name + //instance = new Name(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Name + /// + [Fact] + public void NameInstanceTest() + { + // TODO uncomment below to test "IsType" Name + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarName' + /// + [Fact] + public void VarNameTest() + { + // TODO unit test for the property 'VarName' + } + + /// + /// Test the property 'Property' + /// + [Fact] + public void PropertyTest() + { + // TODO unit test for the property 'Property' + } + + /// + /// Test the property 'SnakeCase' + /// + [Fact] + public void SnakeCaseTest() + { + // TODO unit test for the property 'SnakeCase' + } + + /// + /// Test the property 'Var123Number' + /// + [Fact] + public void Var123NumberTest() + { + // TODO unit test for the property 'Var123Number' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs new file mode 100644 index 000000000000..dd3b74e33061 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NotificationtestGetElementsV1ResponseMPayload + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NotificationtestGetElementsV1ResponseMPayloadTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NotificationtestGetElementsV1ResponseMPayload + //private NotificationtestGetElementsV1ResponseMPayload instance; + + public NotificationtestGetElementsV1ResponseMPayloadTests() + { + // TODO uncomment below to create an instance of NotificationtestGetElementsV1ResponseMPayload + //instance = new NotificationtestGetElementsV1ResponseMPayload(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NotificationtestGetElementsV1ResponseMPayload + /// + [Fact] + public void NotificationtestGetElementsV1ResponseMPayloadInstanceTest() + { + // TODO uncomment below to test "IsType" NotificationtestGetElementsV1ResponseMPayload + //Assert.IsType(instance); + } + + /// + /// Test the property 'AObjVariableobject' + /// + [Fact] + public void AObjVariableobjectTest() + { + // TODO unit test for the property 'AObjVariableobject' + } + + /// + /// Test the property 'PkiNotificationtestID' + /// + [Fact] + public void PkiNotificationtestIDTest() + { + // TODO unit test for the property 'PkiNotificationtestID' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs new file mode 100644 index 000000000000..1e19aa6b8231 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableClass + //private NullableClass instance; + + public NullableClassTests() + { + // TODO uncomment below to create an instance of NullableClass + //instance = new NullableClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableClass + /// + [Fact] + public void NullableClassInstanceTest() + { + // TODO uncomment below to test "IsType" NullableClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'ArrayAndItemsNullableProp' + /// + [Fact] + public void ArrayAndItemsNullablePropTest() + { + // TODO unit test for the property 'ArrayAndItemsNullableProp' + } + + /// + /// Test the property 'ArrayItemsNullable' + /// + [Fact] + public void ArrayItemsNullableTest() + { + // TODO unit test for the property 'ArrayItemsNullable' + } + + /// + /// Test the property 'ArrayNullableProp' + /// + [Fact] + public void ArrayNullablePropTest() + { + // TODO unit test for the property 'ArrayNullableProp' + } + + /// + /// Test the property 'BooleanProp' + /// + [Fact] + public void BooleanPropTest() + { + // TODO unit test for the property 'BooleanProp' + } + + /// + /// Test the property 'DateProp' + /// + [Fact] + public void DatePropTest() + { + // TODO unit test for the property 'DateProp' + } + + /// + /// Test the property 'DatetimeProp' + /// + [Fact] + public void DatetimePropTest() + { + // TODO unit test for the property 'DatetimeProp' + } + + /// + /// Test the property 'IntegerProp' + /// + [Fact] + public void IntegerPropTest() + { + // TODO unit test for the property 'IntegerProp' + } + + /// + /// Test the property 'NumberProp' + /// + [Fact] + public void NumberPropTest() + { + // TODO unit test for the property 'NumberProp' + } + + /// + /// Test the property 'ObjectAndItemsNullableProp' + /// + [Fact] + public void ObjectAndItemsNullablePropTest() + { + // TODO unit test for the property 'ObjectAndItemsNullableProp' + } + + /// + /// Test the property 'ObjectItemsNullable' + /// + [Fact] + public void ObjectItemsNullableTest() + { + // TODO unit test for the property 'ObjectItemsNullable' + } + + /// + /// Test the property 'ObjectNullableProp' + /// + [Fact] + public void ObjectNullablePropTest() + { + // TODO unit test for the property 'ObjectNullableProp' + } + + /// + /// Test the property 'StringProp' + /// + [Fact] + public void StringPropTest() + { + // TODO unit test for the property 'StringProp' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs new file mode 100644 index 000000000000..db8c9aa09568 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableGuidClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableGuidClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableGuidClass + //private NullableGuidClass instance; + + public NullableGuidClassTests() + { + // TODO uncomment below to create an instance of NullableGuidClass + //instance = new NullableGuidClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableGuidClass + /// + [Fact] + public void NullableGuidClassInstanceTest() + { + // TODO uncomment below to test "IsType" NullableGuidClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs new file mode 100644 index 000000000000..e65ba44efa2e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NullableShape + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NullableShapeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NullableShape + //private NullableShape instance; + + public NullableShapeTests() + { + // TODO uncomment below to create an instance of NullableShape + //instance = new NullableShape(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NullableShape + /// + [Fact] + public void NullableShapeInstanceTest() + { + // TODO uncomment below to test "IsType" NullableShape + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs new file mode 100644 index 000000000000..2b88fb1a609e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NumberOnly + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NumberOnlyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NumberOnly + //private NumberOnly instance; + + public NumberOnlyTests() + { + // TODO uncomment below to create an instance of NumberOnly + //instance = new NumberOnly(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NumberOnly + /// + [Fact] + public void NumberOnlyInstanceTest() + { + // TODO uncomment below to test "IsType" NumberOnly + //Assert.IsType(instance); + } + + /// + /// Test the property 'JustNumber' + /// + [Fact] + public void JustNumberTest() + { + // TODO unit test for the property 'JustNumber' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs new file mode 100644 index 000000000000..078655aaba70 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ObjectWithDeprecatedFields + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ObjectWithDeprecatedFieldsTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ObjectWithDeprecatedFields + //private ObjectWithDeprecatedFields instance; + + public ObjectWithDeprecatedFieldsTests() + { + // TODO uncomment below to create an instance of ObjectWithDeprecatedFields + //instance = new ObjectWithDeprecatedFields(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ObjectWithDeprecatedFields + /// + [Fact] + public void ObjectWithDeprecatedFieldsInstanceTest() + { + // TODO uncomment below to test "IsType" ObjectWithDeprecatedFields + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bars' + /// + [Fact] + public void BarsTest() + { + // TODO unit test for the property 'Bars' + } + + /// + /// Test the property 'DeprecatedRef' + /// + [Fact] + public void DeprecatedRefTest() + { + // TODO unit test for the property 'DeprecatedRef' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Uuid' + /// + [Fact] + public void UuidTest() + { + // TODO unit test for the property 'Uuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs new file mode 100644 index 000000000000..8ef411a15eb6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OneOfString + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OneOfStringTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OneOfString + //private OneOfString instance; + + public OneOfStringTests() + { + // TODO uncomment below to create an instance of OneOfString + //instance = new OneOfString(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OneOfString + /// + [Fact] + public void OneOfStringInstanceTest() + { + // TODO uncomment below to test "IsType" OneOfString + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OrderTests.cs new file mode 100644 index 000000000000..e7187bbdc92c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Order + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OrderTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Order + //private Order instance; + + public OrderTests() + { + // TODO uncomment below to create an instance of Order + //instance = new Order(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Order + /// + [Fact] + public void OrderInstanceTest() + { + // TODO uncomment below to test "IsType" Order + //Assert.IsType(instance); + } + + /// + /// Test the property 'Complete' + /// + [Fact] + public void CompleteTest() + { + // TODO unit test for the property 'Complete' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'PetId' + /// + [Fact] + public void PetIdTest() + { + // TODO unit test for the property 'PetId' + } + + /// + /// Test the property 'Quantity' + /// + [Fact] + public void QuantityTest() + { + // TODO unit test for the property 'Quantity' + } + + /// + /// Test the property 'ShipDate' + /// + [Fact] + public void ShipDateTest() + { + // TODO unit test for the property 'ShipDate' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs new file mode 100644 index 000000000000..0bb8ce5e5d9b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterComposite + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterCompositeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterComposite + //private OuterComposite instance; + + public OuterCompositeTests() + { + // TODO uncomment below to create an instance of OuterComposite + //instance = new OuterComposite(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterComposite + /// + [Fact] + public void OuterCompositeInstanceTest() + { + // TODO uncomment below to test "IsType" OuterComposite + //Assert.IsType(instance); + } + + /// + /// Test the property 'MyBoolean' + /// + [Fact] + public void MyBooleanTest() + { + // TODO unit test for the property 'MyBoolean' + } + + /// + /// Test the property 'MyNumber' + /// + [Fact] + public void MyNumberTest() + { + // TODO unit test for the property 'MyNumber' + } + + /// + /// Test the property 'MyString' + /// + [Fact] + public void MyStringTest() + { + // TODO unit test for the property 'MyString' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs new file mode 100644 index 000000000000..a1d1e1527771 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumDefaultValue + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumDefaultValueTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumDefaultValue + //private OuterEnumDefaultValue instance; + + public OuterEnumDefaultValueTests() + { + // TODO uncomment below to create an instance of OuterEnumDefaultValue + //instance = new OuterEnumDefaultValue(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumDefaultValue + /// + [Fact] + public void OuterEnumDefaultValueInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumDefaultValue + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs new file mode 100644 index 000000000000..030326d75792 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumIntegerDefaultValue + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumIntegerDefaultValueTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumIntegerDefaultValue + //private OuterEnumIntegerDefaultValue instance; + + public OuterEnumIntegerDefaultValueTests() + { + // TODO uncomment below to create an instance of OuterEnumIntegerDefaultValue + //instance = new OuterEnumIntegerDefaultValue(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumIntegerDefaultValue + /// + [Fact] + public void OuterEnumIntegerDefaultValueInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumIntegerDefaultValue + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs new file mode 100644 index 000000000000..1f3bfe459e76 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumInteger + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumIntegerTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumInteger + //private OuterEnumInteger instance; + + public OuterEnumIntegerTests() + { + // TODO uncomment below to create an instance of OuterEnumInteger + //instance = new OuterEnumInteger(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumInteger + /// + [Fact] + public void OuterEnumIntegerInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumInteger + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs new file mode 100644 index 000000000000..c4cb8eeecee8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnumTest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumTestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnumTest + //private OuterEnumTest instance; + + public OuterEnumTestTests() + { + // TODO uncomment below to create an instance of OuterEnumTest + //instance = new OuterEnumTest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnumTest + /// + [Fact] + public void OuterEnumTestInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnumTest + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs new file mode 100644 index 000000000000..2859494010b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing OuterEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class OuterEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for OuterEnum + //private OuterEnum instance; + + public OuterEnumTests() + { + // TODO uncomment below to create an instance of OuterEnum + //instance = new OuterEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of OuterEnum + /// + [Fact] + public void OuterEnumInstanceTest() + { + // TODO uncomment below to test "IsType" OuterEnum + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs new file mode 100644 index 000000000000..b0ebddd374f9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ParentPet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ParentPetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ParentPet + //private ParentPet instance; + + public ParentPetTests() + { + // TODO uncomment below to create an instance of ParentPet + //instance = new ParentPet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ParentPet + /// + [Fact] + public void ParentPetInstanceTest() + { + // TODO uncomment below to test "IsType" ParentPet + //Assert.IsType(instance); + } + + /// + /// Test deserialize a ChildCat from type ParentPet + /// + [Fact] + public void ChildCatDeserializeFromParentPetTest() + { + // TODO uncomment below to test deserialize a ChildCat from type ParentPet + //Assert.IsType(JsonConvert.DeserializeObject(new ChildCat().ToJson())); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/PetTests.cs new file mode 100644 index 000000000000..8485d1213ce6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Pet + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PetTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pet + //private Pet instance; + + public PetTests() + { + // TODO uncomment below to create an instance of Pet + //instance = new Pet(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pet + /// + [Fact] + public void PetInstanceTest() + { + // TODO uncomment below to test "IsType" Pet + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + + /// + /// Test the property 'PhotoUrls' + /// + [Fact] + public void PhotoUrlsTest() + { + // TODO unit test for the property 'PhotoUrls' + } + + /// + /// Test the property 'Category' + /// + [Fact] + public void CategoryTest() + { + // TODO unit test for the property 'Category' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Status' + /// + [Fact] + public void StatusTest() + { + // TODO unit test for the property 'Status' + } + + /// + /// Test the property 'Tags' + /// + [Fact] + public void TagsTest() + { + // TODO unit test for the property 'Tags' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/PigTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/PigTests.cs new file mode 100644 index 000000000000..bd052bc705b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/PigTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Pig + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PigTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Pig + //private Pig instance; + + public PigTests() + { + // TODO uncomment below to create an instance of Pig + //instance = new Pig(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Pig + /// + [Fact] + public void PigInstanceTest() + { + // TODO uncomment below to test "IsType" Pig + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs new file mode 100644 index 000000000000..23120ba7bdfa --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing PolymorphicProperty + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class PolymorphicPropertyTests : IDisposable + { + // TODO uncomment below to declare an instance variable for PolymorphicProperty + //private PolymorphicProperty instance; + + public PolymorphicPropertyTests() + { + // TODO uncomment below to create an instance of PolymorphicProperty + //instance = new PolymorphicProperty(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of PolymorphicProperty + /// + [Fact] + public void PolymorphicPropertyInstanceTest() + { + // TODO uncomment below to test "IsType" PolymorphicProperty + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs new file mode 100644 index 000000000000..2ddd31cfcbba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing QuadrilateralInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class QuadrilateralInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for QuadrilateralInterface + //private QuadrilateralInterface instance; + + public QuadrilateralInterfaceTests() + { + // TODO uncomment below to create an instance of QuadrilateralInterface + //instance = new QuadrilateralInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of QuadrilateralInterface + /// + [Fact] + public void QuadrilateralInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" QuadrilateralInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs new file mode 100644 index 000000000000..65673847d759 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Quadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class QuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Quadrilateral + //private Quadrilateral instance; + + public QuadrilateralTests() + { + // TODO uncomment below to create an instance of Quadrilateral + //instance = new Quadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Quadrilateral + /// + [Fact] + public void QuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" Quadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs new file mode 100644 index 000000000000..a4c91cf44a57 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ReadOnlyFirst + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReadOnlyFirstTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ReadOnlyFirst + //private ReadOnlyFirst instance; + + public ReadOnlyFirstTests() + { + // TODO uncomment below to create an instance of ReadOnlyFirst + //instance = new ReadOnlyFirst(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ReadOnlyFirst + /// + [Fact] + public void ReadOnlyFirstInstanceTest() + { + // TODO uncomment below to test "IsType" ReadOnlyFirst + //Assert.IsType(instance); + } + + /// + /// Test the property 'Bar' + /// + [Fact] + public void BarTest() + { + // TODO unit test for the property 'Bar' + } + + /// + /// Test the property 'Baz' + /// + [Fact] + public void BazTest() + { + // TODO unit test for the property 'Baz' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..d1da68281ff0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ReturnTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ReturnTests.cs new file mode 100644 index 000000000000..bbea79ed9511 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ReturnTests.cs @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Return + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ReturnTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Return + //private Return instance; + + public ReturnTests() + { + // TODO uncomment below to create an instance of Return + //instance = new Return(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Return + /// + [Fact] + public void ReturnInstanceTest() + { + // TODO uncomment below to test "IsType" Return + //Assert.IsType(instance); + } + + /// + /// Test the property 'Lock' + /// + [Fact] + public void LockTest() + { + // TODO unit test for the property 'Lock' + } + + /// + /// Test the property 'Abstract' + /// + [Fact] + public void AbstractTest() + { + // TODO unit test for the property 'Abstract' + } + + /// + /// Test the property 'VarReturn' + /// + [Fact] + public void VarReturnTest() + { + // TODO unit test for the property 'VarReturn' + } + + /// + /// Test the property 'Unsafe' + /// + [Fact] + public void UnsafeTest() + { + // TODO unit test for the property 'Unsafe' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs new file mode 100644 index 000000000000..5f21a874c4f0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RolesReportsHashRole + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RolesReportsHashRoleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RolesReportsHashRole + //private RolesReportsHashRole instance; + + public RolesReportsHashRoleTests() + { + // TODO uncomment below to create an instance of RolesReportsHashRole + //instance = new RolesReportsHashRole(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RolesReportsHashRole + /// + [Fact] + public void RolesReportsHashRoleInstanceTest() + { + // TODO uncomment below to test "IsType" RolesReportsHashRole + //Assert.IsType(instance); + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs new file mode 100644 index 000000000000..cddb8dc6f0b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RolesReportsHash + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RolesReportsHashTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RolesReportsHash + //private RolesReportsHash instance; + + public RolesReportsHashTests() + { + // TODO uncomment below to create an instance of RolesReportsHash + //instance = new RolesReportsHash(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RolesReportsHash + /// + [Fact] + public void RolesReportsHashInstanceTest() + { + // TODO uncomment below to test "IsType" RolesReportsHash + //Assert.IsType(instance); + } + + /// + /// Test the property 'Role' + /// + [Fact] + public void RoleTest() + { + // TODO unit test for the property 'Role' + } + + /// + /// Test the property 'RoleUuid' + /// + [Fact] + public void RoleUuidTest() + { + // TODO unit test for the property 'RoleUuid' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs new file mode 100644 index 000000000000..085d3e550a10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ScaleneTriangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ScaleneTriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ScaleneTriangle + //private ScaleneTriangle instance; + + public ScaleneTriangleTests() + { + // TODO uncomment below to create an instance of ScaleneTriangle + //instance = new ScaleneTriangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ScaleneTriangle + /// + [Fact] + public void ScaleneTriangleInstanceTest() + { + // TODO uncomment below to test "IsType" ScaleneTriangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs new file mode 100644 index 000000000000..62d6d69ff72d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ShapeInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ShapeInterface + //private ShapeInterface instance; + + public ShapeInterfaceTests() + { + // TODO uncomment below to create an instance of ShapeInterface + //instance = new ShapeInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ShapeInterface + /// + [Fact] + public void ShapeInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" ShapeInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs new file mode 100644 index 000000000000..dc6970b16f15 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ShapeOrNull + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeOrNullTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ShapeOrNull + //private ShapeOrNull instance; + + public ShapeOrNullTests() + { + // TODO uncomment below to create an instance of ShapeOrNull + //instance = new ShapeOrNull(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ShapeOrNull + /// + [Fact] + public void ShapeOrNullInstanceTest() + { + // TODO uncomment below to test "IsType" ShapeOrNull + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ShapeTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ShapeTests.cs new file mode 100644 index 000000000000..dbdf012c5ba4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ShapeTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Shape + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ShapeTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Shape + //private Shape instance; + + public ShapeTests() + { + // TODO uncomment below to create an instance of Shape + //instance = new Shape(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Shape + /// + [Fact] + public void ShapeInstanceTest() + { + // TODO uncomment below to test "IsType" Shape + //Assert.IsType(instance); + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs new file mode 100644 index 000000000000..baa6e1e9f6fd --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing SimpleQuadrilateral + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class SimpleQuadrilateralTests : IDisposable + { + // TODO uncomment below to declare an instance variable for SimpleQuadrilateral + //private SimpleQuadrilateral instance; + + public SimpleQuadrilateralTests() + { + // TODO uncomment below to create an instance of SimpleQuadrilateral + //instance = new SimpleQuadrilateral(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of SimpleQuadrilateral + /// + [Fact] + public void SimpleQuadrilateralInstanceTest() + { + // TODO uncomment below to test "IsType" SimpleQuadrilateral + //Assert.IsType(instance); + } + + /// + /// Test the property 'QuadrilateralType' + /// + [Fact] + public void QuadrilateralTypeTest() + { + // TODO unit test for the property 'QuadrilateralType' + } + + /// + /// Test the property 'ShapeType' + /// + [Fact] + public void ShapeTypeTest() + { + // TODO unit test for the property 'ShapeType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs new file mode 100644 index 000000000000..23763d9c3af0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing SpecialModelName + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class SpecialModelNameTests : IDisposable + { + // TODO uncomment below to declare an instance variable for SpecialModelName + //private SpecialModelName instance; + + public SpecialModelNameTests() + { + // TODO uncomment below to create an instance of SpecialModelName + //instance = new SpecialModelName(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of SpecialModelName + /// + [Fact] + public void SpecialModelNameInstanceTest() + { + // TODO uncomment below to test "IsType" SpecialModelName + //Assert.IsType(instance); + } + + /// + /// Test the property 'VarSpecialModelName' + /// + [Fact] + public void VarSpecialModelNameTest() + { + // TODO unit test for the property 'VarSpecialModelName' + } + + /// + /// Test the property 'SpecialPropertyName' + /// + [Fact] + public void SpecialPropertyNameTest() + { + // TODO unit test for the property 'SpecialPropertyName' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TagTests.cs new file mode 100644 index 000000000000..fe7f3d82baba --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TagTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Tag + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TagTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Tag + //private Tag instance; + + public TagTests() + { + // TODO uncomment below to create an instance of Tag + //instance = new Tag(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Tag + /// + [Fact] + public void TagInstanceTest() + { + // TODO uncomment below to test "IsType" Tag + //Assert.IsType(instance); + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'Name' + /// + [Fact] + public void NameTest() + { + // TODO unit test for the property 'Name' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs new file mode 100644 index 000000000000..eca020ce1fae --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestCollectionEndingWithWordListObject + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestCollectionEndingWithWordListObjectTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestCollectionEndingWithWordListObject + //private TestCollectionEndingWithWordListObject instance; + + public TestCollectionEndingWithWordListObjectTests() + { + // TODO uncomment below to create an instance of TestCollectionEndingWithWordListObject + //instance = new TestCollectionEndingWithWordListObject(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestCollectionEndingWithWordListObject + /// + [Fact] + public void TestCollectionEndingWithWordListObjectInstanceTest() + { + // TODO uncomment below to test "IsType" TestCollectionEndingWithWordListObject + //Assert.IsType(instance); + } + + /// + /// Test the property 'TestCollectionEndingWithWordList' + /// + [Fact] + public void TestCollectionEndingWithWordListTest() + { + // TODO unit test for the property 'TestCollectionEndingWithWordList' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs new file mode 100644 index 000000000000..e3c86aefabe3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestCollectionEndingWithWordList + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestCollectionEndingWithWordListTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestCollectionEndingWithWordList + //private TestCollectionEndingWithWordList instance; + + public TestCollectionEndingWithWordListTests() + { + // TODO uncomment below to create an instance of TestCollectionEndingWithWordList + //instance = new TestCollectionEndingWithWordList(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestCollectionEndingWithWordList + /// + [Fact] + public void TestCollectionEndingWithWordListInstanceTest() + { + // TODO uncomment below to test "IsType" TestCollectionEndingWithWordList + //Assert.IsType(instance); + } + + /// + /// Test the property 'Value' + /// + [Fact] + public void ValueTest() + { + // TODO unit test for the property 'Value' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs new file mode 100644 index 000000000000..23e08d8e4e9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TestInlineFreeformAdditionalPropertiesRequest + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TestInlineFreeformAdditionalPropertiesRequestTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TestInlineFreeformAdditionalPropertiesRequest + //private TestInlineFreeformAdditionalPropertiesRequest instance; + + public TestInlineFreeformAdditionalPropertiesRequestTests() + { + // TODO uncomment below to create an instance of TestInlineFreeformAdditionalPropertiesRequest + //instance = new TestInlineFreeformAdditionalPropertiesRequest(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TestInlineFreeformAdditionalPropertiesRequest + /// + [Fact] + public void TestInlineFreeformAdditionalPropertiesRequestInstanceTest() + { + // TODO uncomment below to test "IsType" TestInlineFreeformAdditionalPropertiesRequest + //Assert.IsType(instance); + } + + /// + /// Test the property 'SomeProperty' + /// + [Fact] + public void SomePropertyTest() + { + // TODO unit test for the property 'SomeProperty' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs new file mode 100644 index 000000000000..1293a2b212ed --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing TriangleInterface + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TriangleInterfaceTests : IDisposable + { + // TODO uncomment below to declare an instance variable for TriangleInterface + //private TriangleInterface instance; + + public TriangleInterfaceTests() + { + // TODO uncomment below to create an instance of TriangleInterface + //instance = new TriangleInterface(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of TriangleInterface + /// + [Fact] + public void TriangleInterfaceInstanceTest() + { + // TODO uncomment below to test "IsType" TriangleInterface + //Assert.IsType(instance); + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TriangleTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TriangleTests.cs new file mode 100644 index 000000000000..4cb535223483 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/TriangleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Triangle + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class TriangleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Triangle + //private Triangle instance; + + public TriangleTests() + { + // TODO uncomment below to create an instance of Triangle + //instance = new Triangle(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Triangle + /// + [Fact] + public void TriangleInstanceTest() + { + // TODO uncomment below to test "IsType" Triangle + //Assert.IsType(instance); + } + + /// + /// Test the property 'TriangleType' + /// + [Fact] + public void TriangleTypeTest() + { + // TODO unit test for the property 'TriangleType' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/UserTests.cs new file mode 100644 index 000000000000..6415f8561f1f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing User + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class UserTests : IDisposable + { + // TODO uncomment below to declare an instance variable for User + //private User instance; + + public UserTests() + { + // TODO uncomment below to create an instance of User + //instance = new User(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of User + /// + [Fact] + public void UserInstanceTest() + { + // TODO uncomment below to test "IsType" User + //Assert.IsType(instance); + } + + /// + /// Test the property 'AnyTypeProp' + /// + [Fact] + public void AnyTypePropTest() + { + // TODO unit test for the property 'AnyTypeProp' + } + + /// + /// Test the property 'AnyTypePropNullable' + /// + [Fact] + public void AnyTypePropNullableTest() + { + // TODO unit test for the property 'AnyTypePropNullable' + } + + /// + /// Test the property 'Email' + /// + [Fact] + public void EmailTest() + { + // TODO unit test for the property 'Email' + } + + /// + /// Test the property 'FirstName' + /// + [Fact] + public void FirstNameTest() + { + // TODO unit test for the property 'FirstName' + } + + /// + /// Test the property 'Id' + /// + [Fact] + public void IdTest() + { + // TODO unit test for the property 'Id' + } + + /// + /// Test the property 'LastName' + /// + [Fact] + public void LastNameTest() + { + // TODO unit test for the property 'LastName' + } + + /// + /// Test the property 'ObjectWithNoDeclaredProps' + /// + [Fact] + public void ObjectWithNoDeclaredPropsTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredProps' + } + + /// + /// Test the property 'ObjectWithNoDeclaredPropsNullable' + /// + [Fact] + public void ObjectWithNoDeclaredPropsNullableTest() + { + // TODO unit test for the property 'ObjectWithNoDeclaredPropsNullable' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Phone' + /// + [Fact] + public void PhoneTest() + { + // TODO unit test for the property 'Phone' + } + + /// + /// Test the property 'UserStatus' + /// + [Fact] + public void UserStatusTest() + { + // TODO unit test for the property 'UserStatus' + } + + /// + /// Test the property 'Username' + /// + [Fact] + public void UsernameTest() + { + // TODO unit test for the property 'Username' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/WhaleTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/WhaleTests.cs new file mode 100644 index 000000000000..7d05cc5e59ab --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/WhaleTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Whale + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class WhaleTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Whale + //private Whale instance; + + public WhaleTests() + { + // TODO uncomment below to create an instance of Whale + //instance = new Whale(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Whale + /// + [Fact] + public void WhaleInstanceTest() + { + // TODO uncomment below to test "IsType" Whale + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'HasBaleen' + /// + [Fact] + public void HasBaleenTest() + { + // TODO unit test for the property 'HasBaleen' + } + + /// + /// Test the property 'HasTeeth' + /// + [Fact] + public void HasTeethTest() + { + // TODO unit test for the property 'HasTeeth' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ZebraTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ZebraTests.cs new file mode 100644 index 000000000000..cd0d1c1c361c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ZebraTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing Zebra + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZebraTests : IDisposable + { + // TODO uncomment below to declare an instance variable for Zebra + //private Zebra instance; + + public ZebraTests() + { + // TODO uncomment below to create an instance of Zebra + //instance = new Zebra(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of Zebra + /// + [Fact] + public void ZebraInstanceTest() + { + // TODO uncomment below to test "IsType" Zebra + //Assert.IsType(instance); + } + + /// + /// Test the property 'ClassName' + /// + [Fact] + public void ClassNameTest() + { + // TODO unit test for the property 'ClassName' + } + + /// + /// Test the property 'Type' + /// + [Fact] + public void TypeTest() + { + // TODO unit test for the property 'Type' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs new file mode 100644 index 000000000000..b432edb28c23 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnumClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnumClass + //private ZeroBasedEnumClass instance; + + public ZeroBasedEnumClassTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnumClass + //instance = new ZeroBasedEnumClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnumClass + /// + [Fact] + public void ZeroBasedEnumClassInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnumClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'ZeroBasedEnum' + /// + [Fact] + public void ZeroBasedEnumTest() + { + // TODO unit test for the property 'ZeroBasedEnum' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs new file mode 100644 index 000000000000..3689a873c342 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs @@ -0,0 +1,56 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing ZeroBasedEnum + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class ZeroBasedEnumTests : IDisposable + { + // TODO uncomment below to declare an instance variable for ZeroBasedEnum + //private ZeroBasedEnum instance; + + public ZeroBasedEnumTests() + { + // TODO uncomment below to create an instance of ZeroBasedEnum + //instance = new ZeroBasedEnum(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of ZeroBasedEnum + /// + [Fact] + public void ZeroBasedEnumInstanceTest() + { + // TODO uncomment below to test "IsType" ZeroBasedEnum + //Assert.IsType(instance); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..a4e283f2d333 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net9.0 + false + enable + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs new file mode 100644 index 000000000000..a34c828167b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -0,0 +1,405 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IAnotherFakeApi : IApi + { + /// + /// The class containing the events + /// + AnotherFakeApiEvents Events { get; } + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// client model + /// Cancellation Token to cancel the request. + /// <?> + Task Call123TestSpecialTagsOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ICall123TestSpecialTagsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class AnotherFakeApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnCall123TestSpecialTags; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorCall123TestSpecialTags; + + internal void ExecuteOnCall123TestSpecialTags(AnotherFakeApi.Call123TestSpecialTagsApiResponse apiResponse) + { + OnCall123TestSpecialTags?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCall123TestSpecialTags(Exception exception) + { + OnErrorCall123TestSpecialTags?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class AnotherFakeApi : IAnotherFakeApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public AnotherFakeApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, AnotherFakeApiEvents anotherFakeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = anotherFakeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatCall123TestSpecialTags(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCall123TestSpecialTags(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCall123TestSpecialTagsDefaultImplementation(ICall123TestSpecialTagsApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterCall123TestSpecialTags(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCall123TestSpecialTags(ref bool suppressDefaultLog, ICall123TestSpecialTagsApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCall123TestSpecialTagsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCall123TestSpecialTags(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCall123TestSpecialTags(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task Call123TestSpecialTagsOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await Call123TestSpecialTagsAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task Call123TestSpecialTagsAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCall123TestSpecialTags(modelClient); + + FormatCall123TestSpecialTags(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/another-fake/dummy"; + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + Call123TestSpecialTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/another-fake/dummy", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCall123TestSpecialTagsDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnCall123TestSpecialTags(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCall123TestSpecialTagsDefaultImplementation(e, "/another-fake/dummy", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorCall123TestSpecialTags(e); + throw; + } + } + + /// + /// The + /// + public partial class Call123TestSpecialTagsApiResponse : Org.OpenAPITools.Client.ApiResponse, ICall123TestSpecialTagsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public Call123TestSpecialTagsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..cced9ce3479a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,1358 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IDefaultApi : IApi + { + /// + /// The class containing the events + /// + DefaultApiEvents Events { get; } + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task FooGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + Task GetCountryAsync(string country, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetCountryOrDefaultAsync(string country, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task HelloAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Cancellation Token to cancel the request. + /// <?> + Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task RolesReportGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task TestAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task TestOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IFooGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IDefault + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IGetCountryApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IHelloApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IRolesReportGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class DefaultApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnFooGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFooGet; + + internal void ExecuteOnFooGet(DefaultApi.FooGetApiResponse apiResponse) + { + OnFooGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFooGet(Exception exception) + { + OnErrorFooGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetCountry; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetCountry; + + internal void ExecuteOnGetCountry(DefaultApi.GetCountryApiResponse apiResponse) + { + OnGetCountry?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetCountry(Exception exception) + { + OnErrorGetCountry?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnHello; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorHello; + + internal void ExecuteOnHello(DefaultApi.HelloApiResponse apiResponse) + { + OnHello?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorHello(Exception exception) + { + OnErrorHello?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnRolesReportGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorRolesReportGet; + + internal void ExecuteOnRolesReportGet(DefaultApi.RolesReportGetApiResponse apiResponse) + { + OnRolesReportGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorRolesReportGet(Exception exception) + { + OnErrorRolesReportGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTest; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTest; + + internal void ExecuteOnTest(DefaultApi.TestApiResponse apiResponse) + { + OnTest?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTest(Exception exception) + { + OnErrorTest?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class DefaultApi : IDefaultApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public DefaultApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = defaultApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + /// + /// Processes the server response + /// + /// + private void AfterFooGetDefaultImplementation(IFooGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterFooGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterFooGet(ref bool suppressDefaultLog, IFooGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorFooGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFooGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorFooGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task FooGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FooGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task FooGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/foo"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FooGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/foo", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFooGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnFooGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFooGetDefaultImplementation(e, "/foo", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorFooGet(e); + throw; + } + } + + /// + /// The + /// + public partial class FooGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IFooGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FooGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + /// + /// Deserializes the response if the response is 0 Default + /// + /// + public Org.OpenAPITools.Model.FooGetDefaultResponse? Default() + { + // This logic may be modified with the AsModel.mustache template + return IsDefault + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 0 Default and the deserialized response is not null + /// + /// + /// + public bool TryDefault([NotNullWhen(true)]out Org.OpenAPITools.Model.FooGetDefaultResponse? result) + { + result = null; + + try + { + result = Default(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)0); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetCountry(ref string country); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateGetCountry(string country) + { + if (country == null) + throw new ArgumentNullException(nameof(country)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetCountryDefaultImplementation(IGetCountryApiResponse apiResponseLocalVar, string country) + { + bool suppressDefaultLog = false; + AfterGetCountry(ref suppressDefaultLog, apiResponseLocalVar, country); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetCountry(ref bool suppressDefaultLog, IGetCountryApiResponse apiResponseLocalVar, string country); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetCountryDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string country) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetCountry(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, country); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetCountry(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string country); + + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetCountryOrDefaultAsync(string country, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetCountryAsync(country, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetCountryAsync(string country, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateGetCountry(country); + + FormatGetCountry(ref country); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/country"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("country", ClientUtils.ParameterToString(country))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetCountryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/country", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetCountryDefaultImplementation(apiResponseLocalVar, country); + + Events.ExecuteOnGetCountry(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetCountryDefaultImplementation(e, "/country", uriBuilderLocalVar.Path, country); + Events.ExecuteOnErrorGetCountry(e); + throw; + } + } + + /// + /// The + /// + public partial class GetCountryApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetCountryApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetCountryApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterHelloDefaultImplementation(IHelloApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterHello(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterHello(ref bool suppressDefaultLog, IHelloApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorHelloDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorHello(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorHello(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Hello Hello + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task HelloOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await HelloAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task HelloAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/hello"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + HelloApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/hello", requestedAtLocalVar, _jsonSerializerOptions); + + AfterHelloDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnHello(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorHelloDefaultImplementation(e, "/hello", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorHello(e); + throw; + } + } + + /// + /// The + /// + public partial class HelloApiResponse : Org.OpenAPITools.Client.ApiResponse, IHelloApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public HelloApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterRolesReportGetDefaultImplementation(IRolesReportGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterRolesReportGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterRolesReportGet(ref bool suppressDefaultLog, IRolesReportGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorRolesReportGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorRolesReportGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorRolesReportGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task RolesReportGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await RolesReportGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task RolesReportGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/roles/report"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + RolesReportGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/roles/report", requestedAtLocalVar, _jsonSerializerOptions); + + AfterRolesReportGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnRolesReportGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorRolesReportGetDefaultImplementation(e, "/roles/report", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorRolesReportGet(e); + throw; + } + } + + /// + /// The + /// + public partial class RolesReportGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IRolesReportGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public RolesReportGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterTestDefaultImplementation(ITestApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterTest(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterTest(ref bool suppressDefaultLog, ITestApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorTestDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTest(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorTest(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/test"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/test", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnTest(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestDefaultImplementation(e, "/test", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorTest(e); + throw; + } + } + + /// + /// The + /// + public partial class TestApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NotificationtestGetElementsV1ResponseMPayload? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs new file mode 100644 index 000000000000..39b422f6f7f7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/FakeApi.cs @@ -0,0 +1,5690 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IFakeApi : IApi + { + /// + /// The class containing the events + /// + FakeApiEvents Events { get; } + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task FakeHealthGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task FakeHealthGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetArrayOfEnumsAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task TestBodyWithFileSchemaOrDefaultAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestBodyWithQueryParamsAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task TestBodyWithQueryParamsOrDefaultAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// client model + /// Cancellation Token to cancel the request. + /// <?> + Task TestClientModelOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEndpointParametersAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task TestEndpointParametersOrDefaultAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestEnumParametersAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task TestEnumParametersOrDefaultAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + Task TestGroupParametersAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestInlineAdditionalPropertiesOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestInlineFreeformAdditionalPropertiesOrDefaultAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + Task TestJsonFormDataAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <?> + Task TestJsonFormDataOrDefaultAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + Task TestQueryParameterCollectionFormatAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string? requiredNullable = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <?> + Task TestQueryParameterCollectionFormatOrDefaultAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string? requiredNullable = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + Task TestStringMapReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + + /// + /// test referenced string map + /// + /// + /// + /// + /// request body + /// Cancellation Token to cancel the request. + /// <?> + Task TestStringMapReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IFakeHealthGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterBooleanSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterCompositeSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterNumberSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IFakeOuterStringSerializeApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetArrayOfEnumsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetMixedAnyOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetMixedOneOfApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestBodyWithFileSchemaApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestBodyWithQueryParamsApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestClientModelApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestEndpointParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface ITestEnumParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface ITestGroupParametersApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface ITestInlineAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestInlineFreeformAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestJsonFormDataApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestQueryParameterCollectionFormatApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface ITestStringMapReferenceApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeHealthGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeHealthGet; + + internal void ExecuteOnFakeHealthGet(FakeApi.FakeHealthGetApiResponse apiResponse) + { + OnFakeHealthGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeHealthGet(Exception exception) + { + OnErrorFakeHealthGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeOuterBooleanSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeOuterBooleanSerialize; + + internal void ExecuteOnFakeOuterBooleanSerialize(FakeApi.FakeOuterBooleanSerializeApiResponse apiResponse) + { + OnFakeOuterBooleanSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterBooleanSerialize(Exception exception) + { + OnErrorFakeOuterBooleanSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeOuterCompositeSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeOuterCompositeSerialize; + + internal void ExecuteOnFakeOuterCompositeSerialize(FakeApi.FakeOuterCompositeSerializeApiResponse apiResponse) + { + OnFakeOuterCompositeSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterCompositeSerialize(Exception exception) + { + OnErrorFakeOuterCompositeSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeOuterNumberSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeOuterNumberSerialize; + + internal void ExecuteOnFakeOuterNumberSerialize(FakeApi.FakeOuterNumberSerializeApiResponse apiResponse) + { + OnFakeOuterNumberSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterNumberSerialize(Exception exception) + { + OnErrorFakeOuterNumberSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFakeOuterStringSerialize; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFakeOuterStringSerialize; + + internal void ExecuteOnFakeOuterStringSerialize(FakeApi.FakeOuterStringSerializeApiResponse apiResponse) + { + OnFakeOuterStringSerialize?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFakeOuterStringSerialize(Exception exception) + { + OnErrorFakeOuterStringSerialize?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetArrayOfEnums; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetArrayOfEnums; + + internal void ExecuteOnGetArrayOfEnums(FakeApi.GetArrayOfEnumsApiResponse apiResponse) + { + OnGetArrayOfEnums?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetArrayOfEnums(Exception exception) + { + OnErrorGetArrayOfEnums?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetMixedAnyOf; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetMixedAnyOf; + + internal void ExecuteOnGetMixedAnyOf(FakeApi.GetMixedAnyOfApiResponse apiResponse) + { + OnGetMixedAnyOf?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetMixedAnyOf(Exception exception) + { + OnErrorGetMixedAnyOf?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetMixedOneOf; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetMixedOneOf; + + internal void ExecuteOnGetMixedOneOf(FakeApi.GetMixedOneOfApiResponse apiResponse) + { + OnGetMixedOneOf?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetMixedOneOf(Exception exception) + { + OnErrorGetMixedOneOf?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestAdditionalPropertiesReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestAdditionalPropertiesReference; + + internal void ExecuteOnTestAdditionalPropertiesReference(FakeApi.TestAdditionalPropertiesReferenceApiResponse apiResponse) + { + OnTestAdditionalPropertiesReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestAdditionalPropertiesReference(Exception exception) + { + OnErrorTestAdditionalPropertiesReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestBodyWithFileSchema; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestBodyWithFileSchema; + + internal void ExecuteOnTestBodyWithFileSchema(FakeApi.TestBodyWithFileSchemaApiResponse apiResponse) + { + OnTestBodyWithFileSchema?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestBodyWithFileSchema(Exception exception) + { + OnErrorTestBodyWithFileSchema?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestBodyWithQueryParams; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestBodyWithQueryParams; + + internal void ExecuteOnTestBodyWithQueryParams(FakeApi.TestBodyWithQueryParamsApiResponse apiResponse) + { + OnTestBodyWithQueryParams?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestBodyWithQueryParams(Exception exception) + { + OnErrorTestBodyWithQueryParams?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestClientModel; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestClientModel; + + internal void ExecuteOnTestClientModel(FakeApi.TestClientModelApiResponse apiResponse) + { + OnTestClientModel?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestClientModel(Exception exception) + { + OnErrorTestClientModel?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestEndpointParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestEndpointParameters; + + internal void ExecuteOnTestEndpointParameters(FakeApi.TestEndpointParametersApiResponse apiResponse) + { + OnTestEndpointParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestEndpointParameters(Exception exception) + { + OnErrorTestEndpointParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestEnumParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestEnumParameters; + + internal void ExecuteOnTestEnumParameters(FakeApi.TestEnumParametersApiResponse apiResponse) + { + OnTestEnumParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestEnumParameters(Exception exception) + { + OnErrorTestEnumParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestGroupParameters; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestGroupParameters; + + internal void ExecuteOnTestGroupParameters(FakeApi.TestGroupParametersApiResponse apiResponse) + { + OnTestGroupParameters?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestGroupParameters(Exception exception) + { + OnErrorTestGroupParameters?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestInlineAdditionalProperties; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestInlineAdditionalProperties; + + internal void ExecuteOnTestInlineAdditionalProperties(FakeApi.TestInlineAdditionalPropertiesApiResponse apiResponse) + { + OnTestInlineAdditionalProperties?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestInlineAdditionalProperties(Exception exception) + { + OnErrorTestInlineAdditionalProperties?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestInlineFreeformAdditionalProperties; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestInlineFreeformAdditionalProperties; + + internal void ExecuteOnTestInlineFreeformAdditionalProperties(FakeApi.TestInlineFreeformAdditionalPropertiesApiResponse apiResponse) + { + OnTestInlineFreeformAdditionalProperties?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestInlineFreeformAdditionalProperties(Exception exception) + { + OnErrorTestInlineFreeformAdditionalProperties?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestJsonFormData; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestJsonFormData; + + internal void ExecuteOnTestJsonFormData(FakeApi.TestJsonFormDataApiResponse apiResponse) + { + OnTestJsonFormData?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestJsonFormData(Exception exception) + { + OnErrorTestJsonFormData?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestQueryParameterCollectionFormat; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestQueryParameterCollectionFormat; + + internal void ExecuteOnTestQueryParameterCollectionFormat(FakeApi.TestQueryParameterCollectionFormatApiResponse apiResponse) + { + OnTestQueryParameterCollectionFormat?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestQueryParameterCollectionFormat(Exception exception) + { + OnErrorTestQueryParameterCollectionFormat?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestStringMapReference; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestStringMapReference; + + internal void ExecuteOnTestStringMapReference(FakeApi.TestStringMapReferenceApiResponse apiResponse) + { + OnTestStringMapReference?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestStringMapReference(Exception exception) + { + OnErrorTestStringMapReference?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class FakeApi : IFakeApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public FakeApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, FakeApiEvents fakeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = fakeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + /// + /// Processes the server response + /// + /// + private void AfterFakeHealthGetDefaultImplementation(IFakeHealthGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterFakeHealthGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterFakeHealthGet(ref bool suppressDefaultLog, IFakeHealthGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorFakeHealthGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeHealthGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorFakeHealthGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Health check endpoint + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeHealthGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeHealthGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeHealthGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/health"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeHealthGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/health", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeHealthGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnFakeHealthGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeHealthGetDefaultImplementation(e, "/fake/health", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorFakeHealthGet(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeHealthGetApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeHealthGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeHealthGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.HealthCheckResult? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.HealthCheckResult? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterBooleanSerialize(ref Option body); + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterBooleanSerializeDefaultImplementation(IFakeOuterBooleanSerializeApiResponse apiResponseLocalVar, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterBooleanSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterBooleanSerialize(ref bool suppressDefaultLog, IFakeOuterBooleanSerializeApiResponse apiResponseLocalVar, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterBooleanSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterBooleanSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterBooleanSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body); + + /// + /// Test serialization of outer boolean types + /// + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterBooleanSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterBooleanSerializeAsync(body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterBooleanSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatFakeOuterBooleanSerialize(ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/boolean"; + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterBooleanSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/boolean", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterBooleanSerializeDefaultImplementation(apiResponseLocalVar, body); + + Events.ExecuteOnFakeOuterBooleanSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterBooleanSerializeDefaultImplementation(e, "/fake/outer/boolean", uriBuilderLocalVar.Path, body); + Events.ExecuteOnErrorFakeOuterBooleanSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterBooleanSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterBooleanSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterBooleanSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public bool? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out bool? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterCompositeSerialize(Option outerComposite); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterCompositeSerialize(Option outerComposite) + { + if (outerComposite.IsSet && outerComposite.Value == null) + throw new ArgumentNullException(nameof(outerComposite)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterCompositeSerializeDefaultImplementation(IFakeOuterCompositeSerializeApiResponse apiResponseLocalVar, Option outerComposite) + { + bool suppressDefaultLog = false; + AfterFakeOuterCompositeSerialize(ref suppressDefaultLog, apiResponseLocalVar, outerComposite); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterCompositeSerialize(ref bool suppressDefaultLog, IFakeOuterCompositeSerializeApiResponse apiResponseLocalVar, Option outerComposite); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterCompositeSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option outerComposite) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterCompositeSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, outerComposite); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterCompositeSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option outerComposite); + + /// + /// Test serialization of object with outer number type + /// + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterCompositeSerializeOrDefaultAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterCompositeSerializeAsync(outerComposite, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterCompositeSerializeAsync(Option outerComposite = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFakeOuterCompositeSerialize(outerComposite); + + FormatFakeOuterCompositeSerialize(outerComposite); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/composite"; + + if (outerComposite.IsSet) + httpRequestMessageLocalVar.Content = (outerComposite.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(outerComposite.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterCompositeSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/composite", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterCompositeSerializeDefaultImplementation(apiResponseLocalVar, outerComposite); + + Events.ExecuteOnFakeOuterCompositeSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterCompositeSerializeDefaultImplementation(e, "/fake/outer/composite", uriBuilderLocalVar.Path, outerComposite); + Events.ExecuteOnErrorFakeOuterCompositeSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterCompositeSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterCompositeSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterCompositeSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.OuterComposite? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.OuterComposite? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterNumberSerialize(ref Option body); + + /// + /// Processes the server response + /// + /// + /// + private void AfterFakeOuterNumberSerializeDefaultImplementation(IFakeOuterNumberSerializeApiResponse apiResponseLocalVar, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterNumberSerialize(ref suppressDefaultLog, apiResponseLocalVar, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFakeOuterNumberSerialize(ref bool suppressDefaultLog, IFakeOuterNumberSerializeApiResponse apiResponseLocalVar, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFakeOuterNumberSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterNumberSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterNumberSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option body); + + /// + /// Test serialization of outer number types + /// + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterNumberSerializeOrDefaultAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterNumberSerializeAsync(body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterNumberSerializeAsync(Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatFakeOuterNumberSerialize(ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/number"; + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterNumberSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/number", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterNumberSerializeDefaultImplementation(apiResponseLocalVar, body); + + Events.ExecuteOnFakeOuterNumberSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterNumberSerializeDefaultImplementation(e, "/fake/outer/number", uriBuilderLocalVar.Path, body); + Events.ExecuteOnErrorFakeOuterNumberSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterNumberSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterNumberSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterNumberSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public decimal? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out decimal? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFakeOuterStringSerialize(ref Guid requiredStringUuid, ref Option body); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFakeOuterStringSerialize(Option body) + { + if (body.IsSet && body.Value == null) + throw new ArgumentNullException(nameof(body)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterFakeOuterStringSerializeDefaultImplementation(IFakeOuterStringSerializeApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body) + { + bool suppressDefaultLog = false; + AfterFakeOuterStringSerialize(ref suppressDefaultLog, apiResponseLocalVar, requiredStringUuid, body); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterFakeOuterStringSerialize(ref bool suppressDefaultLog, IFakeOuterStringSerializeApiResponse apiResponseLocalVar, Guid requiredStringUuid, Option body); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorFakeOuterStringSerializeDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Guid requiredStringUuid, Option body) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFakeOuterStringSerialize(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requiredStringUuid, body); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorFakeOuterStringSerialize(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Guid requiredStringUuid, Option body); + + /// + /// Test serialization of outer string types + /// + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterStringSerializeOrDefaultAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FakeOuterStringSerializeAsync(requiredStringUuid, body, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, Option body = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFakeOuterStringSerialize(body); + + FormatFakeOuterStringSerialize(ref requiredStringUuid, ref body); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/outer/string"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["required_string_uuid"] = ClientUtils.ParameterToString(requiredStringUuid); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + if (body.IsSet) + httpRequestMessageLocalVar.Content = (body.Value as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(body.Value, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "*/*" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FakeOuterStringSerializeApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/outer/string", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFakeOuterStringSerializeDefaultImplementation(apiResponseLocalVar, requiredStringUuid, body); + + Events.ExecuteOnFakeOuterStringSerialize(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFakeOuterStringSerializeDefaultImplementation(e, "/fake/outer/string", uriBuilderLocalVar.Path, requiredStringUuid, body); + Events.ExecuteOnErrorFakeOuterStringSerialize(e); + throw; + } + } + + /// + /// The + /// + public partial class FakeOuterStringSerializeApiResponse : Org.OpenAPITools.Client.ApiResponse, IFakeOuterStringSerializeApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FakeOuterStringSerializeApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public string? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out string? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetArrayOfEnumsDefaultImplementation(IGetArrayOfEnumsApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetArrayOfEnums(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetArrayOfEnums(ref bool suppressDefaultLog, IGetArrayOfEnumsApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetArrayOfEnumsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetArrayOfEnums(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetArrayOfEnums(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Array of Enums + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetArrayOfEnumsOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetArrayOfEnumsAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetArrayOfEnumsAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/array-of-enums"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetArrayOfEnumsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/array-of-enums", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetArrayOfEnumsDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetArrayOfEnums(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetArrayOfEnumsDefaultImplementation(e, "/fake/array-of-enums", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetArrayOfEnums(e); + throw; + } + } + + /// + /// The + /// + public partial class GetArrayOfEnumsApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetArrayOfEnumsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetArrayOfEnumsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetMixedAnyOfDefaultImplementation(IGetMixedAnyOfApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetMixedAnyOf(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetMixedAnyOf(ref bool suppressDefaultLog, IGetMixedAnyOfApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetMixedAnyOfDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetMixedAnyOf(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetMixedAnyOf(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Test mixed type anyOf deserialization + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedAnyOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetMixedAnyOfAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedAnyOfAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/anyOf"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetMixedAnyOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/anyOf", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetMixedAnyOfDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetMixedAnyOf(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetMixedAnyOfDefaultImplementation(e, "/fake/mixed/anyOf", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetMixedAnyOf(e); + throw; + } + } + + /// + /// The + /// + public partial class GetMixedAnyOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedAnyOfApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetMixedAnyOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.MixedAnyOf? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedAnyOf? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetMixedOneOfDefaultImplementation(IGetMixedOneOfApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetMixedOneOf(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetMixedOneOf(ref bool suppressDefaultLog, IGetMixedOneOfApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetMixedOneOfDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetMixedOneOf(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetMixedOneOf(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Test mixed type oneOf deserialization + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedOneOfOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetMixedOneOfAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetMixedOneOfAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/mixed/oneOf"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetMixedOneOfApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/mixed/oneOf", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetMixedOneOfDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetMixedOneOf(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetMixedOneOfDefaultImplementation(e, "/fake/mixed/oneOf", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetMixedOneOf(e); + throw; + } + } + + /// + /// The + /// + public partial class GetMixedOneOfApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetMixedOneOfApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetMixedOneOfApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.MixedOneOf? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.MixedOneOf? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestAdditionalPropertiesReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestAdditionalPropertiesReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestAdditionalPropertiesReferenceDefaultImplementation(ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestAdditionalPropertiesReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestAdditionalPropertiesReference(ref bool suppressDefaultLog, ITestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestAdditionalPropertiesReference(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestAdditionalPropertiesReference(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test referenced additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestAdditionalPropertiesReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestAdditionalPropertiesReference(requestBody); + + FormatTestAdditionalPropertiesReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/additionalProperties-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestAdditionalPropertiesReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/additionalProperties-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestAdditionalPropertiesReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestAdditionalPropertiesReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestAdditionalPropertiesReferenceDefaultImplementation(e, "/fake/additionalProperties-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestAdditionalPropertiesReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestAdditionalPropertiesReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestAdditionalPropertiesReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestAdditionalPropertiesReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) + { + if (fileSchemaTestClass == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestBodyWithFileSchemaDefaultImplementation(ITestBodyWithFileSchemaApiResponse apiResponseLocalVar, FileSchemaTestClass fileSchemaTestClass) + { + bool suppressDefaultLog = false; + AfterTestBodyWithFileSchema(ref suppressDefaultLog, apiResponseLocalVar, fileSchemaTestClass); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestBodyWithFileSchema(ref bool suppressDefaultLog, ITestBodyWithFileSchemaApiResponse apiResponseLocalVar, FileSchemaTestClass fileSchemaTestClass); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestBodyWithFileSchemaDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, FileSchemaTestClass fileSchemaTestClass) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestBodyWithFileSchema(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, fileSchemaTestClass); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestBodyWithFileSchema(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, FileSchemaTestClass fileSchemaTestClass); + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithFileSchemaOrDefaultAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestBodyWithFileSchemaAsync(fileSchemaTestClass, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestBodyWithFileSchema(fileSchemaTestClass); + + FormatTestBodyWithFileSchema(fileSchemaTestClass); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/body-with-file-schema"; + + httpRequestMessageLocalVar.Content = (fileSchemaTestClass as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(fileSchemaTestClass, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestBodyWithFileSchemaApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-file-schema", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestBodyWithFileSchemaDefaultImplementation(apiResponseLocalVar, fileSchemaTestClass); + + Events.ExecuteOnTestBodyWithFileSchema(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestBodyWithFileSchemaDefaultImplementation(e, "/fake/body-with-file-schema", uriBuilderLocalVar.Path, fileSchemaTestClass); + Events.ExecuteOnErrorTestBodyWithFileSchema(e); + throw; + } + } + + /// + /// The + /// + public partial class TestBodyWithFileSchemaApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestBodyWithFileSchemaApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestBodyWithFileSchemaApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestBodyWithQueryParams(ref string query, User user); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateTestBodyWithQueryParams(string query, User user) + { + if (query == null) + throw new ArgumentNullException(nameof(query)); + + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterTestBodyWithQueryParamsDefaultImplementation(ITestBodyWithQueryParamsApiResponse apiResponseLocalVar, string query, User user) + { + bool suppressDefaultLog = false; + AfterTestBodyWithQueryParams(ref suppressDefaultLog, apiResponseLocalVar, query, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterTestBodyWithQueryParams(ref bool suppressDefaultLog, ITestBodyWithQueryParamsApiResponse apiResponseLocalVar, string query, User user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorTestBodyWithQueryParamsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string query, User user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestBodyWithQueryParams(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, query, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestBodyWithQueryParams(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string query, User user); + + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithQueryParamsOrDefaultAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestBodyWithQueryParamsAsync(query, user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestBodyWithQueryParamsAsync(string query, User user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestBodyWithQueryParams(query, user); + + FormatTestBodyWithQueryParams(ref query, user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/body-with-query-params"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["query"] = ClientUtils.ParameterToString(query); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestBodyWithQueryParamsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/body-with-query-params", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestBodyWithQueryParamsDefaultImplementation(apiResponseLocalVar, query, user); + + Events.ExecuteOnTestBodyWithQueryParams(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestBodyWithQueryParamsDefaultImplementation(e, "/fake/body-with-query-params", uriBuilderLocalVar.Path, query, user); + Events.ExecuteOnErrorTestBodyWithQueryParams(e); + throw; + } + } + + /// + /// The + /// + public partial class TestBodyWithQueryParamsApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestBodyWithQueryParamsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestBodyWithQueryParamsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestClientModel(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestClientModel(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestClientModelDefaultImplementation(ITestClientModelApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterTestClientModel(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestClientModel(ref bool suppressDefaultLog, ITestClientModelApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestClientModelDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestClientModel(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestClientModel(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test \"client\" model To test \"client\" model + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClientModelOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestClientModelAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClientModelAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestClientModel(modelClient); + + FormatTestClientModel(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestClientModelApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestClientModelDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnTestClientModel(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestClientModelDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorTestClientModel(e); + throw; + } + } + + /// + /// The + /// + public partial class TestClientModelApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestClientModelApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestClientModelApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestEndpointParameters(ref decimal number, ref string patternWithoutDelimiter, ref byte[] varByte, ref double varDouble, ref Option binary, ref Option callback, ref Option date, ref Option dateTime, ref Option int32, ref Option int64, ref Option integer, ref Option password, ref Option varFloat, ref Option varString); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEndpointParameters(string patternWithoutDelimiter, byte[] varByte, Option binary, Option callback, Option password, Option varString) + { + if (patternWithoutDelimiter == null) + throw new ArgumentNullException(nameof(patternWithoutDelimiter)); + + if (varByte == null) + throw new ArgumentNullException(nameof(varByte)); + + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary)); + + if (callback.IsSet && callback.Value == null) + throw new ArgumentNullException(nameof(callback)); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password)); + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestEndpointParametersDefaultImplementation(ITestEndpointParametersApiResponse apiResponseLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString) + { + bool suppressDefaultLog = false; + AfterTestEndpointParameters(ref suppressDefaultLog, apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestEndpointParameters(ref bool suppressDefaultLog, ITestEndpointParametersApiResponse apiResponseLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestEndpointParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestEndpointParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestEndpointParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary, Option callback, Option date, Option dateTime, Option int32, Option int64, Option integer, Option password, Option varFloat, Option varString); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEndpointParametersOrDefaultAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestEndpointParametersAsync(number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEndpointParametersAsync(decimal number, string patternWithoutDelimiter, byte[] varByte, double varDouble, Option binary = default, Option callback = default, Option date = default, Option dateTime = default, Option int32 = default, Option int64 = default, Option integer = default, Option password = default, Option varFloat = default, Option varString = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestEndpointParameters(patternWithoutDelimiter, varByte, binary, callback, password, varString); + + FormatTestEndpointParameters(ref number, ref patternWithoutDelimiter, ref varByte, ref varDouble, ref binary, ref callback, ref date, ref dateTime, ref int32, ref int64, ref integer, ref password, ref varFloat, ref varString); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("number", ClientUtils.ParameterToString(number))); + + formParameterLocalVars.Add(new KeyValuePair("pattern_without_delimiter", ClientUtils.ParameterToString(patternWithoutDelimiter))); + + formParameterLocalVars.Add(new KeyValuePair("byte", ClientUtils.ParameterToString(varByte))); + + formParameterLocalVars.Add(new KeyValuePair("double", ClientUtils.ParameterToString(varDouble))); + + if (binary.IsSet) + multipartContentLocalVar.Add(new StreamContent(binary.Value)); + + if (callback.IsSet) + formParameterLocalVars.Add(new KeyValuePair("callback", ClientUtils.ParameterToString(callback.Value))); + + if (date.IsSet) + formParameterLocalVars.Add(new KeyValuePair("date", ClientUtils.ParameterToString(date.Value))); + + if (dateTime.IsSet) + formParameterLocalVars.Add(new KeyValuePair("dateTime", ClientUtils.ParameterToString(dateTime.Value))); + + if (int32.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int32", ClientUtils.ParameterToString(int32.Value))); + + if (int64.IsSet) + formParameterLocalVars.Add(new KeyValuePair("int64", ClientUtils.ParameterToString(int64.Value))); + + if (integer.IsSet) + formParameterLocalVars.Add(new KeyValuePair("integer", ClientUtils.ParameterToString(integer.Value))); + + if (password.IsSet) + formParameterLocalVars.Add(new KeyValuePair("password", ClientUtils.ParameterToString(password.Value))); + + if (varFloat.IsSet) + formParameterLocalVars.Add(new KeyValuePair("float", ClientUtils.ParameterToString(varFloat.Value))); + + if (varString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("string", ClientUtils.ParameterToString(varString.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BasicToken basicTokenLocalVar1 = (BasicToken) await BasicTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(basicTokenLocalVar1); + + basicTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestEndpointParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestEndpointParametersDefaultImplementation(apiResponseLocalVar, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + + Events.ExecuteOnTestEndpointParameters(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestEndpointParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, number, patternWithoutDelimiter, varByte, varDouble, binary, callback, date, dateTime, int32, int64, integer, password, varFloat, varString); + Events.ExecuteOnErrorTestEndpointParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestEndpointParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestEndpointParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestEndpointParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestEnumParameters(ref Option enumFormString, Option> enumFormStringArray, ref Option enumHeaderString, Option> enumHeaderStringArray, ref Option enumQueryDouble, ref Option enumQueryInteger, ref Option enumQueryString, Option> enumQueryStringArray); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestEnumParameters(Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryString, Option> enumQueryStringArray) + { + if (enumFormString.IsSet && enumFormString.Value == null) + throw new ArgumentNullException(nameof(enumFormString)); + + if (enumFormStringArray.IsSet && enumFormStringArray.Value == null) + throw new ArgumentNullException(nameof(enumFormStringArray)); + + if (enumHeaderString.IsSet && enumHeaderString.Value == null) + throw new ArgumentNullException(nameof(enumHeaderString)); + + if (enumHeaderStringArray.IsSet && enumHeaderStringArray.Value == null) + throw new ArgumentNullException(nameof(enumHeaderStringArray)); + + if (enumQueryString.IsSet && enumQueryString.Value == null) + throw new ArgumentNullException(nameof(enumQueryString)); + + if (enumQueryStringArray.IsSet && enumQueryStringArray.Value == null) + throw new ArgumentNullException(nameof(enumQueryStringArray)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestEnumParametersDefaultImplementation(ITestEnumParametersApiResponse apiResponseLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray) + { + bool suppressDefaultLog = false; + AfterTestEnumParameters(ref suppressDefaultLog, apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestEnumParameters(ref bool suppressDefaultLog, ITestEnumParametersApiResponse apiResponseLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestEnumParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestEnumParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestEnumParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Option enumFormString, Option> enumFormStringArray, Option enumHeaderString, Option> enumHeaderStringArray, Option enumQueryDouble, Option enumQueryInteger, Option enumQueryString, Option> enumQueryStringArray); + + /// + /// To test enum parameters To test enum parameters + /// + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEnumParametersOrDefaultAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestEnumParametersAsync(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Form parameter enum test (string) (optional, default to -efg) + /// Form parameter enum test (string array) (optional, default to $) + /// Header parameter enum test (string) (optional, default to -efg) + /// Header parameter enum test (string array) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestEnumParametersAsync(Option enumFormString = default, Option> enumFormStringArray = default, Option enumHeaderString = default, Option> enumHeaderStringArray = default, Option enumQueryDouble = default, Option enumQueryInteger = default, Option enumQueryString = default, Option> enumQueryStringArray = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestEnumParameters(enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryString, enumQueryStringArray); + + FormatTestEnumParameters(ref enumFormString, enumFormStringArray, ref enumHeaderString, enumHeaderStringArray, ref enumQueryDouble, ref enumQueryInteger, ref enumQueryString, enumQueryStringArray); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + if (enumQueryDouble.IsSet) + parseQueryStringLocalVar["enum_query_double"] = ClientUtils.ParameterToString(enumQueryDouble.Value); + + if (enumQueryInteger.IsSet) + parseQueryStringLocalVar["enum_query_integer"] = ClientUtils.ParameterToString(enumQueryInteger.Value); + + if (enumQueryString.IsSet) + parseQueryStringLocalVar["enum_query_string"] = ClientUtils.ParameterToString(enumQueryString.Value); + + if (enumQueryStringArray.IsSet) + parseQueryStringLocalVar["enum_query_string_array"] = ClientUtils.ParameterToString(enumQueryStringArray.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + if (enumHeaderString.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string", ClientUtils.ParameterToString(enumHeaderString.Value)); + + if (enumHeaderStringArray.IsSet) + httpRequestMessageLocalVar.Headers.Add("enum_header_string_array", ClientUtils.ParameterToString(enumHeaderStringArray.Value)); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (enumFormString.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string", ClientUtils.ParameterToString(enumFormString.Value))); + + if (enumFormStringArray.IsSet) + formParameterLocalVars.Add(new KeyValuePair("enum_form_string_array", ClientUtils.ParameterToString(enumFormStringArray.Value))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestEnumParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestEnumParametersDefaultImplementation(apiResponseLocalVar, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + + Events.ExecuteOnTestEnumParameters(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestEnumParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, enumFormString, enumFormStringArray, enumHeaderString, enumHeaderStringArray, enumQueryDouble, enumQueryInteger, enumQueryString, enumQueryStringArray); + Events.ExecuteOnErrorTestEnumParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestEnumParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestEnumParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestEnumParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestGroupParameters(ref bool requiredBooleanGroup, ref long requiredInt64Group, ref int requiredStringGroup, ref Option booleanGroup, ref Option int64Group, ref Option stringGroup); + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestGroupParametersDefaultImplementation(ITestGroupParametersApiResponse apiResponseLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup) + { + bool suppressDefaultLog = false; + AfterTestGroupParameters(ref suppressDefaultLog, apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestGroupParameters(ref bool suppressDefaultLog, ITestGroupParametersApiResponse apiResponseLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestGroupParametersDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestGroupParameters(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestGroupParameters(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup, Option int64Group, Option stringGroup); + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestGroupParametersOrDefaultAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestGroupParametersAsync(requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// Required String in group parameters + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// String in group parameters (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task TestGroupParametersAsync(bool requiredBooleanGroup, long requiredInt64Group, int requiredStringGroup, Option booleanGroup = default, Option int64Group = default, Option stringGroup = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatTestGroupParameters(ref requiredBooleanGroup, ref requiredInt64Group, ref requiredStringGroup, ref booleanGroup, ref int64Group, ref stringGroup); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["required_int64_group"] = ClientUtils.ParameterToString(requiredInt64Group); + parseQueryStringLocalVar["required_string_group"] = ClientUtils.ParameterToString(requiredStringGroup); + + if (int64Group.IsSet) + parseQueryStringLocalVar["int64_group"] = ClientUtils.ParameterToString(int64Group.Value); + + if (stringGroup.IsSet) + parseQueryStringLocalVar["string_group"] = ClientUtils.ParameterToString(stringGroup.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.Headers.Add("required_boolean_group", ClientUtils.ParameterToString(requiredBooleanGroup)); + + if (booleanGroup.IsSet) + httpRequestMessageLocalVar.Headers.Add("boolean_group", ClientUtils.ParameterToString(booleanGroup.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + BearerToken bearerTokenLocalVar1 = (BearerToken) await BearerTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(bearerTokenLocalVar1); + + bearerTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestGroupParametersApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestGroupParametersDefaultImplementation(apiResponseLocalVar, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + + Events.ExecuteOnTestGroupParameters(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestGroupParametersDefaultImplementation(e, "/fake", uriBuilderLocalVar.Path, requiredBooleanGroup, requiredInt64Group, requiredStringGroup, booleanGroup, int64Group, stringGroup); + Events.ExecuteOnErrorTestGroupParameters(e); + throw; + } + } + + /// + /// The + /// + public partial class TestGroupParametersApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestGroupParametersApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestGroupParametersApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestInlineAdditionalProperties(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestInlineAdditionalProperties(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestInlineAdditionalPropertiesDefaultImplementation(ITestInlineAdditionalPropertiesApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestInlineAdditionalProperties(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestInlineAdditionalProperties(ref bool suppressDefaultLog, ITestInlineAdditionalPropertiesApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestInlineAdditionalPropertiesDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestInlineAdditionalProperties(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestInlineAdditionalProperties(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test inline additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineAdditionalPropertiesOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestInlineAdditionalPropertiesAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestInlineAdditionalProperties(requestBody); + + FormatTestInlineAdditionalProperties(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/inline-additionalProperties"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestInlineAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestInlineAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestInlineAdditionalProperties(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestInlineAdditionalPropertiesDefaultImplementation(e, "/fake/inline-additionalProperties", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestInlineAdditionalProperties(e); + throw; + } + } + + /// + /// The + /// + public partial class TestInlineAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestInlineAdditionalPropertiesApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestInlineAdditionalPropertiesApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + if (testInlineFreeformAdditionalPropertiesRequest == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(ITestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + bool suppressDefaultLog = false; + AfterTestInlineFreeformAdditionalProperties(ref suppressDefaultLog, apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestInlineFreeformAdditionalProperties(ref bool suppressDefaultLog, ITestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestInlineFreeformAdditionalPropertiesDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestInlineFreeformAdditionalProperties(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, testInlineFreeformAdditionalPropertiesRequest); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestInlineFreeformAdditionalProperties(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest); + + /// + /// test inline free-form additionalProperties + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineFreeformAdditionalPropertiesOrDefaultAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + + FormatTestInlineFreeformAdditionalProperties(testInlineFreeformAdditionalPropertiesRequest); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/inline-freeform-additionalProperties"; + + httpRequestMessageLocalVar.Content = (testInlineFreeformAdditionalPropertiesRequest as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(testInlineFreeformAdditionalPropertiesRequest, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestInlineFreeformAdditionalPropertiesApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/inline-freeform-additionalProperties", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestInlineFreeformAdditionalPropertiesDefaultImplementation(apiResponseLocalVar, testInlineFreeformAdditionalPropertiesRequest); + + Events.ExecuteOnTestInlineFreeformAdditionalProperties(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestInlineFreeformAdditionalPropertiesDefaultImplementation(e, "/fake/inline-freeform-additionalProperties", uriBuilderLocalVar.Path, testInlineFreeformAdditionalPropertiesRequest); + Events.ExecuteOnErrorTestInlineFreeformAdditionalProperties(e); + throw; + } + } + + /// + /// The + /// + public partial class TestInlineFreeformAdditionalPropertiesApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestInlineFreeformAdditionalPropertiesApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestInlineFreeformAdditionalPropertiesApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestJsonFormData(ref string param, ref string param2); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateTestJsonFormData(string param, string param2) + { + if (param == null) + throw new ArgumentNullException(nameof(param)); + + if (param2 == null) + throw new ArgumentNullException(nameof(param2)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterTestJsonFormDataDefaultImplementation(ITestJsonFormDataApiResponse apiResponseLocalVar, string param, string param2) + { + bool suppressDefaultLog = false; + AfterTestJsonFormData(ref suppressDefaultLog, apiResponseLocalVar, param, param2); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterTestJsonFormData(ref bool suppressDefaultLog, ITestJsonFormDataApiResponse apiResponseLocalVar, string param, string param2); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorTestJsonFormDataDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string param, string param2) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestJsonFormData(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, param, param2); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestJsonFormData(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string param, string param2); + + /// + /// test json serialization of form data + /// + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + public async Task TestJsonFormDataOrDefaultAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestJsonFormDataAsync(param, param2, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Cancellation Token to cancel the request. + /// <> + public async Task TestJsonFormDataAsync(string param, string param2, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestJsonFormData(param, param2); + + FormatTestJsonFormData(ref param, ref param2); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/jsonFormData"; + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); + + formParameterLocalVars.Add(new KeyValuePair("param", ClientUtils.ParameterToString(param))); + + formParameterLocalVars.Add(new KeyValuePair("param2", ClientUtils.ParameterToString(param2))); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestJsonFormDataApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/jsonFormData", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestJsonFormDataDefaultImplementation(apiResponseLocalVar, param, param2); + + Events.ExecuteOnTestJsonFormData(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestJsonFormDataDefaultImplementation(e, "/fake/jsonFormData", uriBuilderLocalVar.Path, param, param2); + Events.ExecuteOnErrorTestJsonFormData(e); + throw; + } + } + + /// + /// The + /// + public partial class TestJsonFormDataApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestJsonFormDataApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestJsonFormDataApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestQueryParameterCollectionFormat(List context, List http, List ioutil, List pipe, ref string requiredNotNullable, List url, ref Option notRequiredNotNullable, ref Option notRequiredNullable, ref string? requiredNullable); + + /// + /// Validates the request parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void ValidateTestQueryParameterCollectionFormat(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable) + { + if (context == null) + throw new ArgumentNullException(nameof(context)); + + if (http == null) + throw new ArgumentNullException(nameof(http)); + + if (ioutil == null) + throw new ArgumentNullException(nameof(ioutil)); + + if (pipe == null) + throw new ArgumentNullException(nameof(pipe)); + + if (requiredNotNullable == null) + throw new ArgumentNullException(nameof(requiredNotNullable)); + + if (url == null) + throw new ArgumentNullException(nameof(url)); + + if (notRequiredNotNullable.IsSet && notRequiredNotNullable.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotNullable)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void AfterTestQueryParameterCollectionFormatDefaultImplementation(ITestQueryParameterCollectionFormatApiResponse apiResponseLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string? requiredNullable) + { + bool suppressDefaultLog = false; + AfterTestQueryParameterCollectionFormat(ref suppressDefaultLog, apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void AfterTestQueryParameterCollectionFormat(ref bool suppressDefaultLog, ITestQueryParameterCollectionFormatApiResponse apiResponseLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string? requiredNullable); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void OnErrorTestQueryParameterCollectionFormatDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string? requiredNullable) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestQueryParameterCollectionFormat(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorTestQueryParameterCollectionFormat(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable, Option notRequiredNullable, string? requiredNullable); + + /// + /// To test the collection format in query parameters + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestQueryParameterCollectionFormatOrDefaultAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string? requiredNullable = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestQueryParameterCollectionFormatAsync(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task TestQueryParameterCollectionFormatAsync(List context, List http, List ioutil, List pipe, string requiredNotNullable, List url, Option notRequiredNotNullable = default, Option notRequiredNullable = default, string? requiredNullable = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestQueryParameterCollectionFormat(context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable); + + FormatTestQueryParameterCollectionFormat(context, http, ioutil, pipe, ref requiredNotNullable, url, ref notRequiredNotNullable, ref notRequiredNullable, ref requiredNullable); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/test-query-parameters"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["context"] = ClientUtils.ParameterToString(context); + parseQueryStringLocalVar["http"] = ClientUtils.ParameterToString(http); + parseQueryStringLocalVar["ioutil"] = ClientUtils.ParameterToString(ioutil); + parseQueryStringLocalVar["pipe"] = ClientUtils.ParameterToString(pipe); + parseQueryStringLocalVar["requiredNotNullable"] = ClientUtils.ParameterToString(requiredNotNullable); + parseQueryStringLocalVar["url"] = ClientUtils.ParameterToString(url); + parseQueryStringLocalVar["requiredNullable"] = ClientUtils.ParameterToString(requiredNullable); + + if (notRequiredNotNullable.IsSet) + parseQueryStringLocalVar["notRequiredNotNullable"] = ClientUtils.ParameterToString(notRequiredNotNullable.Value); + + if (notRequiredNullable.IsSet) + parseQueryStringLocalVar["notRequiredNullable"] = ClientUtils.ParameterToString(notRequiredNullable.Value); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestQueryParameterCollectionFormatApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/test-query-parameters", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestQueryParameterCollectionFormatDefaultImplementation(apiResponseLocalVar, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + + Events.ExecuteOnTestQueryParameterCollectionFormat(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestQueryParameterCollectionFormatDefaultImplementation(e, "/fake/test-query-parameters", uriBuilderLocalVar.Path, context, http, ioutil, pipe, requiredNotNullable, url, notRequiredNotNullable, notRequiredNullable, requiredNullable); + Events.ExecuteOnErrorTestQueryParameterCollectionFormat(e); + throw; + } + } + + /// + /// The + /// + public partial class TestQueryParameterCollectionFormatApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestQueryParameterCollectionFormatApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestQueryParameterCollectionFormatApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatTestStringMapReference(Dictionary requestBody); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestStringMapReference(Dictionary requestBody) + { + if (requestBody == null) + throw new ArgumentNullException(nameof(requestBody)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestStringMapReferenceDefaultImplementation(ITestStringMapReferenceApiResponse apiResponseLocalVar, Dictionary requestBody) + { + bool suppressDefaultLog = false; + AfterTestStringMapReference(ref suppressDefaultLog, apiResponseLocalVar, requestBody); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestStringMapReference(ref bool suppressDefaultLog, ITestStringMapReferenceApiResponse apiResponseLocalVar, Dictionary requestBody); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestStringMapReferenceDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestStringMapReference(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, requestBody); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestStringMapReference(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Dictionary requestBody); + + /// + /// test referenced string map + /// + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestStringMapReferenceOrDefaultAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestStringMapReferenceAsync(requestBody, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Cancellation Token to cancel the request. + /// <> + public async Task TestStringMapReferenceAsync(Dictionary requestBody, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestStringMapReference(requestBody); + + FormatTestStringMapReference(requestBody); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/stringMap-reference"; + + httpRequestMessageLocalVar.Content = (requestBody as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(requestBody, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestStringMapReferenceApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/stringMap-reference", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestStringMapReferenceDefaultImplementation(apiResponseLocalVar, requestBody); + + Events.ExecuteOnTestStringMapReference(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestStringMapReferenceDefaultImplementation(e, "/fake/stringMap-reference", uriBuilderLocalVar.Path, requestBody); + Events.ExecuteOnErrorTestStringMapReference(e); + throw; + } + } + + /// + /// The + /// + public partial class TestStringMapReferenceApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestStringMapReferenceApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestStringMapReferenceApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs new file mode 100644 index 000000000000..d70af83c9115 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -0,0 +1,418 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IFakeClassnameTags123Api : IApi + { + /// + /// The class containing the events + /// + FakeClassnameTags123ApiEvents Events { get; } + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + Task TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// client model + /// Cancellation Token to cancel the request. + /// <?> + Task TestClassnameOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ITestClassnameApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class FakeClassnameTags123ApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnTestClassname; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorTestClassname; + + internal void ExecuteOnTestClassname(FakeClassnameTags123Api.TestClassnameApiResponse apiResponse) + { + OnTestClassname?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorTestClassname(Exception exception) + { + OnErrorTestClassname?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class FakeClassnameTags123Api : IFakeClassnameTags123Api + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public FakeClassnameTags123ApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, FakeClassnameTags123ApiEvents fakeClassnameTags123ApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = fakeClassnameTags123ApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatTestClassname(ModelClient modelClient); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateTestClassname(ModelClient modelClient) + { + if (modelClient == null) + throw new ArgumentNullException(nameof(modelClient)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterTestClassnameDefaultImplementation(ITestClassnameApiResponse apiResponseLocalVar, ModelClient modelClient) + { + bool suppressDefaultLog = false; + AfterTestClassname(ref suppressDefaultLog, apiResponseLocalVar, modelClient); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterTestClassname(ref bool suppressDefaultLog, ITestClassnameApiResponse apiResponseLocalVar, ModelClient modelClient); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorTestClassnameDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient) + { + bool suppressDefaultLogLocalVar = false; + OnErrorTestClassname(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, modelClient); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorTestClassname(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, ModelClient modelClient); + + /// + /// To test class name in snake case To test class name in snake case + /// + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClassnameOrDefaultAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await TestClassnameAsync(modelClient, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Cancellation Token to cancel the request. + /// <> + public async Task TestClassnameAsync(ModelClient modelClient, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateTestClassname(modelClient); + + FormatTestClassname(modelClient); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake_classname_test"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + httpRequestMessageLocalVar.Content = (modelClient as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(modelClient, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key_query", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + + apiKeyTokenLocalVar1.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Patch; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + TestClassnameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake_classname_test", requestedAtLocalVar, _jsonSerializerOptions); + + AfterTestClassnameDefaultImplementation(apiResponseLocalVar, modelClient); + + Events.ExecuteOnTestClassname(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorTestClassnameDefaultImplementation(e, "/fake_classname_test", uriBuilderLocalVar.Path, modelClient); + Events.ExecuteOnErrorTestClassname(e); + throw; + } + } + + /// + /// The + /// + public partial class TestClassnameApiResponse : Org.OpenAPITools.Client.ApiResponse, ITestClassnameApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public TestClassnameApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ModelClient? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ModelClient? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs new file mode 100644 index 000000000000..1d959b49106f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs @@ -0,0 +1,2830 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IPetApi : IApi + { + /// + /// The class containing the events + /// + PetApiEvents Events { get; } + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <?> + Task AddPetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + Task DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Cancellation Token to cancel the request. + /// <> + Task FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter (deprecated) + /// Cancellation Token to cancel the request. + /// <?> + Task FindPetsByStatusOrDefaultAsync(List status, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + [Obsolete] + Task FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <?> + [Obsolete] + Task FindPetsByTagsOrDefaultAsync(List tags, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <?> + Task GetPetByIdOrDefaultAsync(long petId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <?> + Task UpdatePetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image + /// + /// + /// + /// + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task UploadFileOrDefaultAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <?> + Task UploadFileWithRequiredFileOrDefaultAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IAddPetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IDeletePetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface IFindPetsByStatusApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + bool IsHttpStatusCode2XX { get; } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + bool IsHttpStatusCode4XX { get; } + } + + /// + /// The + /// + public interface IFindPetsByTagsApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface IGetPetByIdApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IUpdatePetApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IUpdatePetWithFormApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + bool IsMethodNotAllowed { get; } + } + + /// + /// The + /// + public interface IUploadFileApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IUploadFileWithRequiredFileApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class PetApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnAddPet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorAddPet; + + internal void ExecuteOnAddPet(PetApi.AddPetApiResponse apiResponse) + { + OnAddPet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorAddPet(Exception exception) + { + OnErrorAddPet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnDeletePet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorDeletePet; + + internal void ExecuteOnDeletePet(PetApi.DeletePetApiResponse apiResponse) + { + OnDeletePet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeletePet(Exception exception) + { + OnErrorDeletePet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFindPetsByStatus; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFindPetsByStatus; + + internal void ExecuteOnFindPetsByStatus(PetApi.FindPetsByStatusApiResponse apiResponse) + { + OnFindPetsByStatus?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFindPetsByStatus(Exception exception) + { + OnErrorFindPetsByStatus?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnFindPetsByTags; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorFindPetsByTags; + + internal void ExecuteOnFindPetsByTags(PetApi.FindPetsByTagsApiResponse apiResponse) + { + OnFindPetsByTags?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorFindPetsByTags(Exception exception) + { + OnErrorFindPetsByTags?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetPetById; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetPetById; + + internal void ExecuteOnGetPetById(PetApi.GetPetByIdApiResponse apiResponse) + { + OnGetPetById?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetPetById(Exception exception) + { + OnErrorGetPetById?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUpdatePet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUpdatePet; + + internal void ExecuteOnUpdatePet(PetApi.UpdatePetApiResponse apiResponse) + { + OnUpdatePet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdatePet(Exception exception) + { + OnErrorUpdatePet?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUpdatePetWithForm; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUpdatePetWithForm; + + internal void ExecuteOnUpdatePetWithForm(PetApi.UpdatePetWithFormApiResponse apiResponse) + { + OnUpdatePetWithForm?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdatePetWithForm(Exception exception) + { + OnErrorUpdatePetWithForm?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUploadFile; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUploadFile; + + internal void ExecuteOnUploadFile(PetApi.UploadFileApiResponse apiResponse) + { + OnUploadFile?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUploadFile(Exception exception) + { + OnErrorUploadFile?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUploadFileWithRequiredFile; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUploadFileWithRequiredFile; + + internal void ExecuteOnUploadFileWithRequiredFile(PetApi.UploadFileWithRequiredFileApiResponse apiResponse) + { + OnUploadFileWithRequiredFile?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUploadFileWithRequiredFile(Exception exception) + { + OnErrorUploadFileWithRequiredFile?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class PetApi : IPetApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public PetApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, PetApiEvents petApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = petApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatAddPet(Pet pet); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateAddPet(Pet pet) + { + if (pet == null) + throw new ArgumentNullException(nameof(pet)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterAddPetDefaultImplementation(IAddPetApiResponse apiResponseLocalVar, Pet pet) + { + bool suppressDefaultLog = false; + AfterAddPet(ref suppressDefaultLog, apiResponseLocalVar, pet); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterAddPet(ref bool suppressDefaultLog, IAddPetApiResponse apiResponseLocalVar, Pet pet); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorAddPetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet) + { + bool suppressDefaultLogLocalVar = false; + OnErrorAddPet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, pet); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorAddPet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet); + + /// + /// Add a new pet to the store + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task AddPetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await AddPetAsync(pet, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task AddPetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateAddPet(pet); + + FormatAddPet(pet); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("http://petstore.swagger.io/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + + httpRequestMessageLocalVar.Content = (pet as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] contentTypes = new string[] { + "application/json", + "application/xml" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + AddPetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + + AfterAddPetDefaultImplementation(apiResponseLocalVar, pet); + + Events.ExecuteOnAddPet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorAddPetDefaultImplementation(e, "/pet", uriBuilderLocalVar.Path, pet); + Events.ExecuteOnErrorAddPet(e); + throw; + } + } + + /// + /// The + /// + public partial class AddPetApiResponse : Org.OpenAPITools.Client.ApiResponse, IAddPetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public AddPetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatDeletePet(ref long petId, ref Option apiKey); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeletePet(Option apiKey) + { + if (apiKey.IsSet && apiKey.Value == null) + throw new ArgumentNullException(nameof(apiKey)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterDeletePetDefaultImplementation(IDeletePetApiResponse apiResponseLocalVar, long petId, Option apiKey) + { + bool suppressDefaultLog = false; + AfterDeletePet(ref suppressDefaultLog, apiResponseLocalVar, petId, apiKey); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterDeletePet(ref bool suppressDefaultLog, IDeletePetApiResponse apiResponseLocalVar, long petId, Option apiKey); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorDeletePetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option apiKey) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeletePet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, apiKey); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorDeletePet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option apiKey); + + /// + /// Deletes a pet + /// + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task DeletePetOrDefaultAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeletePetAsync(petId, apiKey, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task DeletePetAsync(long petId, Option apiKey = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeletePet(apiKey); + + FormatDeletePet(ref petId, ref apiKey); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + if (apiKey.IsSet) + httpRequestMessageLocalVar.Headers.Add("api_key", ClientUtils.ParameterToString(apiKey.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeletePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeletePetDefaultImplementation(apiResponseLocalVar, petId, apiKey); + + Events.ExecuteOnDeletePet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeletePetDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId, apiKey); + Events.ExecuteOnErrorDeletePet(e); + throw; + } + } + + /// + /// The + /// + public partial class DeletePetApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeletePetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeletePetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFindPetsByStatus(List status); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFindPetsByStatus(List status) + { + if (status == null) + throw new ArgumentNullException(nameof(status)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFindPetsByStatusDefaultImplementation(IFindPetsByStatusApiResponse apiResponseLocalVar, List status) + { + bool suppressDefaultLog = false; + AfterFindPetsByStatus(ref suppressDefaultLog, apiResponseLocalVar, status); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFindPetsByStatus(ref bool suppressDefaultLog, IFindPetsByStatusApiResponse apiResponseLocalVar, List status); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFindPetsByStatusDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List status) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFindPetsByStatus(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, status); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFindPetsByStatus(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List status); + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByStatusOrDefaultAsync(List status, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FindPetsByStatusAsync(status, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByStatusAsync(List status, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFindPetsByStatus(status); + + FormatFindPetsByStatus(status); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/findByStatus"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["status"] = ClientUtils.ParameterToString(status); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FindPetsByStatusApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByStatus", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFindPetsByStatusDefaultImplementation(apiResponseLocalVar, status); + + Events.ExecuteOnFindPetsByStatus(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFindPetsByStatusDefaultImplementation(e, "/pet/findByStatus", uriBuilderLocalVar.Path, status); + Events.ExecuteOnErrorFindPetsByStatus(e); + throw; + } + } + + /// + /// The + /// + public partial class FindPetsByStatusApiResponse : Org.OpenAPITools.Client.ApiResponse, IFindPetsByStatusApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FindPetsByStatusApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 2XX HttpStatusCode2XX + /// + /// + public bool IsHttpStatusCode2XX + { + get + { + int statusCode = (int)StatusCode; + return 200 >= statusCode && 299 <= statusCode; + } + } + + /// + /// Returns true if the response is 4XX HttpStatusCode4XX + /// + /// + public bool IsHttpStatusCode4XX + { + get + { + int statusCode = (int)StatusCode; + return 400 >= statusCode && 499 <= statusCode; + } + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatFindPetsByTags(List tags); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateFindPetsByTags(List tags) + { + if (tags == null) + throw new ArgumentNullException(nameof(tags)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterFindPetsByTagsDefaultImplementation(IFindPetsByTagsApiResponse apiResponseLocalVar, List tags) + { + bool suppressDefaultLog = false; + AfterFindPetsByTags(ref suppressDefaultLog, apiResponseLocalVar, tags); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterFindPetsByTags(ref bool suppressDefaultLog, IFindPetsByTagsApiResponse apiResponseLocalVar, List tags); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorFindPetsByTagsDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List tags) + { + bool suppressDefaultLogLocalVar = false; + OnErrorFindPetsByTags(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, tags); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorFindPetsByTags(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List tags); + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByTagsOrDefaultAsync(List tags, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await FindPetsByTagsAsync(tags, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Cancellation Token to cancel the request. + /// <> + public async Task FindPetsByTagsAsync(List tags, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateFindPetsByTags(tags); + + FormatFindPetsByTags(tags); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/findByTags"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["tags"] = ClientUtils.ParameterToString(tags); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + FindPetsByTagsApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/findByTags", requestedAtLocalVar, _jsonSerializerOptions); + + AfterFindPetsByTagsDefaultImplementation(apiResponseLocalVar, tags); + + Events.ExecuteOnFindPetsByTags(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorFindPetsByTagsDefaultImplementation(e, "/pet/findByTags", uriBuilderLocalVar.Path, tags); + Events.ExecuteOnErrorFindPetsByTags(e); + throw; + } + } + + /// + /// The + /// + public partial class FindPetsByTagsApiResponse : Org.OpenAPITools.Client.ApiResponse, IFindPetsByTagsApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public FindPetsByTagsApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public List? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out List? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetPetById(ref long petId); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetPetByIdDefaultImplementation(IGetPetByIdApiResponse apiResponseLocalVar, long petId) + { + bool suppressDefaultLog = false; + AfterGetPetById(ref suppressDefaultLog, apiResponseLocalVar, petId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetPetById(ref bool suppressDefaultLog, IGetPetByIdApiResponse apiResponseLocalVar, long petId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetPetByIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetPetById(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetPetById(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId); + + /// + /// Find pet by ID Returns a single pet + /// + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + public async Task GetPetByIdOrDefaultAsync(long petId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetPetByIdAsync(petId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Cancellation Token to cancel the request. + /// <> + public async Task GetPetByIdAsync(long petId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetPetById(ref petId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar); + + ApiKeyToken apiKeyTokenLocalVar2 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api_key_query", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar2); + + apiKeyTokenLocalVar2.UseInQuery(httpRequestMessageLocalVar, uriBuilderLocalVar, parseQueryStringLocalVar); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetPetByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetPetByIdDefaultImplementation(apiResponseLocalVar, petId); + + Events.ExecuteOnGetPetById(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetPetByIdDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId); + Events.ExecuteOnErrorGetPetById(e); + throw; + } + } + + /// + /// The + /// + public partial class GetPetByIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetPetByIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetPetByIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Pet? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Pet? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdatePet(Pet pet); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateUpdatePet(Pet pet) + { + if (pet == null) + throw new ArgumentNullException(nameof(pet)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterUpdatePetDefaultImplementation(IUpdatePetApiResponse apiResponseLocalVar, Pet pet) + { + bool suppressDefaultLog = false; + AfterUpdatePet(ref suppressDefaultLog, apiResponseLocalVar, pet); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterUpdatePet(ref bool suppressDefaultLog, IUpdatePetApiResponse apiResponseLocalVar, Pet pet); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorUpdatePetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdatePet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, pet); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdatePet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Pet pet); + + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetOrDefaultAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdatePetAsync(pet, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetAsync(Pet pet, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdatePet(pet); + + FormatUpdatePet(pet); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + Uri urlLocalVar = httpRequestMessageLocalVar.RequestUri = new Uri("http://petstore.swagger.io/v2"); + uriBuilderLocalVar.Host = urlLocalVar.Authority; + uriBuilderLocalVar.Scheme = urlLocalVar.Scheme; + uriBuilderLocalVar.Path = urlLocalVar.AbsolutePath; + + httpRequestMessageLocalVar.Content = (pet as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(pet, _jsonSerializerOptions)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + + if (httpRequestMessageLocalVar.Content != null) { + string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + } + + string[] contentTypes = new string[] { + "application/json", + "application/xml" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdatePetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdatePetDefaultImplementation(apiResponseLocalVar, pet); + + Events.ExecuteOnUpdatePet(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdatePetDefaultImplementation(e, "/pet", uriBuilderLocalVar.Path, pet); + Events.ExecuteOnErrorUpdatePet(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdatePetApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdatePetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdatePetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdatePetWithForm(ref long petId, ref Option name, ref Option status); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUpdatePetWithForm(Option name, Option status) + { + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name)); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUpdatePetWithFormDefaultImplementation(IUpdatePetWithFormApiResponse apiResponseLocalVar, long petId, Option name, Option status) + { + bool suppressDefaultLog = false; + AfterUpdatePetWithForm(ref suppressDefaultLog, apiResponseLocalVar, petId, name, status); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUpdatePetWithForm(ref bool suppressDefaultLog, IUpdatePetWithFormApiResponse apiResponseLocalVar, long petId, Option name, Option status); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUpdatePetWithFormDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option name, Option status) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdatePetWithForm(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, name, status); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdatePetWithForm(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option name, Option status); + + /// + /// Updates a pet in the store with form data + /// + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetWithFormOrDefaultAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdatePetWithFormAsync(petId, name, status, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdatePetWithFormAsync(long petId, Option name = default, Option status = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdatePetWithForm(name, status); + + FormatUpdatePetWithForm(ref petId, ref name, ref status); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (name.IsSet) + formParameterLocalVars.Add(new KeyValuePair("name", ClientUtils.ParameterToString(name.Value))); + + if (status.IsSet) + formParameterLocalVars.Add(new KeyValuePair("status", ClientUtils.ParameterToString(status.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdatePetWithFormApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdatePetWithFormDefaultImplementation(apiResponseLocalVar, petId, name, status); + + Events.ExecuteOnUpdatePetWithForm(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdatePetWithFormDefaultImplementation(e, "/pet/{petId}", uriBuilderLocalVar.Path, petId, name, status); + Events.ExecuteOnErrorUpdatePetWithForm(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdatePetWithFormApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdatePetWithFormApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdatePetWithFormApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 405 MethodNotAllowed + /// + /// + public bool IsMethodNotAllowed => 405 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUploadFile(ref long petId, ref Option additionalMetadata, ref Option file); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUploadFile(Option additionalMetadata, Option file) + { + if (additionalMetadata.IsSet && additionalMetadata.Value == null) + throw new ArgumentNullException(nameof(additionalMetadata)); + + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUploadFileDefaultImplementation(IUploadFileApiResponse apiResponseLocalVar, long petId, Option additionalMetadata, Option file) + { + bool suppressDefaultLog = false; + AfterUploadFile(ref suppressDefaultLog, apiResponseLocalVar, petId, additionalMetadata, file); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUploadFile(ref bool suppressDefaultLog, IUploadFileApiResponse apiResponseLocalVar, long petId, Option additionalMetadata, Option file); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUploadFileDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option additionalMetadata, Option file) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUploadFile(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, additionalMetadata, file); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUploadFile(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, Option additionalMetadata, Option file); + + /// + /// uploads an image + /// + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileOrDefaultAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UploadFileAsync(petId, additionalMetadata, file, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileAsync(long petId, Option additionalMetadata = default, Option file = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUploadFile(additionalMetadata, file); + + FormatUploadFile(ref petId, ref additionalMetadata, ref file); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/pet/{petId}/uploadImage"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); + + if (file.IsSet) + multipartContentLocalVar.Add(new StreamContent(file.Value)); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "multipart/form-data" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UploadFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/pet/{petId}/uploadImage", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUploadFileDefaultImplementation(apiResponseLocalVar, petId, additionalMetadata, file); + + Events.ExecuteOnUploadFile(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUploadFileDefaultImplementation(e, "/pet/{petId}/uploadImage", uriBuilderLocalVar.Path, petId, additionalMetadata, file); + Events.ExecuteOnErrorUploadFile(e); + throw; + } + } + + /// + /// The + /// + public partial class UploadFileApiResponse : Org.OpenAPITools.Client.ApiResponse, IUploadFileApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UploadFileApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ApiResponse? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUploadFileWithRequiredFile(ref long petId, ref System.IO.Stream requiredFile, ref Option additionalMetadata); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUploadFileWithRequiredFile(System.IO.Stream requiredFile, Option additionalMetadata) + { + if (requiredFile == null) + throw new ArgumentNullException(nameof(requiredFile)); + + if (additionalMetadata.IsSet && additionalMetadata.Value == null) + throw new ArgumentNullException(nameof(additionalMetadata)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + private void AfterUploadFileWithRequiredFileDefaultImplementation(IUploadFileWithRequiredFileApiResponse apiResponseLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata) + { + bool suppressDefaultLog = false; + AfterUploadFileWithRequiredFile(ref suppressDefaultLog, apiResponseLocalVar, petId, requiredFile, additionalMetadata); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + /// + partial void AfterUploadFileWithRequiredFile(ref bool suppressDefaultLog, IUploadFileWithRequiredFileApiResponse apiResponseLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + /// + private void OnErrorUploadFileWithRequiredFileDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUploadFileWithRequiredFile(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, petId, requiredFile, additionalMetadata); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUploadFileWithRequiredFile(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long petId, System.IO.Stream requiredFile, Option additionalMetadata); + + /// + /// uploads an image (required) + /// + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileWithRequiredFileOrDefaultAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UploadFileWithRequiredFileAsync(petId, requiredFile, additionalMetadata, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Cancellation Token to cancel the request. + /// <> + public async Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, Option additionalMetadata = default, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUploadFileWithRequiredFile(requiredFile, additionalMetadata); + + FormatUploadFileWithRequiredFile(ref petId, ref requiredFile, ref additionalMetadata); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/fake/{petId}/uploadImageWithRequiredFile"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7BpetId%7D", Uri.EscapeDataString(petId.ToString())); + + MultipartContent multipartContentLocalVar = new MultipartContent(); + + httpRequestMessageLocalVar.Content = multipartContentLocalVar; + + List> formParameterLocalVars = new List>(); + + multipartContentLocalVar.Add(new FormUrlEncodedContent(formParameterLocalVars)); multipartContentLocalVar.Add(new StreamContent(requiredFile)); + + if (additionalMetadata.IsSet) + formParameterLocalVars.Add(new KeyValuePair("additionalMetadata", ClientUtils.ParameterToString(additionalMetadata.Value))); + + List tokenBaseLocalVars = new List(); + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + OAuthToken oauthTokenLocalVar1 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(oauthTokenLocalVar1); + + oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); + + string[] contentTypes = new string[] { + "multipart/form-data" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/json", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UploadFileWithRequiredFileApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/fake/{petId}/uploadImageWithRequiredFile", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUploadFileWithRequiredFileDefaultImplementation(apiResponseLocalVar, petId, requiredFile, additionalMetadata); + + Events.ExecuteOnUploadFileWithRequiredFile(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUploadFileWithRequiredFileDefaultImplementation(e, "/fake/{petId}/uploadImageWithRequiredFile", uriBuilderLocalVar.Path, petId, requiredFile, additionalMetadata); + Events.ExecuteOnErrorUploadFileWithRequiredFile(e); + throw; + } + } + + /// + /// The + /// + public partial class UploadFileWithRequiredFileApiResponse : Org.OpenAPITools.Client.ApiResponse, IUploadFileWithRequiredFileApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UploadFileWithRequiredFileApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.ApiResponse? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.ApiResponse? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs new file mode 100644 index 000000000000..1677ff9901e2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,1203 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IStoreApi : IApi + { + /// + /// The class containing the events + /// + StoreApiEvents Events { get; } + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <?> + Task DeleteOrderOrDefaultAsync(string orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Cancellation Token to cancel the request. + /// <?> + Task GetInventoryOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <?> + Task GetOrderByIdOrDefaultAsync(long orderId, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <?> + Task PlaceOrderOrDefaultAsync(Order order, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface IDeleteOrderApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IGetInventoryApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk?> + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// The + /// + public interface IGetOrderByIdApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IPlaceOrderApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class StoreApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnDeleteOrder; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorDeleteOrder; + + internal void ExecuteOnDeleteOrder(StoreApi.DeleteOrderApiResponse apiResponse) + { + OnDeleteOrder?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeleteOrder(Exception exception) + { + OnErrorDeleteOrder?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetInventory; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetInventory; + + internal void ExecuteOnGetInventory(StoreApi.GetInventoryApiResponse apiResponse) + { + OnGetInventory?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetInventory(Exception exception) + { + OnErrorGetInventory?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetOrderById; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetOrderById; + + internal void ExecuteOnGetOrderById(StoreApi.GetOrderByIdApiResponse apiResponse) + { + OnGetOrderById?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetOrderById(Exception exception) + { + OnErrorGetOrderById?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnPlaceOrder; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorPlaceOrder; + + internal void ExecuteOnPlaceOrder(StoreApi.PlaceOrderApiResponse apiResponse) + { + OnPlaceOrder?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorPlaceOrder(Exception exception) + { + OnErrorPlaceOrder?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class StoreApi : IStoreApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public StoreApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, StoreApiEvents storeApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = storeApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + } + + partial void FormatDeleteOrder(ref string orderId); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeleteOrder(string orderId) + { + if (orderId == null) + throw new ArgumentNullException(nameof(orderId)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterDeleteOrderDefaultImplementation(IDeleteOrderApiResponse apiResponseLocalVar, string orderId) + { + bool suppressDefaultLog = false; + AfterDeleteOrder(ref suppressDefaultLog, apiResponseLocalVar, orderId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterDeleteOrder(ref bool suppressDefaultLog, IDeleteOrderApiResponse apiResponseLocalVar, string orderId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorDeleteOrderDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string orderId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeleteOrder(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, orderId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorDeleteOrder(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string orderId); + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteOrderOrDefaultAsync(string orderId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeleteOrderAsync(orderId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteOrderAsync(string orderId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeleteOrder(orderId); + + FormatDeleteOrder(ref orderId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order/{order_id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeleteOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeleteOrderDefaultImplementation(apiResponseLocalVar, orderId); + + Events.ExecuteOnDeleteOrder(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeleteOrderDefaultImplementation(e, "/store/order/{order_id}", uriBuilderLocalVar.Path, orderId); + Events.ExecuteOnErrorDeleteOrder(e); + throw; + } + } + + /// + /// The + /// + public partial class DeleteOrderApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeleteOrderApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteOrderApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterGetInventoryDefaultImplementation(IGetInventoryApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterGetInventory(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterGetInventory(ref bool suppressDefaultLog, IGetInventoryApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorGetInventoryDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetInventory(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorGetInventory(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task GetInventoryOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetInventoryAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task GetInventoryAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/inventory"; + + List tokenBaseLocalVars = new List(); + ApiKeyToken apiKeyTokenLocalVar1 = (ApiKeyToken) await ApiKeyProvider.GetAsync("api-key", cancellationToken).ConfigureAwait(false); + tokenBaseLocalVars.Add(apiKeyTokenLocalVar1); + apiKeyTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetInventoryApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/inventory", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetInventoryDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnGetInventory(apiResponseLocalVar); + + if (apiResponseLocalVar.StatusCode == (HttpStatusCode) 429) + foreach(TokenBase tokenBaseLocalVar in tokenBaseLocalVars) + tokenBaseLocalVar.BeginRateLimit(); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetInventoryDefaultImplementation(e, "/store/inventory", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorGetInventory(e); + throw; + } + } + + /// + /// The + /// + public partial class GetInventoryApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetInventoryApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetInventoryApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Dictionary? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize>(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Dictionary? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetOrderById(ref long orderId); + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetOrderByIdDefaultImplementation(IGetOrderByIdApiResponse apiResponseLocalVar, long orderId) + { + bool suppressDefaultLog = false; + AfterGetOrderById(ref suppressDefaultLog, apiResponseLocalVar, orderId); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetOrderById(ref bool suppressDefaultLog, IGetOrderByIdApiResponse apiResponseLocalVar, long orderId); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetOrderByIdDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long orderId) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetOrderById(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, orderId); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetOrderById(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, long orderId); + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + public async Task GetOrderByIdOrDefaultAsync(long orderId, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetOrderByIdAsync(orderId, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Cancellation Token to cancel the request. + /// <> + public async Task GetOrderByIdAsync(long orderId, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + FormatGetOrderById(ref orderId); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order/{order_id}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Border_id%7D", Uri.EscapeDataString(orderId.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetOrderByIdApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order/{order_id}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetOrderByIdDefaultImplementation(apiResponseLocalVar, orderId); + + Events.ExecuteOnGetOrderById(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetOrderByIdDefaultImplementation(e, "/store/order/{order_id}", uriBuilderLocalVar.Path, orderId); + Events.ExecuteOnErrorGetOrderById(e); + throw; + } + } + + /// + /// The + /// + public partial class GetOrderByIdApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetOrderByIdApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetOrderByIdApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Order? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatPlaceOrder(Order order); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidatePlaceOrder(Order order) + { + if (order == null) + throw new ArgumentNullException(nameof(order)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterPlaceOrderDefaultImplementation(IPlaceOrderApiResponse apiResponseLocalVar, Order order) + { + bool suppressDefaultLog = false; + AfterPlaceOrder(ref suppressDefaultLog, apiResponseLocalVar, order); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterPlaceOrder(ref bool suppressDefaultLog, IPlaceOrderApiResponse apiResponseLocalVar, Order order); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorPlaceOrderDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Order order) + { + bool suppressDefaultLogLocalVar = false; + OnErrorPlaceOrder(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, order); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorPlaceOrder(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, Order order); + + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + public async Task PlaceOrderOrDefaultAsync(Order order, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await PlaceOrderAsync(order, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Cancellation Token to cancel the request. + /// <> + public async Task PlaceOrderAsync(Order order, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidatePlaceOrder(order); + + FormatPlaceOrder(order); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/store/order"; + + httpRequestMessageLocalVar.Content = (order as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(order, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + PlaceOrderApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/store/order", requestedAtLocalVar, _jsonSerializerOptions); + + AfterPlaceOrderDefaultImplementation(apiResponseLocalVar, order); + + Events.ExecuteOnPlaceOrder(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorPlaceOrderDefaultImplementation(e, "/store/order", uriBuilderLocalVar.Path, order); + Events.ExecuteOnErrorPlaceOrder(e); + throw; + } + } + + /// + /// The + /// + public partial class PlaceOrderApiResponse : Org.OpenAPITools.Client.ApiResponse, IPlaceOrderApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public PlaceOrderApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.Order? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.Order? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs new file mode 100644 index 000000000000..0352814ae67d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/UserApi.cs @@ -0,0 +1,2264 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IUserApi : IApi + { + /// + /// The class containing the events + /// + UserApiEvents Events { get; } + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Created user object + /// Cancellation Token to cancel the request. + /// <?> + Task CreateUserOrDefaultAsync(User user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <?> + Task CreateUsersWithArrayInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <?> + Task CreateUsersWithListInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <?> + Task DeleteUserOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Get user by user name + /// + /// + /// + /// + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <?> + Task GetUserByNameOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + Task LoginUserAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <?> + Task LoginUserOrDefaultAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task LogoutUserOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + Task UpdateUserAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <?> + Task UpdateUserOrDefaultAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface ICreateUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface ICreateUsersWithArrayInputApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface ICreateUsersWithListInputApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IDeleteUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// The + /// + public interface IGetUserByNameApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk, ICustomHttpStatusCode599 + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + + /// + /// Returns true if the response is 598 CustomHttpStatusCode598 + /// + /// + bool IsCustomHttpStatusCode598 { get; } + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 + /// + /// + bool IsCustomHttpStatusCode599 { get; } + } + + /// + /// The + /// + public interface ILoginUserApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + } + + /// + /// The + /// + public interface ILogoutUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is the default response type + /// + /// + bool IsDefault { get; } + } + + /// + /// The + /// + public interface IUpdateUserApiResponse : Org.OpenAPITools.Client.IApiResponse + { + /// + /// Returns true if the response is 400 BadRequest + /// + /// + bool IsBadRequest { get; } + + /// + /// Returns true if the response is 404 NotFound + /// + /// + bool IsNotFound { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class UserApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnCreateUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorCreateUser; + + internal void ExecuteOnCreateUser(UserApi.CreateUserApiResponse apiResponse) + { + OnCreateUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUser(Exception exception) + { + OnErrorCreateUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnCreateUsersWithArrayInput; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorCreateUsersWithArrayInput; + + internal void ExecuteOnCreateUsersWithArrayInput(UserApi.CreateUsersWithArrayInputApiResponse apiResponse) + { + OnCreateUsersWithArrayInput?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUsersWithArrayInput(Exception exception) + { + OnErrorCreateUsersWithArrayInput?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnCreateUsersWithListInput; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorCreateUsersWithListInput; + + internal void ExecuteOnCreateUsersWithListInput(UserApi.CreateUsersWithListInputApiResponse apiResponse) + { + OnCreateUsersWithListInput?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorCreateUsersWithListInput(Exception exception) + { + OnErrorCreateUsersWithListInput?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnDeleteUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorDeleteUser; + + internal void ExecuteOnDeleteUser(UserApi.DeleteUserApiResponse apiResponse) + { + OnDeleteUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorDeleteUser(Exception exception) + { + OnErrorDeleteUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnGetUserByName; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorGetUserByName; + + internal void ExecuteOnGetUserByName(UserApi.GetUserByNameApiResponse apiResponse) + { + OnGetUserByName?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorGetUserByName(Exception exception) + { + OnErrorGetUserByName?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnLoginUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorLoginUser; + + internal void ExecuteOnLoginUser(UserApi.LoginUserApiResponse apiResponse) + { + OnLoginUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorLoginUser(Exception exception) + { + OnErrorLoginUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnLogoutUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorLogoutUser; + + internal void ExecuteOnLogoutUser(UserApi.LogoutUserApiResponse apiResponse) + { + OnLogoutUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorLogoutUser(Exception exception) + { + OnErrorLogoutUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + + /// + /// The event raised after the server response + /// + public event EventHandler? OnUpdateUser; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorUpdateUser; + + internal void ExecuteOnUpdateUser(UserApi.UpdateUserApiResponse apiResponse) + { + OnUpdateUser?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorUpdateUser(Exception exception) + { + OnErrorUpdateUser?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class UserApi : IUserApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public UserApiEvents Events { get; } + + /// + /// A token provider of type + /// + public TokenProvider ApiKeyProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BearerTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider BasicTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider HttpSignatureTokenProvider { get; } + + /// + /// A token provider of type + /// + public TokenProvider OauthTokenProvider { get; } + + /// + /// The token cookie container + /// + public Org.OpenAPITools.Client.CookieContainer CookieContainer { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, UserApiEvents userApiEvents, + TokenProvider apiKeyProvider, + TokenProvider bearerTokenProvider, + TokenProvider basicTokenProvider, + TokenProvider httpSignatureTokenProvider, + TokenProvider oauthTokenProvider, + Org.OpenAPITools.Client.CookieContainer cookieContainer) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = userApiEvents; + ApiKeyProvider = apiKeyProvider; + BearerTokenProvider = bearerTokenProvider; + BasicTokenProvider = basicTokenProvider; + HttpSignatureTokenProvider = httpSignatureTokenProvider; + OauthTokenProvider = oauthTokenProvider; + CookieContainer = cookieContainer; + } + + partial void FormatCreateUser(User user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUser(User user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUserDefaultImplementation(ICreateUserApiResponse apiResponseLocalVar, User user) + { + bool suppressDefaultLog = false; + AfterCreateUser(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUser(ref bool suppressDefaultLog, ICreateUserApiResponse apiResponseLocalVar, User user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user); + + /// + /// Create user This can only be done by the logged in user. + /// + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUserOrDefaultAsync(User user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUserAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUserAsync(User user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUser(user); + + FormatCreateUser(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUserDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUserDefaultImplementation(e, "/user", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUser(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatCreateUsersWithArrayInput(List user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUsersWithArrayInput(List user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUsersWithArrayInputDefaultImplementation(ICreateUsersWithArrayInputApiResponse apiResponseLocalVar, List user) + { + bool suppressDefaultLog = false; + AfterCreateUsersWithArrayInput(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUsersWithArrayInput(ref bool suppressDefaultLog, ICreateUsersWithArrayInputApiResponse apiResponseLocalVar, List user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUsersWithArrayInputDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUsersWithArrayInput(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUsersWithArrayInput(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user); + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithArrayInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUsersWithArrayInputAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithArrayInputAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUsersWithArrayInput(user); + + FormatCreateUsersWithArrayInput(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/createWithArray"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUsersWithArrayInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithArray", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUsersWithArrayInputDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUsersWithArrayInput(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUsersWithArrayInputDefaultImplementation(e, "/user/createWithArray", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUsersWithArrayInput(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUsersWithArrayInputApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUsersWithArrayInputApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUsersWithArrayInputApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatCreateUsersWithListInput(List user); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateCreateUsersWithListInput(List user) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterCreateUsersWithListInputDefaultImplementation(ICreateUsersWithListInputApiResponse apiResponseLocalVar, List user) + { + bool suppressDefaultLog = false; + AfterCreateUsersWithListInput(ref suppressDefaultLog, apiResponseLocalVar, user); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterCreateUsersWithListInput(ref bool suppressDefaultLog, ICreateUsersWithListInputApiResponse apiResponseLocalVar, List user); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorCreateUsersWithListInputDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user) + { + bool suppressDefaultLogLocalVar = false; + OnErrorCreateUsersWithListInput(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorCreateUsersWithListInput(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, List user); + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithListInputOrDefaultAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await CreateUsersWithListInputAsync(user, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Cancellation Token to cancel the request. + /// <> + public async Task CreateUsersWithListInputAsync(List user, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateCreateUsersWithListInput(user); + + FormatCreateUsersWithListInput(user); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/createWithList"; + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Post; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + CreateUsersWithListInputApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/createWithList", requestedAtLocalVar, _jsonSerializerOptions); + + AfterCreateUsersWithListInputDefaultImplementation(apiResponseLocalVar, user); + + Events.ExecuteOnCreateUsersWithListInput(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorCreateUsersWithListInputDefaultImplementation(e, "/user/createWithList", uriBuilderLocalVar.Path, user); + Events.ExecuteOnErrorCreateUsersWithListInput(e); + throw; + } + } + + /// + /// The + /// + public partial class CreateUsersWithListInputApiResponse : Org.OpenAPITools.Client.ApiResponse, ICreateUsersWithListInputApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public CreateUsersWithListInputApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatDeleteUser(ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateDeleteUser(string username) + { + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterDeleteUserDefaultImplementation(IDeleteUserApiResponse apiResponseLocalVar, string username) + { + bool suppressDefaultLog = false; + AfterDeleteUser(ref suppressDefaultLog, apiResponseLocalVar, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterDeleteUser(ref bool suppressDefaultLog, IDeleteUserApiResponse apiResponseLocalVar, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorDeleteUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorDeleteUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorDeleteUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username); + + /// + /// Delete user This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteUserOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await DeleteUserAsync(username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task DeleteUserAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateDeleteUser(username); + + FormatDeleteUser(ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Delete; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + DeleteUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterDeleteUserDefaultImplementation(apiResponseLocalVar, username); + + Events.ExecuteOnDeleteUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorDeleteUserDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, username); + Events.ExecuteOnErrorDeleteUser(e); + throw; + } + } + + /// + /// The + /// + public partial class DeleteUserApiResponse : Org.OpenAPITools.Client.ApiResponse, IDeleteUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public DeleteUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatGetUserByName(ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + private void ValidateGetUserByName(string username) + { + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + private void AfterGetUserByNameDefaultImplementation(IGetUserByNameApiResponse apiResponseLocalVar, string username) + { + bool suppressDefaultLog = false; + AfterGetUserByName(ref suppressDefaultLog, apiResponseLocalVar, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + partial void AfterGetUserByName(ref bool suppressDefaultLog, IGetUserByNameApiResponse apiResponseLocalVar, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + private void OnErrorGetUserByNameDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorGetUserByName(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + partial void OnErrorGetUserByName(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string username); + + /// + /// Get user by user name + /// + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetUserByNameOrDefaultAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await GetUserByNameAsync(username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Cancellation Token to cancel the request. + /// <> + public async Task GetUserByNameAsync(string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateGetUserByName(username); + + FormatGetUserByName(ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + GetUserByNameApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterGetUserByNameDefaultImplementation(apiResponseLocalVar, username); + + Events.ExecuteOnGetUserByName(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorGetUserByNameDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, username); + Events.ExecuteOnErrorGetUserByName(e); + throw; + } + } + + /// + /// The + /// + public partial class GetUserByNameApiResponse : Org.OpenAPITools.Client.ApiResponse, IGetUserByNameApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public GetUserByNameApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.User? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + /// + /// Returns true if the response is 598 CustomHttpStatusCode598 + /// + /// + public bool IsCustomHttpStatusCode598 => 598 == (int)StatusCode; + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 + /// + /// + public bool IsCustomHttpStatusCode599 => 599 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 599 CustomHttpStatusCode599 + /// + /// + public Org.OpenAPITools.Model.User? CustomHttpStatusCode599() + { + // This logic may be modified with the AsModel.mustache template + return IsCustomHttpStatusCode599 + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 599 CustomHttpStatusCode599 and the deserialized response is not null + /// + /// + /// + public bool TryCustomHttpStatusCode599([NotNullWhen(true)]out Org.OpenAPITools.Model.User? result) + { + result = null; + + try + { + result = CustomHttpStatusCode599(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)599); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatLoginUser(ref string password, ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateLoginUser(string password, string username) + { + if (password == null) + throw new ArgumentNullException(nameof(password)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterLoginUserDefaultImplementation(ILoginUserApiResponse apiResponseLocalVar, string password, string username) + { + bool suppressDefaultLog = false; + AfterLoginUser(ref suppressDefaultLog, apiResponseLocalVar, password, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterLoginUser(ref bool suppressDefaultLog, ILoginUserApiResponse apiResponseLocalVar, string password, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorLoginUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string password, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorLoginUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, password, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorLoginUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, string password, string username); + + /// + /// Logs user into the system + /// + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + public async Task LoginUserOrDefaultAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await LoginUserAsync(password, username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The password for login in clear text + /// The user name for login + /// Cancellation Token to cancel the request. + /// <> + public async Task LoginUserAsync(string password, string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateLoginUser(password, username); + + FormatLoginUser(ref password, ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/login"; + + System.Collections.Specialized.NameValueCollection parseQueryStringLocalVar = System.Web.HttpUtility.ParseQueryString(string.Empty); + + parseQueryStringLocalVar["password"] = ClientUtils.ParameterToString(password); + parseQueryStringLocalVar["username"] = ClientUtils.ParameterToString(username); + + uriBuilderLocalVar.Query = parseQueryStringLocalVar.ToString(); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/xml", + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + LoginUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/login", requestedAtLocalVar, _jsonSerializerOptions); + + AfterLoginUserDefaultImplementation(apiResponseLocalVar, password, username); + + Events.ExecuteOnLoginUser(apiResponseLocalVar); + + if (httpResponseMessageLocalVar.StatusCode == (HttpStatusCode) 200 && httpResponseMessageLocalVar.Headers.TryGetValues("Set-Cookie", out var cookieHeadersLocalVar)) + { + foreach(string cookieHeader in cookieHeadersLocalVar) + { + IList setCookieHeaderValuesLocalVar = Microsoft.Net.Http.Headers.SetCookieHeaderValue.ParseList(cookieHeadersLocalVar.ToArray()); + + foreach(Microsoft.Net.Http.Headers.SetCookieHeaderValue setCookieHeaderValueLocalVar in setCookieHeaderValuesLocalVar) + { + Cookie cookieLocalVar = new Cookie(setCookieHeaderValueLocalVar.Name.ToString(), setCookieHeaderValueLocalVar.Value.ToString()) + { + HttpOnly = setCookieHeaderValueLocalVar.HttpOnly + }; + + if (setCookieHeaderValueLocalVar.Expires.HasValue) + cookieLocalVar.Expires = setCookieHeaderValueLocalVar.Expires.Value.UtcDateTime; + + if (setCookieHeaderValueLocalVar.Path.HasValue) + cookieLocalVar.Path = setCookieHeaderValueLocalVar.Path.Value; + + if (setCookieHeaderValueLocalVar.Domain.HasValue) + cookieLocalVar.Domain = setCookieHeaderValueLocalVar.Domain.Value; + + CookieContainer.Value.Add(new Uri($"{uriBuilderLocalVar.Scheme}://{uriBuilderLocalVar.Host}"), cookieLocalVar); + } + } + } + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorLoginUserDefaultImplementation(e, "/user/login", uriBuilderLocalVar.Path, password, username); + Events.ExecuteOnErrorLoginUser(e); + throw; + } + } + + /// + /// The + /// + public partial class LoginUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ILoginUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public LoginUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public string? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out string? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + /// + /// Processes the server response + /// + /// + private void AfterLogoutUserDefaultImplementation(ILogoutUserApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterLogoutUser(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterLogoutUser(ref bool suppressDefaultLog, ILogoutUserApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorLogoutUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorLogoutUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorLogoutUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// Logs out current logged in user session + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task LogoutUserOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await LogoutUserAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task LogoutUserAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/logout"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + LogoutUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/logout", requestedAtLocalVar, _jsonSerializerOptions); + + AfterLogoutUserDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnLogoutUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorLogoutUserDefaultImplementation(e, "/user/logout", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorLogoutUser(e); + throw; + } + } + + /// + /// The + /// + public partial class LogoutUserApiResponse : Org.OpenAPITools.Client.ApiResponse, ILogoutUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public LogoutUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is the default response type + /// + /// + public bool IsDefault => true; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + + partial void FormatUpdateUser(User user, ref string username); + + /// + /// Validates the request parameters + /// + /// + /// + /// + private void ValidateUpdateUser(User user, string username) + { + if (user == null) + throw new ArgumentNullException(nameof(user)); + + if (username == null) + throw new ArgumentNullException(nameof(username)); + } + + /// + /// Processes the server response + /// + /// + /// + /// + private void AfterUpdateUserDefaultImplementation(IUpdateUserApiResponse apiResponseLocalVar, User user, string username) + { + bool suppressDefaultLog = false; + AfterUpdateUser(ref suppressDefaultLog, apiResponseLocalVar, user, username); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + /// + /// + partial void AfterUpdateUser(ref bool suppressDefaultLog, IUpdateUserApiResponse apiResponseLocalVar, User user, string username); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + /// + /// + private void OnErrorUpdateUserDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user, string username) + { + bool suppressDefaultLogLocalVar = false; + OnErrorUpdateUser(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar, user, username); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + /// + /// + partial void OnErrorUpdateUser(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar, User user, string username); + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateUserOrDefaultAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await UpdateUserAsync(user, username, cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Updated user object + /// name that need to be deleted + /// Cancellation Token to cancel the request. + /// <> + public async Task UpdateUserAsync(User user, string username, System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + ValidateUpdateUser(user, username); + + FormatUpdateUser(user, ref username); + + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/user/{username}"; + uriBuilderLocalVar.Path = uriBuilderLocalVar.Path.Replace("%7Busername%7D", Uri.EscapeDataString(username.ToString())); + + httpRequestMessageLocalVar.Content = (user as object) is System.IO.Stream stream + ? httpRequestMessageLocalVar.Content = new StreamContent(stream) + : httpRequestMessageLocalVar.Content = new StringContent(JsonSerializer.Serialize(user, _jsonSerializerOptions)); + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] contentTypes = new string[] { + "application/json" + }; + + string? contentTypeLocalVar = ClientUtils.SelectHeaderContentType(contentTypes); + + if (contentTypeLocalVar != null && httpRequestMessageLocalVar.Content != null) + httpRequestMessageLocalVar.Content.Headers.ContentType = new MediaTypeHeaderValue(contentTypeLocalVar); + + httpRequestMessageLocalVar.Method = HttpMethod.Put; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + UpdateUserApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/user/{username}", requestedAtLocalVar, _jsonSerializerOptions); + + AfterUpdateUserDefaultImplementation(apiResponseLocalVar, user, username); + + Events.ExecuteOnUpdateUser(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorUpdateUserDefaultImplementation(e, "/user/{username}", uriBuilderLocalVar.Path, user, username); + Events.ExecuteOnErrorUpdateUser(e); + throw; + } + } + + /// + /// The + /// + public partial class UpdateUserApiResponse : Org.OpenAPITools.Client.ApiResponse, IUpdateUserApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public UpdateUserApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 400 BadRequest + /// + /// + public bool IsBadRequest => 400 == (int)StatusCode; + + /// + /// Returns true if the response is 404 NotFound + /// + /// + public bool IsNotFound => 404 == (int)StatusCode; + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..76274524017f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,52 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string? ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs new file mode 100644 index 000000000000..d0b10f69b91e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiKeyToken.cs @@ -0,0 +1,54 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an apiKey. + /// + public class ApiKeyToken : TokenBase + { + private string _raw; + + /// + /// The header that this token will be used with. + /// + public ClientUtils.ApiKeyHeader Header { get; } + + /// + /// Constructs an ApiKeyToken object. + /// + /// + /// + /// + /// + public ApiKeyToken(string value, ClientUtils.ApiKeyHeader header, string prefix = "Bearer ", TimeSpan? timeout = null) : base(timeout) + { + Header = header; + _raw = $"{ prefix }{ value }"; + } + + /// + /// Places the token in the header. + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request) + { + request.Headers.Add(ClientUtils.ApiKeyHeaderToString(Header), _raw); + } + + /// + /// Places the token in the query. + /// + /// + /// + /// + public virtual void UseInQuery(global::System.Net.Http.HttpRequestMessage request, UriBuilder uriBuilder, System.Collections.Specialized.NameValueCollection parseQueryString) + { + parseQueryString[ClientUtils.ApiKeyHeaderToString(Header)] = Uri.EscapeDataString(_raw).ToString()!; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..88b4a497394b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,212 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string? ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri? RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string? ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri? RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface ICustomHttpStatusCode599 : IApiResponse + { + /// + /// Deserializes the response if the response is CustomHttpStatusCode599 + /// + /// + TType CustomHttpStatusCode599(); + + /// + /// Returns true if the response is CustomHttpStatusCode599 and the deserialized response is not null + /// + /// + /// + bool TryCustomHttpStatusCode599([NotNullWhen(true)]out TType? result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk([NotNullWhen(true)]out TType? result); + } + + /// + /// An interface for responses of type + /// + /// + public interface IDefault : IApiResponse + { + /// + /// Deserializes the response if the response is Default + /// + /// + TType Default(); + + /// + /// Returns true if the response is Default and the deserialized response is not null + /// + /// + /// + bool TryDefault([NotNullWhen(true)]out TType? result); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs new file mode 100644 index 000000000000..01e79ed16ed2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BasicToken.cs @@ -0,0 +1,44 @@ +// + +#nullable enable + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from a username and password. + /// + public class BasicToken : TokenBase + { + private string _username; + + private string _password; + + /// + /// Constructs a BasicToken object. + /// + /// + /// + /// + public BasicToken(string username, string password, TimeSpan? timeout = null) : base(timeout) + { + _username = username; + + _password = password; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Org.OpenAPITools.Client.ClientUtils.Base64Encode(_username + ":" + _password)); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs new file mode 100644 index 000000000000..b2d4591d46b9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/BearerToken.cs @@ -0,0 +1,39 @@ +// + +#nullable enable + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from a token from a bearer token. + /// + public class BearerToken : TokenBase + { + private string _raw; + + /// + /// Constructs a BearerToken object. + /// + /// + /// + public BearerToken(string value, TimeSpan? timeout = null) : base(timeout) + { + _raw = value; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..ec53dbda4326 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,428 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using KellermanSoftware.CompareNetObjects; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + /// + /// An instance of CompareLogic. + /// + public static CompareLogic compareLogic; + + /// + /// Static constructor to initialise compareLogic. + /// + static ClientUtils() + { + ComparisonConfig comparisonConfig = new(); + comparisonConfig.UseHashCodeIdentifier = true; + compareLogic = new(comparisonConfig); + } + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// An enum of headers + /// + public enum ApiKeyHeader + { + /// + /// The api-key header + /// + Api_key, + /// + /// The api_key_query header + /// + Api_key_query + } + + /// + /// Converte an ApiKeyHeader to a string + /// + /// + /// + /// + public static string ApiKeyHeaderToString(ApiKeyHeader value) + { + return value switch + { + ApiKeyHeader.Api_key => "api-key", + ApiKeyHeader.Api_key_query => "api_key_query", + _ => throw new System.ComponentModel.InvalidEnumArgumentException(nameof(value), (int)value, typeof(ApiKeyHeader)), + }; + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ChildCat.PetTypeEnum childCatPetTypeEnum) + return ChildCat.PetTypeEnumToJsonValue(childCatPetTypeEnum); + if (obj is EnumArrays.ArrayEnumEnum enumArraysArrayEnumEnum) + return EnumArrays.ArrayEnumEnumToJsonValue(enumArraysArrayEnumEnum); + if (obj is EnumArrays.JustSymbolEnum enumArraysJustSymbolEnum) + return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); + if (obj is EnumClass enumClass) + return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); + if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) + return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); + if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) + return EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTestEnumIntegerOnlyEnum).ToString(); + if (obj is EnumTest.EnumNumberEnum enumTestEnumNumberEnum) + return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); + if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) + return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); + if (obj is MapTest.InnerEnum mapTestInnerEnum) + return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); + if (obj is Order.StatusEnum orderStatusEnum) + return Order.StatusEnumToJsonValue(orderStatusEnum); + if (obj is OuterEnum outerEnum) + return OuterEnumValueConverter.ToJsonValue(outerEnum); + if (obj is OuterEnumDefaultValue outerEnumDefaultValue) + return OuterEnumDefaultValueValueConverter.ToJsonValue(outerEnumDefaultValue); + if (obj is OuterEnumInteger outerEnumInteger) + return OuterEnumIntegerValueConverter.ToJsonValue(outerEnumInteger).ToString(); + if (obj is OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue) + return OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(outerEnumIntegerDefaultValue).ToString(); + if (obj is OuterEnumTest outerEnumTest) + return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); + if (obj is Pet.StatusEnum petStatusEnum) + return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is Zebra.TypeEnum zebraTypeEnum) + return Zebra.TypeEnumToJsonValue(zebraTypeEnum); + if (obj is ZeroBasedEnum zeroBasedEnum) + return ZeroBasedEnumValueConverter.ToJsonValue(zeroBasedEnum); + if (obj is ZeroBasedEnumClass.ZeroBasedEnumEnum zeroBasedEnumClassZeroBasedEnumEnum) + return ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClassZeroBasedEnumEnum); + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string? SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// 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) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string? SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://petstore.swagger.io:80/v2"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = "/v2"; + + /// + /// The host of the API + /// + public const string HOST = "petstore.swagger.io"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..85093b0c1fee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,20 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs new file mode 100644 index 000000000000..c9dc766e4639 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateOnlyJsonConverter.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly dateOnlyValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateOnlyValue.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs new file mode 100644 index 000000000000..5e42c9efb856 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateOnlyNullableJsonConverter.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateOnlyNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd", + "yyyyMMdd" + + }; + + /// + /// Returns a DateOnly from the Json object + /// + /// + /// + /// + /// + public override DateOnly? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateOnly.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateOnly result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateOnly to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnly? dateOnlyValue, JsonSerializerOptions options) + { + if (dateOnlyValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateOnlyValue.Value.ToString("yyyy'-'MM'-'dd", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..de6a37a17df7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,75 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..02b767330d0a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..f711f9f3c7ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..03e2cd6ecb87 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,354 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyNullableJsonConverter()); + _jsonOptions.Converters.Add(new ActivityJsonConverter()); + _jsonOptions.Converters.Add(new ActivityOutputElementRepresentationJsonConverter()); + _jsonOptions.Converters.Add(new AdditionalPropertiesClassJsonConverter()); + _jsonOptions.Converters.Add(new AnimalJsonConverter()); + _jsonOptions.Converters.Add(new ApiResponseJsonConverter()); + _jsonOptions.Converters.Add(new AppleJsonConverter()); + _jsonOptions.Converters.Add(new AppleReqJsonConverter()); + _jsonOptions.Converters.Add(new ArrayOfArrayOfNumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ArrayOfNumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ArrayTestJsonConverter()); + _jsonOptions.Converters.Add(new BananaJsonConverter()); + _jsonOptions.Converters.Add(new BananaReqJsonConverter()); + _jsonOptions.Converters.Add(new BasquePigJsonConverter()); + _jsonOptions.Converters.Add(new CapitalizationJsonConverter()); + _jsonOptions.Converters.Add(new CatJsonConverter()); + _jsonOptions.Converters.Add(new CategoryJsonConverter()); + _jsonOptions.Converters.Add(new ChildCatJsonConverter()); + _jsonOptions.Converters.Add(new ClassModelJsonConverter()); + _jsonOptions.Converters.Add(new ComplexQuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new DanishPigJsonConverter()); + _jsonOptions.Converters.Add(new DateOnlyClassJsonConverter()); + _jsonOptions.Converters.Add(new DeprecatedObjectJsonConverter()); + _jsonOptions.Converters.Add(new DogJsonConverter()); + _jsonOptions.Converters.Add(new DrawingJsonConverter()); + _jsonOptions.Converters.Add(new EnumArraysJsonConverter()); + _jsonOptions.Converters.Add(new EnumClassJsonConverter()); + _jsonOptions.Converters.Add(new EnumClassNullableJsonConverter()); + _jsonOptions.Converters.Add(new EnumTestJsonConverter()); + _jsonOptions.Converters.Add(new EquilateralTriangleJsonConverter()); + _jsonOptions.Converters.Add(new FileJsonConverter()); + _jsonOptions.Converters.Add(new FileSchemaTestClassJsonConverter()); + _jsonOptions.Converters.Add(new FooJsonConverter()); + _jsonOptions.Converters.Add(new FooGetDefaultResponseJsonConverter()); + _jsonOptions.Converters.Add(new FormatTestJsonConverter()); + _jsonOptions.Converters.Add(new FruitJsonConverter()); + _jsonOptions.Converters.Add(new FruitReqJsonConverter()); + _jsonOptions.Converters.Add(new GmFruitJsonConverter()); + _jsonOptions.Converters.Add(new GrandparentAnimalJsonConverter()); + _jsonOptions.Converters.Add(new HasOnlyReadOnlyJsonConverter()); + _jsonOptions.Converters.Add(new HealthCheckResultJsonConverter()); + _jsonOptions.Converters.Add(new IsoscelesTriangleJsonConverter()); + _jsonOptions.Converters.Add(new ListJsonConverter()); + _jsonOptions.Converters.Add(new LiteralStringClassJsonConverter()); + _jsonOptions.Converters.Add(new MammalJsonConverter()); + _jsonOptions.Converters.Add(new MapTestJsonConverter()); + _jsonOptions.Converters.Add(new MixLogJsonConverter()); + _jsonOptions.Converters.Add(new MixedAnyOfJsonConverter()); + _jsonOptions.Converters.Add(new MixedAnyOfContentJsonConverter()); + _jsonOptions.Converters.Add(new MixedOneOfJsonConverter()); + _jsonOptions.Converters.Add(new MixedOneOfContentJsonConverter()); + _jsonOptions.Converters.Add(new MixedPropertiesAndAdditionalPropertiesClassJsonConverter()); + _jsonOptions.Converters.Add(new MixedSubIdJsonConverter()); + _jsonOptions.Converters.Add(new Model200ResponseJsonConverter()); + _jsonOptions.Converters.Add(new ModelClientJsonConverter()); + _jsonOptions.Converters.Add(new NameJsonConverter()); + _jsonOptions.Converters.Add(new NotificationtestGetElementsV1ResponseMPayloadJsonConverter()); + _jsonOptions.Converters.Add(new NullableClassJsonConverter()); + _jsonOptions.Converters.Add(new NullableGuidClassJsonConverter()); + _jsonOptions.Converters.Add(new NullableShapeJsonConverter()); + _jsonOptions.Converters.Add(new NumberOnlyJsonConverter()); + _jsonOptions.Converters.Add(new ObjectWithDeprecatedFieldsJsonConverter()); + _jsonOptions.Converters.Add(new OneOfStringJsonConverter()); + _jsonOptions.Converters.Add(new OrderJsonConverter()); + _jsonOptions.Converters.Add(new OuterCompositeJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumDefaultValueJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumDefaultValueNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerDefaultValueJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumIntegerDefaultValueNullableJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumTestJsonConverter()); + _jsonOptions.Converters.Add(new OuterEnumTestNullableJsonConverter()); + _jsonOptions.Converters.Add(new ParentPetJsonConverter()); + _jsonOptions.Converters.Add(new PetJsonConverter()); + _jsonOptions.Converters.Add(new PigJsonConverter()); + _jsonOptions.Converters.Add(new PolymorphicPropertyJsonConverter()); + _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); + _jsonOptions.Converters.Add(new ReturnJsonConverter()); + _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); + _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); + _jsonOptions.Converters.Add(new ScaleneTriangleJsonConverter()); + _jsonOptions.Converters.Add(new ShapeJsonConverter()); + _jsonOptions.Converters.Add(new ShapeInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new ShapeOrNullJsonConverter()); + _jsonOptions.Converters.Add(new SimpleQuadrilateralJsonConverter()); + _jsonOptions.Converters.Add(new SpecialModelNameJsonConverter()); + _jsonOptions.Converters.Add(new TagJsonConverter()); + _jsonOptions.Converters.Add(new TestCollectionEndingWithWordListJsonConverter()); + _jsonOptions.Converters.Add(new TestCollectionEndingWithWordListObjectJsonConverter()); + _jsonOptions.Converters.Add(new TestInlineFreeformAdditionalPropertiesRequestJsonConverter()); + _jsonOptions.Converters.Add(new TriangleJsonConverter()); + _jsonOptions.Converters.Add(new TriangleInterfaceJsonConverter()); + _jsonOptions.Converters.Add(new UserJsonConverter()); + _jsonOptions.Converters.Add(new WhaleJsonConverter()); + _jsonOptions.Converters.Add(new ZebraJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumNullableJsonConverter()); + _jsonOptions.Converters.Add(new ZeroBasedEnumClassJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + + _jsonOptions.TypeInfoResolver = System.Text.Json.Serialization.Metadata.JsonTypeInfoResolver.Combine( + new ActivitySerializationContext(), + new ActivityOutputElementRepresentationSerializationContext(), + new AdditionalPropertiesClassSerializationContext(), + new AnimalSerializationContext(), + new ApiResponseSerializationContext(), + new AppleSerializationContext(), + new AppleReqSerializationContext(), + new ArrayOfArrayOfNumberOnlySerializationContext(), + new ArrayOfNumberOnlySerializationContext(), + new ArrayTestSerializationContext(), + new BananaSerializationContext(), + new BananaReqSerializationContext(), + new BasquePigSerializationContext(), + new CapitalizationSerializationContext(), + new CatSerializationContext(), + new CategorySerializationContext(), + new ChildCatSerializationContext(), + new ClassModelSerializationContext(), + new ComplexQuadrilateralSerializationContext(), + new DanishPigSerializationContext(), + new DateOnlyClassSerializationContext(), + new DeprecatedObjectSerializationContext(), + new DogSerializationContext(), + new DrawingSerializationContext(), + new EnumArraysSerializationContext(), + new EnumClassSerializationContext(), + new EnumTestSerializationContext(), + new EquilateralTriangleSerializationContext(), + new FileSerializationContext(), + new FileSchemaTestClassSerializationContext(), + new FooSerializationContext(), + new FooGetDefaultResponseSerializationContext(), + new FormatTestSerializationContext(), + new FruitSerializationContext(), + new FruitReqSerializationContext(), + new GmFruitSerializationContext(), + new GrandparentAnimalSerializationContext(), + new HasOnlyReadOnlySerializationContext(), + new HealthCheckResultSerializationContext(), + new IsoscelesTriangleSerializationContext(), + new ListSerializationContext(), + new LiteralStringClassSerializationContext(), + new MammalSerializationContext(), + new MapTestSerializationContext(), + new MixLogSerializationContext(), + new MixedAnyOfSerializationContext(), + new MixedAnyOfContentSerializationContext(), + new MixedOneOfSerializationContext(), + new MixedOneOfContentSerializationContext(), + new MixedPropertiesAndAdditionalPropertiesClassSerializationContext(), + new MixedSubIdSerializationContext(), + new Model200ResponseSerializationContext(), + new ModelClientSerializationContext(), + new NameSerializationContext(), + new NotificationtestGetElementsV1ResponseMPayloadSerializationContext(), + new NullableClassSerializationContext(), + new NullableGuidClassSerializationContext(), + new NullableShapeSerializationContext(), + new NumberOnlySerializationContext(), + new ObjectWithDeprecatedFieldsSerializationContext(), + new OneOfStringSerializationContext(), + new OrderSerializationContext(), + new OuterCompositeSerializationContext(), + new OuterEnumSerializationContext(), + new OuterEnumDefaultValueSerializationContext(), + new OuterEnumIntegerSerializationContext(), + new OuterEnumIntegerDefaultValueSerializationContext(), + new OuterEnumTestSerializationContext(), + new ParentPetSerializationContext(), + new PetSerializationContext(), + new PigSerializationContext(), + new PolymorphicPropertySerializationContext(), + new QuadrilateralSerializationContext(), + new QuadrilateralInterfaceSerializationContext(), + new ReadOnlyFirstSerializationContext(), + new RequiredClassSerializationContext(), + new ReturnSerializationContext(), + new RolesReportsHashSerializationContext(), + new RolesReportsHashRoleSerializationContext(), + new ScaleneTriangleSerializationContext(), + new ShapeSerializationContext(), + new ShapeInterfaceSerializationContext(), + new ShapeOrNullSerializationContext(), + new SimpleQuadrilateralSerializationContext(), + new SpecialModelNameSerializationContext(), + new TagSerializationContext(), + new TestCollectionEndingWithWordListSerializationContext(), + new TestCollectionEndingWithWordListObjectSerializationContext(), + new TestInlineFreeformAdditionalPropertiesRequestSerializationContext(), + new TriangleSerializationContext(), + new TriangleInterfaceSerializationContext(), + new UserSerializationContext(), + new WhaleSerializationContext(), + new ZebraSerializationContext(), + new ZeroBasedEnumSerializationContext(), + new ZeroBasedEnumClassSerializationContext(), + new System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver() + ); + + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action? client = null, Action? builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs new file mode 100644 index 000000000000..e566414eb6ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -0,0 +1,679 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Cryptography; +using System.Text; +using System.Web; + +namespace Org.OpenAPITools.Client +{ + /// + /// Class for HttpSigning auth related parameter and methods + /// + public class HttpSigningConfiguration + { + /// + /// Create an instance + /// + public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString? keyPassPhrase, List httpSigningHeader, HashAlgorithmName hashAlgorithm, string signingAlgorithm, int signatureValidityPeriod) + { + KeyId = keyId; + KeyFilePath = keyFilePath; + KeyPassPhrase = keyPassPhrase; + HttpSigningHeader = httpSigningHeader; + HashAlgorithm = hashAlgorithm; + SigningAlgorithm = signingAlgorithm; + SignatureValidityPeriod = signatureValidityPeriod; + } + + /// + ///Gets the Api keyId + /// + public string KeyId { get; set; } + + /// + /// Gets the Key file path + /// + public string KeyFilePath { get; set; } + + /// + /// Gets the key pass phrase for password protected key + /// + public SecureString? KeyPassPhrase { get; set; } + + /// + /// Gets the HTTP signing header + /// + public List HttpSigningHeader { get; set; } + + /// + /// Gets the hash algorithm sha256 or sha512 + /// + public HashAlgorithmName HashAlgorithm { get; set; } = HashAlgorithmName.SHA256; + + /// + /// Gets the signing algorithm + /// + public string SigningAlgorithm { get; set; } + + /// + /// Gets the Signature validity period in seconds + /// + public int SignatureValidityPeriod { get; set; } + + private enum PrivateKeyType + { + None = 0, + RSA = 1, + ECDSA = 2, + } + + /// + /// Gets the Headers for HttpSigning + /// + /// + /// + /// + internal Dictionary GetHttpSignedHeader(global::System.Net.Http.HttpRequestMessage request, string requestBody, System.Threading.CancellationToken cancellationToken = default) + { + if (request.RequestUri == null) + throw new NullReferenceException("The request URI was null"); + + const string HEADER_REQUEST_TARGET = "(request-target)"; + + // The time when the HTTP signature expires. The API server should reject HTTP requests that have expired. + const string HEADER_EXPIRES = "(expires)"; + + //The 'Date' header. + const string HEADER_DATE = "Date"; + + //The 'Host' header. + const string HEADER_HOST = "Host"; + + //The time when the HTTP signature was generated. + const string HEADER_CREATED = "(created)"; + + //When the 'Digest' header is included in the HTTP signature, the client automatically + //computes the digest of the HTTP request body, per RFC 3230. + const string HEADER_DIGEST = "Digest"; + + //The 'Authorization' header is automatically generated by the client. It includes + //the list of signed headers and a base64-encoded signature. + const string HEADER_AUTHORIZATION = "Authorization"; + + //Hash table to store singed headers + var HttpSignedRequestHeader = new Dictionary(); + + var httpSignatureHeader = new Dictionary(); + + if (HttpSigningHeader.Count == 0) + HttpSigningHeader.Add("(created)"); + + var dateTime = DateTime.Now; + string digest = String.Empty; + + if (HashAlgorithm == HashAlgorithmName.SHA256) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + digest = string.Format("SHA-256={0}", Convert.ToBase64String(bodyDigest)); + } + else if (HashAlgorithm == HashAlgorithmName.SHA512) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + digest = string.Format("SHA-512={0}", Convert.ToBase64String(bodyDigest)); + } + else + throw new Exception(string.Format("{0} not supported", HashAlgorithm)); + + foreach (var header in HttpSigningHeader) + if (header.Equals(HEADER_REQUEST_TARGET)) + httpSignatureHeader.Add(header.ToLower(), request.RequestUri.ToString()); + else if (header.Equals(HEADER_EXPIRES)) + { + var expireDateTime = dateTime.AddSeconds(SignatureValidityPeriod); + httpSignatureHeader.Add(header.ToLower(), GetUnixTime(expireDateTime).ToString()); + } + else if (header.Equals(HEADER_DATE)) + { + var utcDateTime = dateTime.ToString("r").ToString(); + httpSignatureHeader.Add(header.ToLower(), utcDateTime); + HttpSignedRequestHeader.Add(HEADER_DATE, utcDateTime); + } + else if (header.Equals(HEADER_HOST)) + { + httpSignatureHeader.Add(header.ToLower(), request.RequestUri.ToString()); + HttpSignedRequestHeader.Add(HEADER_HOST, request.RequestUri.ToString()); + } + else if (header.Equals(HEADER_CREATED)) + httpSignatureHeader.Add(header.ToLower(), GetUnixTime(dateTime).ToString()); + else if (header.Equals(HEADER_DIGEST)) + { + HttpSignedRequestHeader.Add(HEADER_DIGEST, digest); + httpSignatureHeader.Add(header.ToLower(), digest); + } + else + { + bool isHeaderFound = false; + foreach (var item in request.Headers) + { + if (string.Equals(item.Key, header, StringComparison.OrdinalIgnoreCase)) + { + httpSignatureHeader.Add(header.ToLower(), item.Value.ToString()); + isHeaderFound = true; + break; + } + } + + if (!isHeaderFound) + throw new Exception(string.Format("Cannot sign HTTP request.Request does not contain the {0} header.",header)); + } + + var headersKeysString = String.Join(" ", httpSignatureHeader.Keys); + var headerValuesList = new List(); + + foreach (var keyVal in httpSignatureHeader) + headerValuesList.Add(string.Format("{0}: {1}", keyVal.Key, keyVal.Value)); + + //Concatenate headers value separated by new line + var headerValuesString = string.Join("\n", headerValuesList); + var signatureStringHash = GetStringHash(HashAlgorithm, headerValuesString); + string? headerSignatureStr = null; + var keyType = GetKeyType(KeyFilePath); + + if (keyType == PrivateKeyType.RSA) + headerSignatureStr = GetRSASignature(signatureStringHash); + + else if (keyType == PrivateKeyType.ECDSA) + headerSignatureStr = GetECDSASignature(signatureStringHash); + + var cryptographicScheme = "hs2019"; + var authorizationHeaderValue = string.Format("Signature keyId=\"{0}\",algorithm=\"{1}\"", + KeyId, cryptographicScheme); + + if (httpSignatureHeader.ContainsKey(HEADER_CREATED)) + authorizationHeaderValue += string.Format(",created={0}", httpSignatureHeader[HEADER_CREATED]); + + if (httpSignatureHeader.ContainsKey(HEADER_EXPIRES)) + authorizationHeaderValue += string.Format(",expires={0}", httpSignatureHeader[HEADER_EXPIRES]); + + authorizationHeaderValue += string.Format(",headers=\"{0}\",signature=\"{1}\"", headersKeysString, headerSignatureStr); + + HttpSignedRequestHeader.Add(HEADER_AUTHORIZATION, authorizationHeaderValue); + + return HttpSignedRequestHeader; + } + + private byte[] GetStringHash(HashAlgorithmName hashAlgorithmName, string stringToBeHashed) + { + HashAlgorithm? hashAlgorithm = null; + + if (hashAlgorithmName == HashAlgorithmName.SHA1) + hashAlgorithm = SHA1.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA256) + hashAlgorithm = SHA256.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA512) + hashAlgorithm = SHA512.Create(); + + if (hashAlgorithmName == HashAlgorithmName.MD5) + hashAlgorithm = MD5.Create(); + + if (hashAlgorithm == null) + throw new NullReferenceException($"{ nameof(hashAlgorithm) } was null."); + + byte[] bytes = Encoding.UTF8.GetBytes(stringToBeHashed); + byte[] stringHash = hashAlgorithm.ComputeHash(bytes); + return stringHash; + } + + private int GetUnixTime(DateTime date2) + { + DateTime date1 = new DateTime(1970, 01, 01); + TimeSpan timeSpan = date2 - date1; + return (int)timeSpan.TotalSeconds; + } + + private string GetRSASignature(byte[] stringToSign) + { + if (KeyPassPhrase == null) + throw new NullReferenceException($"{ nameof(KeyPassPhrase) } was null."); + + RSA? rsa = GetRSAProviderFromPemFile(KeyFilePath, KeyPassPhrase); + + if (rsa == null) + return string.Empty; + else if (SigningAlgorithm == "RSASSA-PSS") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pss); + return Convert.ToBase64String(signedbytes); + } + else if (SigningAlgorithm == "PKCS1-v15") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pkcs1); + return Convert.ToBase64String(signedbytes); + } + + return string.Empty; + } + + /// + /// Gets the ECDSA signature + /// + /// + /// + private string GetECDSASignature(byte[] dataToSign) + { + if (!File.Exists(KeyFilePath)) + throw new Exception("key file path does not exist."); + + var ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + var ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var keyStr = File.ReadAllText(KeyFilePath); + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + + string ptrToStringUni = Marshal.PtrToStringUni(unmanagedString) ?? throw new NullReferenceException(); + + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(ptrToStringUni), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var signedBytes = ecdsa.SignHash(dataToSign); + var derBytes = ConvertToECDSAANS1Format(signedBytes); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; + } + + private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) + { + var derBytes = new List(); + byte derLength = 68; //default length for ECDSA code signing bit 0x44 + byte rbytesLength = 32; //R length 0x20 + byte sbytesLength = 32; //S length 0x20 + var rBytes = new List(); + var sBytes = new List(); + for (int i = 0; i < 32; i++) + rBytes.Add(signedBytes[i]); + + for (int i = 32; i < 64; i++) + sBytes.Add(signedBytes[i]); + + if (rBytes[0] > 0x7F) + { + derLength++; + rbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(rBytes); + rBytes.Clear(); + rBytes.Add(0x00); + rBytes.AddRange(tempBytes); + } + + if (sBytes[0] > 0x7F) + { + derLength++; + sbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(sBytes); + sBytes.Clear(); + sBytes.Add(0x00); + sBytes.AddRange(tempBytes); + + } + + derBytes.Add(48); //start of the sequence 0x30 + derBytes.Add(derLength); //total length r length, type and r bytes + + derBytes.Add(2); //tag for integer + derBytes.Add(rbytesLength); //length of r + derBytes.AddRange(rBytes); + + derBytes.Add(2); //tag for integer + derBytes.Add(sbytesLength); //length of s + derBytes.AddRange(sBytes); + return derBytes.ToArray(); + } + + private RSACryptoServiceProvider? GetRSAProviderFromPemFile(String pemfile, SecureString? keyPassPhrase = null) + { + const String pempubheader = "-----BEGIN PUBLIC KEY-----"; + const String pempubfooter = "-----END PUBLIC KEY-----"; + bool isPrivateKeyFile = true; + byte[]? pemkey = null; + + if (!File.Exists(pemfile)) + throw new Exception("private key file does not exist."); + + string pemstr = File.ReadAllText(pemfile).Trim(); + + if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) + isPrivateKeyFile = false; + + if (isPrivateKeyFile) + { + pemkey = ConvertPrivateKeyToBytes(pemstr, keyPassPhrase); + + if (pemkey == null) + return null; + + return DecodeRSAPrivateKey(pemkey); + } + return null; + } + + private byte[]? ConvertPrivateKeyToBytes(String instr, SecureString? keyPassPhrase = null) + { + const String pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; + const String pemprivfooter = "-----END RSA PRIVATE KEY-----"; + String pemstr = instr.Trim(); + byte[] binkey; + + if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) + return null; + + StringBuilder sb = new StringBuilder(pemstr); + sb.Replace(pemprivheader, ""); + sb.Replace(pemprivfooter, ""); + String pvkstr = sb.ToString().Trim(); + + try + { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key + binkey = Convert.FromBase64String(pvkstr); + return binkey; + } + catch (global::System.FormatException) + { + StringReader str = new StringReader(pvkstr); + + //-------- read PEM encryption info. lines and extract salt ----- + if (!str.ReadLine()!.StartsWith("Proc-Type: 4,ENCRYPTED")) // TODO: what do we do here if ReadLine is null? + return null; + + String saltline = str.ReadLine()!; // TODO: what do we do here if ReadLine is null? + if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) + return null; + + String saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); + byte[] salt = new byte[saltstr.Length / 2]; + for (int i = 0; i < salt.Length; i++) + salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); + + if (!(str.ReadLine() == "")) + return null; + + //------ remaining b64 data is encrypted RSA key ---- + String encryptedstr = str.ReadToEnd(); + + try + { //should have b64 encrypted RSA key now + binkey = Convert.FromBase64String(encryptedstr); + } + catch (global::System.FormatException) + { //data is not in base64 format + return null; + } + + // TODO: what do we do here if keyPassPhrase is null? + byte[] deskey = GetEncryptedKey(salt, keyPassPhrase!, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes + if (deskey == null) + return null; + + //------ Decrypt the encrypted 3des-encrypted RSA private key ------ + byte[]? rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV + + return rsakey; + } + } + + private RSACryptoServiceProvider? DecodeRSAPrivateKey(byte[] privkey) + { + byte[] MODULUS, E, D, P, Q, DP, DQ, IQ; + + // --------- Set up stream to decode the asn.1 encoded RSA private key ------ + MemoryStream mem = new MemoryStream(privkey); + BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading + byte bt = 0; + ushort twobytes = 0; + int elems = 0; + try + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + binr.ReadByte(); //advance 1 byte + else if (twobytes == 0x8230) + binr.ReadInt16(); //advance 2 bytes + else + return null; + + twobytes = binr.ReadUInt16(); + if (twobytes != 0x0102) //version number + return null; + + bt = binr.ReadByte(); + if (bt != 0x00) + return null; + + //------ all private key components are Integer sequences ---- + elems = GetIntegerSize(binr); + MODULUS = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + E = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + D = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + P = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + Q = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + DQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + IQ = binr.ReadBytes(elems); + + // ------- create RSACryptoServiceProvider instance and initialize with public key ----- + RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); + RSAParameters RSAparams = new RSAParameters(); + RSAparams.Modulus = MODULUS; + RSAparams.Exponent = E; + RSAparams.D = D; + RSAparams.P = P; + RSAparams.Q = Q; + RSAparams.DP = DP; + RSAparams.DQ = DQ; + RSAparams.InverseQ = IQ; + RSA.ImportParameters(RSAparams); + return RSA; + } + catch (Exception) + { + return null; + } + finally + { + binr.Close(); + } + } + + private int GetIntegerSize(BinaryReader binr) + { + byte bt = 0; + byte lowbyte = 0x00; + byte highbyte = 0x00; + int count = 0; + bt = binr.ReadByte(); + if (bt != 0x02) //expect integer + return 0; + + bt = binr.ReadByte(); + + if (bt == 0x81) + count = binr.ReadByte(); // data size in next byte + else if (bt == 0x82) + { + highbyte = binr.ReadByte(); // data size in next 2 bytes + lowbyte = binr.ReadByte(); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; + count = BitConverter.ToInt32(modint, 0); + } + else + count = bt; // we already have the data size + + while (binr.ReadByte() == 0x00) + //remove high order zeros in data + count -= 1; + + binr.BaseStream.Seek(-1, SeekOrigin.Current); + + //last ReadByte wasn't a removed zero, so back up a byte + return count; + } + + private byte[] GetEncryptedKey(byte[] salt, SecureString secpswd, int count, int miter) + { + IntPtr unmanagedPswd = IntPtr.Zero; + int HASHLENGTH = 16; //MD5 bytes + byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store concatenated Mi hashed results + + byte[] psbytes = new byte[secpswd.Length]; + unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); + Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); + Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); + + // --- concatenate salt and pswd bytes into fixed data array --- + byte[] data00 = new byte[psbytes.Length + salt.Length]; + Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes + Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes + + // ---- do multi-hashing and concatenate results D1, D2 ... into keymaterial bytes ---- + MD5 md5 = MD5.Create(); + byte[]? result = null; + byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget + + for (int j = 0; j < miter; j++) + { + // ---- Now hash consecutively for count times ------ + if (j == 0) + result = data00; //initialize + else + { + Array.Copy(result!, hashtarget, result!.Length); // TODO: what do we do if result is null here? + Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); + result = hashtarget; + } + + for (int i = 0; i < count; i++) + result = md5.ComputeHash(result); + + Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //concatenate to keymaterial + } + byte[] deskey = new byte[24]; + Array.Copy(keymaterial, deskey, deskey.Length); + + Array.Clear(psbytes, 0, psbytes.Length); + Array.Clear(data00, 0, data00.Length); + Array.Clear(result!, 0, result!.Length); // TODO: what do we do if result is null here? + Array.Clear(hashtarget, 0, hashtarget.Length); + Array.Clear(keymaterial, 0, keymaterial.Length); + return deskey; + } + + private byte[]? DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) + { + MemoryStream memst = new MemoryStream(); + TripleDES alg = TripleDES.Create(); + alg.Key = desKey; + alg.IV = IV; + try + { + CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); + cs.Write(cipherData, 0, cipherData.Length); + cs.Close(); + } + catch (Exception) + { + return null; + } + byte[] decryptedData = memst.ToArray(); + return decryptedData; + } + + /// + /// Detect the key type from the pem file. + /// + /// key file path in pem format + /// + private PrivateKeyType GetKeyType(string keyFilePath) + { + if (!File.Exists(keyFilePath)) + throw new Exception("Key file path does not exist."); + + var ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY"; + var ecPrivateKeyFooter = "END EC PRIVATE KEY"; + var rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY"; + var rsaPrivateFooter = "END RSA PRIVATE KEY"; + //var pkcs8Header = "BEGIN PRIVATE KEY"; + //var pkcs8Footer = "END PRIVATE KEY"; + var keyType = PrivateKeyType.None; + var key = File.ReadAllLines(keyFilePath); + + if (key[0].ToString().Contains(rsaPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(rsaPrivateFooter)) + keyType = PrivateKeyType.RSA; + else if (key[0].ToString().Contains(ecPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + keyType = PrivateKeyType.ECDSA; + + else if (key[0].ToString().Contains(ecPrivateKeyHeader) && key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + { + /* this type of key can hold many type different types of private key, but here due lack of pem header + Considering this as EC key + */ + //TODO :- update the key based on oid + keyType = PrivateKeyType.ECDSA; + } + else + throw new Exception("Either the key is invalid or key is not supported"); + + return keyType; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs new file mode 100644 index 000000000000..5d5338cb9e61 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/HttpSigningToken.cs @@ -0,0 +1,43 @@ +// + +#nullable enable + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed from an HttpSigningConfiguration + /// + public class HttpSignatureToken : TokenBase + { + private HttpSigningConfiguration _configuration; + + /// + /// Constructs an HttpSignatureToken object. + /// + /// + /// + public HttpSignatureToken(HttpSigningConfiguration configuration, TimeSpan? timeout = null) : base(timeout) + { + _configuration = configuration; + } + + /// + /// Places the token in the header. + /// + /// + /// + /// + public void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string requestBody, CancellationToken cancellationToken = default) + { + var signedHeaders = _configuration.GetHttpSignedHeader(request, requestBody, cancellationToken); + + foreach (var signedHeader in signedHeaders) + request.Headers.Add(signedHeader.Key, signedHeader.Value); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..0184d9ad9446 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,27 @@ +// + +#nullable enable + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs new file mode 100644 index 000000000000..3544d55c373c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/OAuthToken.cs @@ -0,0 +1,39 @@ +// + +#nullable enable + +using System; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Client +{ + /// + /// A token constructed with OAuth. + /// + public class OAuthToken : TokenBase + { + private string _raw; + + /// + /// Consturcts an OAuthToken object. + /// + /// + /// + public OAuthToken(string value, TimeSpan? timeout = null) : base(timeout) + { + _raw = value; + } + + /// + /// Places the token in the header. + /// + /// + /// + public virtual void UseInHeader(global::System.Net.Http.HttpRequestMessage request, string headerName) + { + request.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _raw); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..e6fd1c26872d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/Option.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..d5510735d390 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + if (container is TokenContainer apiKeyTokenContainer) + { + string[] headers = apiKeyTokenContainer.Tokens.Select(t => ClientUtils.ApiKeyHeaderToString(t.Header)).Distinct().ToArray(); + + foreach (string header in headers) + { + BoundedChannelOptions options = new BoundedChannelOptions(apiKeyTokenContainer.Tokens.Count(t => ClientUtils.ApiKeyHeaderToString(t.Header).Equals(header))) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(header, Channel.CreateBounded(options)); + } + } + else + { + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + } + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..3f713a2ef4bb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,71 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..7b0f23d28a4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,37 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..b873d5323e7a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,44 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..8c3aac614025 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,43 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..6a48eba93cd6 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..bde566d77c34 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs new file mode 100644 index 000000000000..97aaf78dd30a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Activity.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// test map of maps + /// + public partial class Activity : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// activityOutputs + [JsonConstructor] + public Activity(Option>?> activityOutputs = default) + { + ActivityOutputsOption = activityOutputs; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ActivityOutputs + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> ActivityOutputsOption { get; private set; } + + /// + /// Gets or Sets ActivityOutputs + /// + [JsonPropertyName("activity_outputs")] + public Dictionary>? ActivityOutputs { get { return this.ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Activity {\n"); + sb.Append(" ActivityOutputs: ").Append(ActivityOutputs).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActivityJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>?> activityOutputs = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "activity_outputs": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (activityOutputs.IsSet && activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); + + return new Activity(activityOutputs); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, activity, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) + { + if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + + if (activity.ActivityOutputsOption.IsSet) + { + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + } + } + } + + /// + /// The ActivitySerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Activity))] + public partial class ActivitySerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs new file mode 100644 index 000000000000..993b2a750ce7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -0,0 +1,217 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ActivityOutputElementRepresentation + /// + public partial class ActivityOutputElementRepresentation : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// prop1 + /// prop2 + [JsonConstructor] + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) + { + Prop1Option = prop1; + Prop2Option = prop2; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Prop1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Prop1Option { get; private set; } + + /// + /// Gets or Sets Prop1 + /// + [JsonPropertyName("prop1")] + public string? Prop1 { get { return this.Prop1Option; } set { this.Prop1Option = new(value); } } + + /// + /// Used to track the state of Prop2 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Prop2Option { get; private set; } + + /// + /// Gets or Sets Prop2 + /// + [JsonPropertyName("prop2")] + public Object? Prop2 { get { return this.Prop2Option; } set { this.Prop2Option = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ActivityOutputElementRepresentation {\n"); + sb.Append(" Prop1: ").Append(Prop1).Append("\n"); + sb.Append(" Prop2: ").Append(Prop2).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ActivityOutputElementRepresentationJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option prop1 = default; + Option prop2 = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "prop1": + prop1 = new Option(utf8JsonReader.GetString()!); + break; + case "prop2": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (prop1.IsSet && prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); + + if (prop2.IsSet && prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); + + return new ActivityOutputElementRepresentation(prop1, prop2); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, activityOutputElementRepresentation, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) + { + if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop1Option.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); + + if (activityOutputElementRepresentation.Prop2Option.IsSet) + { + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + } + } + } + + /// + /// The ActivityOutputElementRepresentationSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ActivityOutputElementRepresentation))] + public partial class ActivityOutputElementRepresentationSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs new file mode 100644 index 000000000000..fe4e050f537d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -0,0 +1,410 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// AdditionalPropertiesClass + /// + public partial class AdditionalPropertiesClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// anytype1 + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + /// mapOfMapProperty + /// mapProperty + /// mapWithUndeclaredPropertiesAnytype1 + /// mapWithUndeclaredPropertiesAnytype2 + /// mapWithUndeclaredPropertiesAnytype3 + /// mapWithUndeclaredPropertiesString + [JsonConstructor] + public AdditionalPropertiesClass(Option anytype1 = default, Option emptyMap = default, Option>?> mapOfMapProperty = default, Option?> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option?> mapWithUndeclaredPropertiesAnytype3 = default, Option?> mapWithUndeclaredPropertiesString = default) + { + Anytype1Option = anytype1; + EmptyMapOption = emptyMap; + MapOfMapPropertyOption = mapOfMapProperty; + MapPropertyOption = mapProperty; + MapWithUndeclaredPropertiesAnytype1Option = mapWithUndeclaredPropertiesAnytype1; + MapWithUndeclaredPropertiesAnytype2Option = mapWithUndeclaredPropertiesAnytype2; + MapWithUndeclaredPropertiesAnytype3Option = mapWithUndeclaredPropertiesAnytype3; + MapWithUndeclaredPropertiesStringOption = mapWithUndeclaredPropertiesString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Anytype1Option { get; private set; } + + /// + /// Gets or Sets Anytype1 + /// + [JsonPropertyName("anytype_1")] + public Object? Anytype1 { get { return this.Anytype1Option; } set { this.Anytype1Option = new(value); } } + + /// + /// Used to track the state of EmptyMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EmptyMapOption { get; private set; } + + /// + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + /// + /// an object with no declared properties and no undeclared properties, hence it's an empty map. + [JsonPropertyName("empty_map")] + public Object? EmptyMap { get { return this.EmptyMapOption; } set { this.EmptyMapOption = new(value); } } + + /// + /// Used to track the state of MapOfMapProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> MapOfMapPropertyOption { get; private set; } + + /// + /// Gets or Sets MapOfMapProperty + /// + [JsonPropertyName("map_of_map_property")] + public Dictionary>? MapOfMapProperty { get { return this.MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } + + /// + /// Used to track the state of MapProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapPropertyOption { get; private set; } + + /// + /// Gets or Sets MapProperty + /// + [JsonPropertyName("map_property")] + public Dictionary? MapProperty { get { return this.MapPropertyOption; } set { this.MapPropertyOption = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_1")] + public Object? MapWithUndeclaredPropertiesAnytype1 { get { return this.MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_2")] + public Object? MapWithUndeclaredPropertiesAnytype2 { get { return this.MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 + /// + [JsonPropertyName("map_with_undeclared_properties_anytype_3")] + public Dictionary? MapWithUndeclaredPropertiesAnytype3 { get { return this.MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } + + /// + /// Used to track the state of MapWithUndeclaredPropertiesString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } + + /// + /// Gets or Sets MapWithUndeclaredPropertiesString + /// + [JsonPropertyName("map_with_undeclared_properties_string")] + public Dictionary? MapWithUndeclaredPropertiesString { get { return this.MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AdditionalPropertiesClass {\n"); + sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); + sb.Append(" EmptyMap: ").Append(EmptyMap).Append("\n"); + sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); + sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype1: ").Append(MapWithUndeclaredPropertiesAnytype1).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append("\n"); + sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AdditionalPropertiesClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option anytype1 = default; + Option emptyMap = default; + Option>?> mapOfMapProperty = default; + Option?> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option?> mapWithUndeclaredPropertiesAnytype3 = default; + Option?> mapWithUndeclaredPropertiesString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "anytype_1": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "empty_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_of_map_property": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_property": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_with_undeclared_properties_anytype_1": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_with_undeclared_properties_anytype_2": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_with_undeclared_properties_anytype_3": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesAnytype3 = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_with_undeclared_properties_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (emptyMap.IsSet && emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapOfMapProperty.IsSet && mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapProperty.IsSet && mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype1.IsSet && mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype2.IsSet && mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype3.IsSet && mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); + + return new AdditionalPropertiesClass(anytype1, emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, additionalPropertiesClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.Anytype1Option.IsSet) + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); + if (additionalPropertiesClass.EmptyMapOption.IsSet) + { + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) + { + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapPropertyOption.IsSet) + { + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + } + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) + { + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + } + } + } + + /// + /// The AdditionalPropertiesClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(AdditionalPropertiesClass))] + public partial class AdditionalPropertiesClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs new file mode 100644 index 000000000000..7c54e55cb7b5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Animal.cs @@ -0,0 +1,231 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Animal + /// + public partial class Animal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// color (default to "red") + [JsonConstructor] + public Animal(Option color = default) + { + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public string ClassName { get; } = "Animal"; + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Animal {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AnimalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option color = default; + + string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "className"); + + if (discriminator != null && discriminator.Equals("Cat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + if (discriminator != null && discriminator.Equals("Dog")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Animal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); + + return new Animal(color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) + { + if (animal is Cat cat){ + JsonSerializer.Serialize(writer, cat, jsonSerializerOptions); + return; + } + + if (animal is Dog dog){ + JsonSerializer.Serialize(writer, dog, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, animal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) + { + if (animal.ColorOption.IsSet && animal.Color == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + + writer.WriteString("className", animal.ClassName); + + if (animal.ColorOption.IsSet) + writer.WriteString("color", animal.Color); + } + } + + /// + /// The AnimalSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Animal))] + public partial class AnimalSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs new file mode 100644 index 000000000000..4ae5d07dcfef --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ApiResponse + /// + public partial class ApiResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// code + /// message + /// type + [JsonConstructor] + public ApiResponse(Option code = default, Option message = default, Option type = default) + { + CodeOption = code; + MessageOption = message; + TypeOption = type; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Code + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CodeOption { get; private set; } + + /// + /// Gets or Sets Code + /// + [JsonPropertyName("code")] + public int? Code { get { return this.CodeOption; } set { this.CodeOption = new(value); } } + + /// + /// Used to track the state of Message + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MessageOption { get; private set; } + + /// + /// Gets or Sets Message + /// + [JsonPropertyName("message")] + public string? Message { get { return this.MessageOption; } set { this.MessageOption = new(value); } } + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TypeOption { get; private set; } + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public string? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ApiResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option code = default; + Option message = default; + Option type = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "code": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + code = new Option(utf8JsonReader.GetInt32()); + break; + case "message": + message = new Option(utf8JsonReader.GetString()!); + break; + case "type": + type = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (code.IsSet && code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); + + if (message.IsSet && message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); + + return new ApiResponse(code, message, type); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apiResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + + if (apiResponse.CodeOption.IsSet) + writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); + + if (apiResponse.MessageOption.IsSet) + writer.WriteString("message", apiResponse.Message); + + if (apiResponse.TypeOption.IsSet) + writer.WriteString("type", apiResponse.Type); + } + } + + /// + /// The ApiResponseSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ApiResponse))] + public partial class ApiResponseSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs new file mode 100644 index 000000000000..3dab90bbeb36 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Apple.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Apple + /// + public partial class Apple : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// colorCode + /// cultivar + /// origin + [JsonConstructor] + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) + { + ColorCodeOption = colorCode; + CultivarOption = cultivar; + OriginOption = origin; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ColorCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorCodeOption { get; private set; } + + /// + /// Gets or Sets ColorCode + /// + [JsonPropertyName("color_code")] + public string? ColorCode { get { return this.ColorCodeOption; } set { this.ColorCodeOption = new(value); } } + + /// + /// Used to track the state of Cultivar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CultivarOption { get; private set; } + + /// + /// Gets or Sets Cultivar + /// + [JsonPropertyName("cultivar")] + public string? Cultivar { get { return this.CultivarOption; } set { this.CultivarOption = new(value); } } + + /// + /// Used to track the state of Origin + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OriginOption { get; private set; } + + /// + /// Gets or Sets Origin + /// + [JsonPropertyName("origin")] + public string? Origin { get { return this.OriginOption; } set { this.OriginOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Apple {\n"); + sb.Append(" ColorCode: ").Append(ColorCode).Append("\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); + sb.Append(" Origin: ").Append(Origin).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + if (this.ColorCodeOption.Value != null) { + // ColorCode (string) pattern + Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); + + if (this.ColorCodeOption.Value != null &&!regexColorCode.Match(this.ColorCodeOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); + } + } + + if (this.CultivarOption.Value != null) { + // Cultivar (string) pattern + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + + if (this.CultivarOption.Value != null &&!regexCultivar.Match(this.CultivarOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); + } + } + + if (this.OriginOption.Value != null) { + // Origin (string) pattern + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.OriginOption.Value != null &&!regexOrigin.Match(this.OriginOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); + } + } + + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option colorCode = default; + Option cultivar = default; + Option origin = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color_code": + colorCode = new Option(utf8JsonReader.GetString()!); + break; + case "cultivar": + cultivar = new Option(utf8JsonReader.GetString()!); + break; + case "origin": + origin = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (colorCode.IsSet && colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); + + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); + + if (origin.IsSet && origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); + + return new Apple(colorCode, cultivar, origin); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, apple, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) + { + if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.CultivarOption.IsSet && apple.Cultivar == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.OriginOption.IsSet && apple.Origin == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + + if (apple.ColorCodeOption.IsSet) + writer.WriteString("color_code", apple.ColorCode); + + if (apple.CultivarOption.IsSet) + writer.WriteString("cultivar", apple.Cultivar); + + if (apple.OriginOption.IsSet) + writer.WriteString("origin", apple.Origin); + } + } + + /// + /// The AppleSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Apple))] + public partial class AppleSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs new file mode 100644 index 000000000000..840e615e2280 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/AppleReq.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// AppleReq + /// + public partial class AppleReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// cultivar + /// mealy + [JsonConstructor] + public AppleReq(string cultivar, Option mealy = default) + { + Cultivar = cultivar; + MealyOption = mealy; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Cultivar + /// + [JsonPropertyName("cultivar")] + public string Cultivar { get; set; } + + /// + /// Used to track the state of Mealy + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MealyOption { get; private set; } + + /// + /// Gets or Sets Mealy + /// + [JsonPropertyName("mealy")] + public bool? Mealy { get { return this.MealyOption; } set { this.MealyOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class AppleReq {\n"); + sb.Append(" Cultivar: ").Append(Cultivar).Append("\n"); + sb.Append(" Mealy: ").Append(Mealy).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class AppleReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option cultivar = default; + Option mealy = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "cultivar": + cultivar = new Option(utf8JsonReader.GetString()!); + break; + case "mealy": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mealy = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!cultivar.IsSet) + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); + + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); + + if (mealy.IsSet && mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + return new AppleReq(cultivar.Value!, mealy); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, appleReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) + { + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + + writer.WriteString("cultivar", appleReq.Cultivar); + + if (appleReq.MealyOption.IsSet) + writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); + } + } + + /// + /// The AppleReqSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(AppleReq))] + public partial class AppleReqSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs new file mode 100644 index 000000000000..d27c45fdcd1d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfArrayOfNumberOnly + /// + public partial class ArrayOfArrayOfNumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayArrayNumber + [JsonConstructor] + public ArrayOfArrayOfNumberOnly(Option>?> arrayArrayNumber = default) + { + ArrayArrayNumberOption = arrayArrayNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayArrayNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> ArrayArrayNumberOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayNumber + /// + [JsonPropertyName("ArrayArrayNumber")] + public List>? ArrayArrayNumber { get { return this.ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayOfArrayOfNumberOnly {\n"); + sb.Append(" ArrayArrayNumber: ").Append(ArrayArrayNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayOfArrayOfNumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>?> arrayArrayNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ArrayArrayNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); + + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayOfArrayOfNumberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) + { + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + } + } + } + + /// + /// The ArrayOfArrayOfNumberOnlySerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ArrayOfArrayOfNumberOnly))] + public partial class ArrayOfArrayOfNumberOnlySerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs new file mode 100644 index 000000000000..72dc6b5327f5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayOfNumberOnly + /// + public partial class ArrayOfNumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayNumber + [JsonConstructor] + public ArrayOfNumberOnly(Option?> arrayNumber = default) + { + ArrayNumberOption = arrayNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayNumberOption { get; private set; } + + /// + /// Gets or Sets ArrayNumber + /// + [JsonPropertyName("ArrayNumber")] + public List? ArrayNumber { get { return this.ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayOfNumberOnly {\n"); + sb.Append(" ArrayNumber: ").Append(ArrayNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayOfNumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> arrayNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ArrayNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (arrayNumber.IsSet && arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); + + return new ArrayOfNumberOnly(arrayNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayOfNumberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) + { + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + } + } + } + + /// + /// The ArrayOfNumberOnlySerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ArrayOfNumberOnly))] + public partial class ArrayOfNumberOnlySerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs new file mode 100644 index 000000000000..947e074e1390 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -0,0 +1,252 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ArrayTest + /// + public partial class ArrayTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayArrayOfInteger + /// arrayArrayOfModel + /// arrayOfString + [JsonConstructor] + public ArrayTest(Option>?> arrayArrayOfInteger = default, Option>?> arrayArrayOfModel = default, Option?> arrayOfString = default) + { + ArrayArrayOfIntegerOption = arrayArrayOfInteger; + ArrayArrayOfModelOption = arrayArrayOfModel; + ArrayOfStringOption = arrayOfString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayArrayOfInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> ArrayArrayOfIntegerOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayOfInteger + /// + [JsonPropertyName("array_array_of_integer")] + public List>? ArrayArrayOfInteger { get { return this.ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } + + /// + /// Used to track the state of ArrayArrayOfModel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> ArrayArrayOfModelOption { get; private set; } + + /// + /// Gets or Sets ArrayArrayOfModel + /// + [JsonPropertyName("array_array_of_model")] + public List>? ArrayArrayOfModel { get { return this.ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } + + /// + /// Used to track the state of ArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets ArrayOfString + /// + [JsonPropertyName("array_of_string")] + public List? ArrayOfString { get { return this.ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ArrayTest {\n"); + sb.Append(" ArrayArrayOfInteger: ").Append(ArrayArrayOfInteger).Append("\n"); + sb.Append(" ArrayArrayOfModel: ").Append(ArrayArrayOfModel).Append("\n"); + sb.Append(" ArrayOfString: ").Append(ArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ArrayTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>?> arrayArrayOfInteger = default; + Option>?> arrayArrayOfModel = default; + Option?> arrayOfString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_array_of_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "array_array_of_model": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (arrayArrayOfInteger.IsSet && arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); + + if (arrayArrayOfModel.IsSet && arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); + + if (arrayOfString.IsSet && arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); + + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, arrayTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) + { + if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) + { + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + } + if (arrayTest.ArrayArrayOfModelOption.IsSet) + { + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + } + if (arrayTest.ArrayOfStringOption.IsSet) + { + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + } + } + } + + /// + /// The ArrayTestSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ArrayTest))] + public partial class ArrayTestSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs new file mode 100644 index 000000000000..06208194730c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Banana.cs @@ -0,0 +1,182 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Banana + /// + public partial class Banana : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lengthCm + [JsonConstructor] + public Banana(Option lengthCm = default) + { + LengthCmOption = lengthCm; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of LengthCm + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option LengthCmOption { get; private set; } + + /// + /// Gets or Sets LengthCm + /// + [JsonPropertyName("lengthCm")] + public decimal? LengthCm { get { return this.LengthCmOption; } set { this.LengthCmOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Banana {\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option lengthCm = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lengthCm": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + lengthCm = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); + + return new Banana(lengthCm); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, banana, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) + { + if (banana.LengthCmOption.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); + } + } + + /// + /// The BananaSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Banana))] + public partial class BananaSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs new file mode 100644 index 000000000000..c145e62672fb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BananaReq.cs @@ -0,0 +1,197 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// BananaReq + /// + public partial class BananaReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lengthCm + /// sweet + [JsonConstructor] + public BananaReq(decimal lengthCm, Option sweet = default) + { + LengthCm = lengthCm; + SweetOption = sweet; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets LengthCm + /// + [JsonPropertyName("lengthCm")] + public decimal LengthCm { get; set; } + + /// + /// Used to track the state of Sweet + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SweetOption { get; private set; } + + /// + /// Gets or Sets Sweet + /// + [JsonPropertyName("sweet")] + public bool? Sweet { get { return this.SweetOption; } set { this.SweetOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BananaReq {\n"); + sb.Append(" LengthCm: ").Append(LengthCm).Append("\n"); + sb.Append(" Sweet: ").Append(Sweet).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BananaReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option lengthCm = default; + Option sweet = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lengthCm": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + lengthCm = new Option(utf8JsonReader.GetDecimal()); + break; + case "sweet": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + sweet = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!lengthCm.IsSet) + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); + + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); + + if (sweet.IsSet && sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + return new BananaReq(lengthCm.Value!.Value!, sweet); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, bananaReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + + if (bananaReq.SweetOption.IsSet) + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); + } + } + + /// + /// The BananaReqSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(BananaReq))] + public partial class BananaReqSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs new file mode 100644 index 000000000000..cdd31db8f50c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/BasquePig.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// BasquePig + /// + public partial class BasquePig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + [JsonConstructor] + public BasquePig(string className) + { + ClassName = className; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class BasquePig {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class BasquePigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + return new BasquePig(className.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, basquePig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) + { + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + + writer.WriteString("className", basquePig.ClassName); + } + } + + /// + /// The BasquePigSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(BasquePig))] + public partial class BasquePigSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs new file mode 100644 index 000000000000..e36a343dc5e2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Capitalization.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Capitalization + /// + public partial class Capitalization : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Name of the pet + /// capitalCamel + /// capitalSnake + /// sCAETHFlowPoints + /// smallCamel + /// smallSnake + [JsonConstructor] + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) + { + ATT_NAMEOption = aTTNAME; + CapitalCamelOption = capitalCamel; + CapitalSnakeOption = capitalSnake; + SCAETHFlowPointsOption = sCAETHFlowPoints; + SmallCamelOption = smallCamel; + SmallSnakeOption = smallSnake; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ATT_NAME + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ATT_NAMEOption { get; private set; } + + /// + /// Name of the pet + /// + /// Name of the pet + [JsonPropertyName("ATT_NAME")] + public string? ATT_NAME { get { return this.ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } + + /// + /// Used to track the state of CapitalCamel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CapitalCamelOption { get; private set; } + + /// + /// Gets or Sets CapitalCamel + /// + [JsonPropertyName("CapitalCamel")] + public string? CapitalCamel { get { return this.CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } + + /// + /// Used to track the state of CapitalSnake + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CapitalSnakeOption { get; private set; } + + /// + /// Gets or Sets CapitalSnake + /// + [JsonPropertyName("Capital_Snake")] + public string? CapitalSnake { get { return this.CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } + + /// + /// Used to track the state of SCAETHFlowPoints + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SCAETHFlowPointsOption { get; private set; } + + /// + /// Gets or Sets SCAETHFlowPoints + /// + [JsonPropertyName("SCA_ETH_Flow_Points")] + public string? SCAETHFlowPoints { get { return this.SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } + + /// + /// Used to track the state of SmallCamel + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SmallCamelOption { get; private set; } + + /// + /// Gets or Sets SmallCamel + /// + [JsonPropertyName("smallCamel")] + public string? SmallCamel { get { return this.SmallCamelOption; } set { this.SmallCamelOption = new(value); } } + + /// + /// Used to track the state of SmallSnake + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SmallSnakeOption { get; private set; } + + /// + /// Gets or Sets SmallSnake + /// + [JsonPropertyName("small_Snake")] + public string? SmallSnake { get { return this.SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Capitalization {\n"); + sb.Append(" ATT_NAME: ").Append(ATT_NAME).Append("\n"); + sb.Append(" CapitalCamel: ").Append(CapitalCamel).Append("\n"); + sb.Append(" CapitalSnake: ").Append(CapitalSnake).Append("\n"); + sb.Append(" SCAETHFlowPoints: ").Append(SCAETHFlowPoints).Append("\n"); + sb.Append(" SmallCamel: ").Append(SmallCamel).Append("\n"); + sb.Append(" SmallSnake: ").Append(SmallSnake).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class CapitalizationJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ATT_NAME": + aTTNAME = new Option(utf8JsonReader.GetString()!); + break; + case "CapitalCamel": + capitalCamel = new Option(utf8JsonReader.GetString()!); + break; + case "Capital_Snake": + capitalSnake = new Option(utf8JsonReader.GetString()!); + break; + case "SCA_ETH_Flow_Points": + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); + break; + case "smallCamel": + smallCamel = new Option(utf8JsonReader.GetString()!); + break; + case "small_Snake": + smallSnake = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (aTTNAME.IsSet && aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); + + if (capitalCamel.IsSet && capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); + + if (capitalSnake.IsSet && capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); + + if (sCAETHFlowPoints.IsSet && sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); + + if (smallCamel.IsSet && smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); + + if (smallSnake.IsSet && smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); + + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, capitalization, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) + { + if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + + if (capitalization.ATT_NAMEOption.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); + + if (capitalization.CapitalCamelOption.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); + + if (capitalization.CapitalSnakeOption.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); + + if (capitalization.SCAETHFlowPointsOption.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); + + if (capitalization.SmallCamelOption.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel); + + if (capitalization.SmallSnakeOption.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake); + } + } + + /// + /// The CapitalizationSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Capitalization))] + public partial class CapitalizationSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs new file mode 100644 index 000000000000..352bba5d51e4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Cat.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Cat + /// + public partial class Cat : Animal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// color (default to "red") + /// declawed + [JsonConstructor] + public Cat(Option color = default, Option declawed = default) : base(color) + { + DeclawedOption = declawed; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string ClassName { get; } = "Cat"; + + /// + /// Used to track the state of Declawed + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeclawedOption { get; private set; } + + /// + /// Gets or Sets Declawed + /// + [JsonPropertyName("declawed")] + public bool? Declawed { get { return this.DeclawedOption; } set { this.DeclawedOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Cat {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Declawed: ").Append(Declawed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class CatJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option color = default; + Option declawed = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + case "declawed": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + declawed = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Cat.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); + + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + + return new Cat(color, declawed); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, cat, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) + { + if (cat.ColorOption.IsSet && cat.Color == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + + writer.WriteString("className", cat.ClassName); + + if (cat.ColorOption.IsSet) + writer.WriteString("color", cat.Color); + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); + } + } + + /// + /// The CatSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Cat))] + public partial class CatSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs new file mode 100644 index 000000000000..286d8b6464b5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Category.cs @@ -0,0 +1,206 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Category + /// + public partial class Category : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + /// name (default to "default-name") + [JsonConstructor] + public Category(Option id = default, string name = @"default-name") + { + IdOption = id; + Name = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Category {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class CategoryJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!name.IsSet) + throw new ArgumentException("Property is required for class Category.", nameof(name)); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + return new Category(id, name.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, category, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) + { + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + + if (category.IdOption.IsSet) + writer.WriteNumber("id", category.IdOption.Value!.Value); + + writer.WriteString("name", category.Name); + } + } + + /// + /// The CategorySerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Category))] + public partial class CategorySerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs new file mode 100644 index 000000000000..2b39e8e86f0c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ChildCat.cs @@ -0,0 +1,241 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ChildCat + /// + public partial class ChildCat : ParentPet, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public ChildCat(Option name = default) : base() + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines PetType + /// + public enum PetTypeEnum + { + /// + /// Enum ChildCat for value: ChildCat + /// + ChildCat = 1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static PetTypeEnum PetTypeEnumFromString(string value) + { + if (value.Equals("ChildCat")) + return PetTypeEnum.ChildCat; + + throw new NotImplementedException($"Could not convert value to type PetTypeEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static PetTypeEnum? PetTypeEnumFromStringOrDefault(string value) + { + if (value.Equals("ChildCat")) + return PetTypeEnum.ChildCat; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string PetTypeEnumToJsonValue(PetTypeEnum value) + { + if (value == PetTypeEnum.ChildCat) + return "ChildCat"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new PetTypeEnum PetType { get; } = (PetTypeEnum)Enum.Parse(typeof(PetTypeEnum), "ChildCat"); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ChildCat {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class ChildCatJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + Option petType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + case "pet_type": + string? petTypeRawValue = utf8JsonReader.GetString(); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ChildCat.", nameof(petType)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); + + return new ChildCat(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, childCat, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) + { + if (childCat.NameOption.IsSet && childCat.Name == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + + if (childCat.NameOption.IsSet) + writer.WriteString("name", childCat.Name); + + writer.WriteString("pet_type", ChildCat.PetTypeEnumToJsonValue(childCat.PetType)); + } + } + + /// + /// The ChildCatSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ChildCat))] + public partial class ChildCatSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs new file mode 100644 index 000000000000..e38fad89dbad --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ClassModel.cs @@ -0,0 +1,184 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model with \"_class\" property + /// + public partial class ClassModel : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// class + [JsonConstructor] + public ClassModel(Option @class = default) + { + ClassOption = @class; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Class + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ClassOption { get; private set; } + + /// + /// Gets or Sets Class + /// + [JsonPropertyName("_class")] + public string? Class { get { return this.ClassOption; } set { this.ClassOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ClassModel {\n"); + sb.Append(" Class: ").Append(Class).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ClassModelJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClass = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "_class": + varClass = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); + + return new ClassModel(varClass); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, classModel, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) + { + if (classModel.ClassOption.IsSet && classModel.Class == null) + throw new ArgumentNullException(nameof(classModel.Class), "Property is required for class ClassModel."); + + if (classModel.ClassOption.IsSet) + writer.WriteString("_class", classModel.Class); + } + } + + /// + /// The ClassModelSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ClassModel))] + public partial class ClassModelSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs new file mode 100644 index 000000000000..acf1f351fe7a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ComplexQuadrilateral + /// + public partial class ComplexQuadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + /// shapeType + [JsonConstructor] + public ComplexQuadrilateral(string quadrilateralType, string shapeType) + { + QuadrilateralType = quadrilateralType; + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ComplexQuadrilateral {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ComplexQuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()!); + break; + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, complexQuadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + } + } + + /// + /// The ComplexQuadrilateralSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ComplexQuadrilateral))] + public partial class ComplexQuadrilateralSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs new file mode 100644 index 000000000000..c54e2bd3ea87 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DanishPig.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DanishPig + /// + public partial class DanishPig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + [JsonConstructor] + public DanishPig(string className) + { + ClassName = className; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DanishPig {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DanishPigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + return new DanishPig(className.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, danishPig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) + { + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + + writer.WriteString("className", danishPig.ClassName); + } + } + + /// + /// The DanishPigSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(DanishPig))] + public partial class DanishPigSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs new file mode 100644 index 000000000000..dfa0a603bb61 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DateOnlyClass + /// + public partial class DateOnlyClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// dateOnlyProperty + [JsonConstructor] + public DateOnlyClass(Option dateOnlyProperty = default) + { + DateOnlyPropertyOption = dateOnlyProperty; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of DateOnlyProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateOnlyPropertyOption { get; private set; } + + /// + /// Gets or Sets DateOnlyProperty + /// + /* Fri Jul 21 00:00:00 UTC 2017 */ + [JsonPropertyName("dateOnlyProperty")] + public DateOnly? DateOnlyProperty { get { return this.DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DateOnlyClass {\n"); + sb.Append(" DateOnlyProperty: ").Append(DateOnlyProperty).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DateOnlyClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateOnlyProperty + /// + public static string DateOnlyPropertyFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option dateOnlyProperty = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "dateOnlyProperty": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); + + return new DateOnlyClass(dateOnlyProperty); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, dateOnlyClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) + { + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); + } + } + + /// + /// The DateOnlyClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(DateOnlyClass))] + public partial class DateOnlyClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs new file mode 100644 index 000000000000..0b8716d11ff4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -0,0 +1,184 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// DeprecatedObject + /// + public partial class DeprecatedObject : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public DeprecatedObject(Option name = default) + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class DeprecatedObject {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DeprecatedObjectJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); + + return new DeprecatedObject(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, deprecatedObject, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) + { + if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + + if (deprecatedObject.NameOption.IsSet) + writer.WriteString("name", deprecatedObject.Name); + } + } + + /// + /// The DeprecatedObjectSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(DeprecatedObject))] + public partial class DeprecatedObjectSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs new file mode 100644 index 000000000000..4de2c40c0183 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Dog.cs @@ -0,0 +1,201 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Dog + /// + public partial class Dog : Animal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// breed + /// color (default to "red") + [JsonConstructor] + public Dog(Option breed = default, Option color = default) : base(color) + { + BreedOption = breed; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string ClassName { get; } = "Dog"; + + /// + /// Used to track the state of Breed + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BreedOption { get; private set; } + + /// + /// Gets or Sets Breed + /// + [JsonPropertyName("breed")] + public string? Breed { get { return this.BreedOption; } set { this.BreedOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Dog {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append(" Breed: ").Append(Breed).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class DogJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option breed = default; + Option color = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()!); + break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Dog.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + + if (breed.IsSet && breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); + + return new Dog(breed, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, dog, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) + { + if (dog.BreedOption.IsSet && dog.Breed == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.ColorOption.IsSet && dog.Color == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + + writer.WriteString("className", dog.ClassName); + + if (dog.BreedOption.IsSet) + writer.WriteString("breed", dog.Breed); + + if (dog.ColorOption.IsSet) + writer.WriteString("color", dog.Color); + } + } + + /// + /// The DogSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Dog))] + public partial class DogSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs new file mode 100644 index 000000000000..1f8cc5462321 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Drawing.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Drawing + /// + public partial class Drawing : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// mainShape + /// nullableShape + /// shapeOrNull + /// shapes + [JsonConstructor] + public Drawing(Option mainShape = default, Option nullableShape = default, Option shapeOrNull = default, Option?> shapes = default) + { + MainShapeOption = mainShape; + NullableShapeOption = nullableShape; + ShapeOrNullOption = shapeOrNull; + ShapesOption = shapes; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of MainShape + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MainShapeOption { get; private set; } + + /// + /// Gets or Sets MainShape + /// + [JsonPropertyName("mainShape")] + public Shape? MainShape { get { return this.MainShapeOption; } set { this.MainShapeOption = new(value); } } + + /// + /// Used to track the state of NullableShape + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NullableShapeOption { get; private set; } + + /// + /// Gets or Sets NullableShape + /// + [JsonPropertyName("nullableShape")] + public NullableShape? NullableShape { get { return this.NullableShapeOption; } set { this.NullableShapeOption = new(value); } } + + /// + /// Used to track the state of ShapeOrNull + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShapeOrNullOption { get; private set; } + + /// + /// Gets or Sets ShapeOrNull + /// + [JsonPropertyName("shapeOrNull")] + public ShapeOrNull? ShapeOrNull { get { return this.ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } + + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ShapesOption { get; private set; } + + /// + /// Gets or Sets Shapes + /// + [JsonPropertyName("shapes")] + public List? Shapes { get { return this.ShapesOption; } set { this.ShapesOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Drawing {\n"); + sb.Append(" MainShape: ").Append(MainShape).Append("\n"); + sb.Append(" NullableShape: ").Append(NullableShape).Append("\n"); + sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n"); + sb.Append(" Shapes: ").Append(Shapes).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class DrawingJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option mainShape = default; + Option nullableShape = default; + Option shapeOrNull = default; + Option?> shapes = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "mainShape": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "nullableShape": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "shapeOrNull": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "shapes": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (mainShape.IsSet && mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); + + if (shapes.IsSet && shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); + + return new Drawing(mainShape, nullableShape, shapeOrNull, shapes); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, drawing, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) + { + if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.ShapesOption.IsSet && drawing.Shapes == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + + if (drawing.MainShapeOption.IsSet) + { + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + } + if (drawing.NullableShapeOption.IsSet) + if (drawing.NullableShapeOption.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNullOption.IsSet) + if (drawing.ShapeOrNullOption.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); + if (drawing.ShapesOption.IsSet) + { + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } + } + } + + /// + /// The DrawingSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Drawing))] + public partial class DrawingSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs new file mode 100644 index 000000000000..809acadd5224 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -0,0 +1,347 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumArrays + /// + public partial class EnumArrays : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayEnum + /// justSymbol + [JsonConstructor] + public EnumArrays(Option?> arrayEnum = default, Option justSymbol = default) + { + ArrayEnumOption = arrayEnum; + JustSymbolOption = justSymbol; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines ArrayEnum + /// + public enum ArrayEnumEnum + { + /// + /// Enum Fish for value: fish + /// + Fish = 1, + + /// + /// Enum Crab for value: crab + /// + Crab = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static ArrayEnumEnum ArrayEnumEnumFromString(string value) + { + if (value.Equals("fish")) + return ArrayEnumEnum.Fish; + + if (value.Equals("crab")) + return ArrayEnumEnum.Crab; + + throw new NotImplementedException($"Could not convert value to type ArrayEnumEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static ArrayEnumEnum? ArrayEnumEnumFromStringOrDefault(string value) + { + if (value.Equals("fish")) + return ArrayEnumEnum.Fish; + + if (value.Equals("crab")) + return ArrayEnumEnum.Crab; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum? value) + { + if (value == ArrayEnumEnum.Fish) + return "fish"; + + if (value == ArrayEnumEnum.Crab) + return "crab"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Defines JustSymbol + /// + public enum JustSymbolEnum + { + /// + /// Enum GreaterThanOrEqualTo for value: >= + /// + GreaterThanOrEqualTo = 1, + + /// + /// Enum Dollar for value: $ + /// + Dollar = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static JustSymbolEnum JustSymbolEnumFromString(string value) + { + if (value.Equals(">=")) + return JustSymbolEnum.GreaterThanOrEqualTo; + + if (value.Equals("$")) + return JustSymbolEnum.Dollar; + + throw new NotImplementedException($"Could not convert value to type JustSymbolEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static JustSymbolEnum? JustSymbolEnumFromStringOrDefault(string value) + { + if (value.Equals(">=")) + return JustSymbolEnum.GreaterThanOrEqualTo; + + if (value.Equals("$")) + return JustSymbolEnum.Dollar; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) + { + if (value == JustSymbolEnum.GreaterThanOrEqualTo) + return ">="; + + if (value == JustSymbolEnum.Dollar) + return "$"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of JustSymbol + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option JustSymbolOption { get; private set; } + + /// + /// Gets or Sets JustSymbol + /// + [JsonPropertyName("just_symbol")] + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } + + /// + /// Used to track the state of ArrayEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayEnumOption { get; private set; } + + /// + /// Gets or Sets ArrayEnum + /// + [JsonPropertyName("array_enum")] + public List? ArrayEnum { get { return this.ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EnumArrays {\n"); + sb.Append(" ArrayEnum: ").Append(ArrayEnum).Append("\n"); + sb.Append(" JustSymbol: ").Append(JustSymbol).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EnumArraysJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> arrayEnum = default; + Option justSymbol = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_enum": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "just_symbol": + string? justSymbolRawValue = utf8JsonReader.GetString(); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); + break; + default: + break; + } + } + } + + if (arrayEnum.IsSet && arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); + + if (justSymbol.IsSet && justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); + + return new EnumArrays(arrayEnum, justSymbol); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, enumArrays, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) + { + if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + + if (enumArrays.ArrayEnumOption.IsSet) + { + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + } + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); + writer.WriteString("just_symbol", justSymbolRawValue); + } + } + + /// + /// The EnumArraysSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(EnumArrays))] + public partial class EnumArraysSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumClass.cs new file mode 100644 index 000000000000..520dc1cfbde9 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumClass.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines EnumClass + /// + public enum EnumClass + { + /// + /// Enum Abc for value: _abc + /// + Abc = 1, + + /// + /// Enum Efg for value: -efg + /// + Efg = 2, + + /// + /// Enum Xyz for value: (xyz) + /// + Xyz = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class EnumClassValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static EnumClass FromString(string value) + { + if (value.Equals("_abc")) + return EnumClass.Abc; + + if (value.Equals("-efg")) + return EnumClass.Efg; + + if (value.Equals("(xyz)")) + return EnumClass.Xyz; + + throw new NotImplementedException($"Could not convert value to type EnumClass: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static EnumClass? FromStringOrDefault(string value) + { + if (value.Equals("_abc")) + return EnumClass.Abc; + + if (value.Equals("-efg")) + return EnumClass.Efg; + + if (value.Equals("(xyz)")) + return EnumClass.Xyz; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(EnumClass value) + { + if (value == EnumClass.Abc) + return "_abc"; + + if (value == EnumClass.Efg) + return "-efg"; + + if (value == EnumClass.Xyz) + return "(xyz)"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class EnumClassJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override EnumClass Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + EnumClass? result = rawValue == null + ? null + : EnumClassValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the EnumClass to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumClass enumClass, JsonSerializerOptions options) + { + writer.WriteStringValue(enumClass.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class EnumClassNullableJsonConverter : JsonConverter + { + /// + /// Returns a EnumClass from the Json object + /// + /// + /// + /// + /// + public override EnumClass? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + EnumClass? result = rawValue == null + ? null + : EnumClassValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumClass? enumClass, JsonSerializerOptions options) + { + writer.WriteStringValue(enumClass?.ToString() ?? "null"); + } + } + + + /// + /// The EnumClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(EnumClass))] + public partial class EnumClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs new file mode 100644 index 000000000000..65adf54ea349 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EnumTest.cs @@ -0,0 +1,891 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EnumTest + /// + public partial class EnumTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// enumStringRequired + /// enumInteger + /// enumIntegerOnly + /// enumNumber + /// enumString + /// outerEnum + /// outerEnumDefaultValue + /// outerEnumInteger + /// outerEnumIntegerDefaultValue + [JsonConstructor] + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnum = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default) + { + EnumStringRequired = enumStringRequired; + EnumIntegerOption = enumInteger; + EnumIntegerOnlyOption = enumIntegerOnly; + EnumNumberOption = enumNumber; + EnumStringOption = enumString; + OuterEnumOption = outerEnum; + OuterEnumDefaultValueOption = outerEnumDefaultValue; + OuterEnumIntegerOption = outerEnumInteger; + OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } + + /// + /// Defines EnumInteger + /// + public enum EnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumIntegerEnum EnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return EnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return EnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type EnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumIntegerEnum? EnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return EnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return EnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of EnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumIntegerOption { get; private set; } + + /// + /// Gets or Sets EnumInteger + /// + [JsonPropertyName("enum_integer")] + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } + + /// + /// Defines EnumIntegerOnly + /// + public enum EnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumIntegerOnlyEnum EnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type EnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumIntegerOnlyEnum? EnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return EnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of EnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets EnumIntegerOnly + /// + [JsonPropertyName("enum_integer_only")] + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } + + /// + /// Defines EnumNumber + /// + public enum EnumNumberEnum + { + /// + /// Enum NUMBER_1_DOT_1 for value: 1.1 + /// + NUMBER_1_DOT_1 = 1, + + /// + /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 + /// + NUMBER_MINUS_1_DOT_2 = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumNumberEnum EnumNumberEnumFromString(string value) + { + if (value.Equals("1.1")) + return EnumNumberEnum.NUMBER_1_DOT_1; + + if (value.Equals("-1.2")) + return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; + + throw new NotImplementedException($"Could not convert value to type EnumNumberEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumNumberEnum? EnumNumberEnumFromStringOrDefault(string value) + { + if (value.Equals("1.1")) + return EnumNumberEnum.NUMBER_1_DOT_1; + + if (value.Equals("-1.2")) + return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) + { + if (value == EnumNumberEnum.NUMBER_1_DOT_1) + return 1.1; + + if (value == EnumNumberEnum.NUMBER_MINUS_1_DOT_2) + return -1.2; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of EnumNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumNumberOption { get; private set; } + + /// + /// Gets or Sets EnumNumber + /// + [JsonPropertyName("enum_number")] + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } + + /// + /// Defines EnumString + /// + public enum EnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringEnum EnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringEnum.Lower; + + if (value.Equals("")) + return EnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringEnum? EnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringEnum.Lower; + + if (value.Equals("")) + return EnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringEnumToJsonValue(EnumStringEnum? value) + { + if (value == EnumStringEnum.UPPER) + return "UPPER"; + + if (value == EnumStringEnum.Lower) + return "lower"; + + if (value == EnumStringEnum.Empty) + return ""; + + if (value == EnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of EnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EnumStringOption { get; private set; } + + /// + /// Gets or Sets EnumString + /// + [JsonPropertyName("enum_string")] + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } + + /// + /// Used to track the state of OuterEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumOption { get; private set; } + + /// + /// Gets or Sets OuterEnum + /// + [JsonPropertyName("outerEnum")] + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } + + /// + /// Used to track the state of OuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets OuterEnumDefaultValue + /// + [JsonPropertyName("outerEnumDefaultValue")] + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } + + /// + /// Used to track the state of OuterEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets OuterEnumInteger + /// + [JsonPropertyName("outerEnumInteger")] + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } + + /// + /// Used to track the state of OuterEnumIntegerDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumIntegerDefaultValueOption { get; private set; } + + /// + /// Gets or Sets OuterEnumIntegerDefaultValue + /// + [JsonPropertyName("outerEnumIntegerDefaultValue")] + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); + sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); + sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); + sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); + sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); + sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); + sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); + sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EnumTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnum = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "enum_string_required": + string? enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; + case "enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "enum_number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + break; + case "enum_string": + string? enumStringRawValue = utf8JsonReader.GetString(); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); + break; + case "outerEnum": + string? outerEnumRawValue = utf8JsonReader.GetString(); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + break; + case "outerEnumDefaultValue": + string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); + break; + case "outerEnumInteger": + string? outerEnumIntegerRawValue = utf8JsonReader.GetString(); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); + break; + case "outerEnumIntegerDefaultValue": + string? outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); + break; + default: + break; + } + } + } + + if (!enumStringRequired.IsSet) + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); + + if (enumStringRequired.IsSet && enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); + + if (enumInteger.IsSet && enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); + + if (enumIntegerOnly.IsSet && enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); + + if (enumNumber.IsSet && enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + + if (enumString.IsSet && enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); + + if (outerEnumDefaultValue.IsSet && outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); + + if (outerEnumInteger.IsSet && outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); + + if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + + return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnum, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, enumTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) + { + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); + writer.WriteString("enum_string_required", enumStringRequiredRawValue); + if (enumTest.EnumIntegerOption.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); + + if (enumTest.EnumIntegerOnlyOption.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); + + if (enumTest.EnumNumberOption.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); + + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); + writer.WriteString("enum_string", enumStringRawValue); + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption!.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); + writer.WriteString("outerEnum", outerEnumRawValue); + } + else + writer.WriteNull("outerEnum"); + if (enumTest.OuterEnumDefaultValueOption.IsSet) + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumIntegerOption.IsSet) + { + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) + { + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + } + } + + /// + /// The EnumTestSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(EnumTest))] + public partial class EnumTestSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs new file mode 100644 index 000000000000..ca7a8101de84 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// EquilateralTriangle + /// + public partial class EquilateralTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public EquilateralTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class EquilateralTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class EquilateralTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, equilateralTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + + writer.WriteString("triangleType", equilateralTriangle.TriangleType); + } + } + + /// + /// The EquilateralTriangleSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(EquilateralTriangle))] + public partial class EquilateralTriangleSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 000000000000..bdc5c25e1329 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,185 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + public partial class File : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization + [JsonConstructor] + public File(Option sourceURI = default) + { + SourceURIOption = sourceURI; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of SourceURI + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SourceURIOption { get; private set; } + + /// + /// Test capitalization + /// + /// Test capitalization + [JsonPropertyName("sourceURI")] + public string? SourceURI { get { return this.SourceURIOption; } set { this.SourceURIOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FileJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option sourceURI = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "sourceURI": + sourceURI = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (sourceURI.IsSet && sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); + + return new File(sourceURI); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, file, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) + { + if (file.SourceURIOption.IsSet && file.SourceURI == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + + if (file.SourceURIOption.IsSet) + writer.WriteString("sourceURI", file.SourceURI); + } + } + + /// + /// The FileSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(File))] + public partial class FileSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 000000000000..d713d6a161ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + public partial class FileSchemaTestClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// file + /// files + [JsonConstructor] + public FileSchemaTestClass(Option file = default, Option?> files = default) + { + FileOption = file; + FilesOption = files; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of File + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FileOption { get; private set; } + + /// + /// Gets or Sets File + /// + [JsonPropertyName("file")] + public File? File { get { return this.FileOption; } set { this.FileOption = new(value); } } + + /// + /// Used to track the state of Files + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> FilesOption { get; private set; } + + /// + /// Gets or Sets Files + /// + [JsonPropertyName("files")] + public List? Files { get { return this.FilesOption; } set { this.FilesOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FileSchemaTestClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option file = default; + Option?> files = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "file": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "files": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); + + if (files.IsSet && files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); + + return new FileSchemaTestClass(file, files); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fileSchemaTestClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) + { + if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FileOption.IsSet) + { + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + } + if (fileSchemaTestClass.FilesOption.IsSet) + { + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + } + } + } + + /// + /// The FileSchemaTestClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(FileSchemaTestClass))] + public partial class FileSchemaTestClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs new file mode 100644 index 000000000000..ac4aeb49df5c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Foo.cs @@ -0,0 +1,184 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Foo + /// + public partial class Foo : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar (default to "bar") + [JsonConstructor] + public Foo(Option bar = default) + { + BarOption = bar; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; private set; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string? Bar { get { return this.BarOption; } set { this.BarOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Foo {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FooJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); + + return new Foo(bar); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, foo, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) + { + if (foo.BarOption.IsSet && foo.Bar == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + + if (foo.BarOption.IsSet) + writer.WriteString("bar", foo.Bar); + } + } + + /// + /// The FooSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Foo))] + public partial class FooSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs new file mode 100644 index 000000000000..d1d691a8dd2e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FooGetDefaultResponse + /// + public partial class FooGetDefaultResponse : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// string + [JsonConstructor] + public FooGetDefaultResponse(Option @string = default) + { + StringOption = @string; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public Foo? String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FooGetDefaultResponse {\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FooGetDefaultResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); + + return new FooGetDefaultResponse(varString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fooGetDefaultResponse, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) + { + if (fooGetDefaultResponse.StringOption.IsSet && fooGetDefaultResponse.String == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.String), "Property is required for class FooGetDefaultResponse."); + + if (fooGetDefaultResponse.StringOption.IsSet) + { + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.String, jsonSerializerOptions); + } + } + } + + /// + /// The FooGetDefaultResponseSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(FooGetDefaultResponse))] + public partial class FooGetDefaultResponseSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs new file mode 100644 index 000000000000..d9011f3dbd67 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FormatTest.cs @@ -0,0 +1,979 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FormatTest + /// + public partial class FormatTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// byte + /// date + /// number + /// password + /// binary + /// dateTime + /// decimal + /// double + /// float + /// int32 + /// int32Range + /// int64 + /// int64Negative + /// int64NegativeExclusive + /// int64Positive + /// int64PositiveExclusive + /// integer + /// None + /// A string that is a 10 digit number. Can have leading zeros. + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// string + /// unsignedInteger + /// unsignedLong + /// uuid + [JsonConstructor] + public FormatTest(byte[] @byte, DateOnly date, decimal number, string password, Option binary = default, Option dateTime = default, Option @decimal = default, Option @double = default, Option @float = default, Option int32 = default, Option int32Range = default, Option int64 = default, Option int64Negative = default, Option int64NegativeExclusive = default, Option int64Positive = default, Option int64PositiveExclusive = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option @string = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) + { + Byte = @byte; + Date = date; + Number = number; + Password = password; + BinaryOption = binary; + DateTimeOption = dateTime; + DecimalOption = @decimal; + DoubleOption = @double; + FloatOption = @float; + Int32Option = int32; + Int32RangeOption = int32Range; + Int64Option = int64; + Int64NegativeOption = int64Negative; + Int64NegativeExclusiveOption = int64NegativeExclusive; + Int64PositiveOption = int64Positive; + Int64PositiveExclusiveOption = int64PositiveExclusive; + IntegerOption = integer; + PatternWithBackslashOption = patternWithBackslash; + PatternWithDigitsOption = patternWithDigits; + PatternWithDigitsAndDelimiterOption = patternWithDigitsAndDelimiter; + StringOption = @string; + UnsignedIntegerOption = unsignedInteger; + UnsignedLongOption = unsignedLong; + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Byte + /// + [JsonPropertyName("byte")] + public byte[] Byte { get; set; } + + /// + /// Gets or Sets Date + /// + /* Sun Feb 02 00:00:00 UTC 2020 */ + [JsonPropertyName("date")] + public DateOnly Date { get; set; } + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } + + /// + /// Used to track the state of Binary + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BinaryOption { get; private set; } + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream? Binary { get { return this.BinaryOption; } set { this.BinaryOption = new(value); } } + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateTimeOption { get; private set; } + + /// + /// Gets or Sets DateTime + /// + /* 2007-12-03T10:15:30+01:00 */ + [JsonPropertyName("dateTime")] + public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new(value); } } + + /// + /// Used to track the state of Decimal + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DecimalOption { get; private set; } + + /// + /// Gets or Sets Decimal + /// + [JsonPropertyName("decimal")] + public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new(value); } } + + /// + /// Used to track the state of Double + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DoubleOption { get; private set; } + + /// + /// Gets or Sets Double + /// + [JsonPropertyName("double")] + public double? Double { get { return this.DoubleOption; } set { this.DoubleOption = new(value); } } + + /// + /// Used to track the state of Float + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FloatOption { get; private set; } + + /// + /// Gets or Sets Float + /// + [JsonPropertyName("float")] + public float? Float { get { return this.FloatOption; } set { this.FloatOption = new(value); } } + + /// + /// Used to track the state of Int32 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int32Option { get; private set; } + + /// + /// Gets or Sets Int32 + /// + [JsonPropertyName("int32")] + public int? Int32 { get { return this.Int32Option; } set { this.Int32Option = new(value); } } + + /// + /// Used to track the state of Int32Range + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int32RangeOption { get; private set; } + + /// + /// Gets or Sets Int32Range + /// + [JsonPropertyName("int32Range")] + public int? Int32Range { get { return this.Int32RangeOption; } set { this.Int32RangeOption = new(value); } } + + /// + /// Used to track the state of Int64 + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64Option { get; private set; } + + /// + /// Gets or Sets Int64 + /// + [JsonPropertyName("int64")] + public long? Int64 { get { return this.Int64Option; } set { this.Int64Option = new(value); } } + + /// + /// Used to track the state of Int64Negative + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64NegativeOption { get; private set; } + + /// + /// Gets or Sets Int64Negative + /// + [JsonPropertyName("int64Negative")] + public long? Int64Negative { get { return this.Int64NegativeOption; } set { this.Int64NegativeOption = new(value); } } + + /// + /// Used to track the state of Int64NegativeExclusive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64NegativeExclusiveOption { get; private set; } + + /// + /// Gets or Sets Int64NegativeExclusive + /// + [JsonPropertyName("int64NegativeExclusive")] + public long? Int64NegativeExclusive { get { return this.Int64NegativeExclusiveOption; } set { this.Int64NegativeExclusiveOption = new(value); } } + + /// + /// Used to track the state of Int64Positive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64PositiveOption { get; private set; } + + /// + /// Gets or Sets Int64Positive + /// + [JsonPropertyName("int64Positive")] + public long? Int64Positive { get { return this.Int64PositiveOption; } set { this.Int64PositiveOption = new(value); } } + + /// + /// Used to track the state of Int64PositiveExclusive + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Int64PositiveExclusiveOption { get; private set; } + + /// + /// Gets or Sets Int64PositiveExclusive + /// + [JsonPropertyName("int64PositiveExclusive")] + public long? Int64PositiveExclusive { get { return this.Int64PositiveExclusiveOption; } set { this.Int64PositiveExclusiveOption = new(value); } } + + /// + /// Used to track the state of Integer + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntegerOption { get; private set; } + + /// + /// Gets or Sets Integer + /// + [JsonPropertyName("integer")] + public int? Integer { get { return this.IntegerOption; } set { this.IntegerOption = new(value); } } + + /// + /// Used to track the state of PatternWithBackslash + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithBackslashOption { get; private set; } + + /// + /// None + /// + /// None + [JsonPropertyName("pattern_with_backslash")] + public string? PatternWithBackslash { get { return this.PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } + + /// + /// Used to track the state of PatternWithDigits + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithDigitsOption { get; private set; } + + /// + /// A string that is a 10 digit number. Can have leading zeros. + /// + /// A string that is a 10 digit number. Can have leading zeros. + [JsonPropertyName("pattern_with_digits")] + public string? PatternWithDigits { get { return this.PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } + + /// + /// Used to track the state of PatternWithDigitsAndDelimiter + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PatternWithDigitsAndDelimiterOption { get; private set; } + + /// + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + /// + /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + [JsonPropertyName("pattern_with_digits_and_delimiter")] + public string? PatternWithDigitsAndDelimiter { get { return this.PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + [JsonPropertyName("string")] + public string? String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Used to track the state of UnsignedInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsignedIntegerOption { get; private set; } + + /// + /// Gets or Sets UnsignedInteger + /// + [JsonPropertyName("unsigned_integer")] + public uint? UnsignedInteger { get { return this.UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } + + /// + /// Used to track the state of UnsignedLong + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsignedLongOption { get; private set; } + + /// + /// Gets or Sets UnsignedLong + /// + [JsonPropertyName("unsigned_long")] + public ulong? UnsignedLong { get { return this.UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FormatTest {\n"); + sb.Append(" Byte: ").Append(Byte).Append("\n"); + sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Decimal: ").Append(Decimal).Append("\n"); + sb.Append(" Double: ").Append(Double).Append("\n"); + sb.Append(" Float: ").Append(Float).Append("\n"); + sb.Append(" Int32: ").Append(Int32).Append("\n"); + sb.Append(" Int32Range: ").Append(Int32Range).Append("\n"); + sb.Append(" Int64: ").Append(Int64).Append("\n"); + sb.Append(" Int64Negative: ").Append(Int64Negative).Append("\n"); + sb.Append(" Int64NegativeExclusive: ").Append(Int64NegativeExclusive).Append("\n"); + sb.Append(" Int64Positive: ").Append(Int64Positive).Append("\n"); + sb.Append(" Int64PositiveExclusive: ").Append(Int64PositiveExclusive).Append("\n"); + sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); + sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); + sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); + sb.Append(" String: ").Append(String).Append("\n"); + sb.Append(" UnsignedInteger: ").Append(UnsignedInteger).Append("\n"); + sb.Append(" UnsignedLong: ").Append(UnsignedLong).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + // Double (double) maximum + if (this.DoubleOption.IsSet && this.DoubleOption.Value > (double)123.4) + { + yield return new ValidationResult("Invalid value for Double, must be a value less than or equal to 123.4.", new [] { "Double" }); + } + + // Double (double) minimum + if (this.DoubleOption.IsSet && this.DoubleOption.Value < (double)67.8) + { + yield return new ValidationResult("Invalid value for Double, must be a value greater than or equal to 67.8.", new [] { "Double" }); + } + + // Float (float) maximum + if (this.FloatOption.IsSet && this.FloatOption.Value > (float)987.6) + { + yield return new ValidationResult("Invalid value for Float, must be a value less than or equal to 987.6.", new [] { "Float" }); + } + + // Float (float) minimum + if (this.FloatOption.IsSet && this.FloatOption.Value < (float)54.3) + { + yield return new ValidationResult("Invalid value for Float, must be a value greater than or equal to 54.3.", new [] { "Float" }); + } + + // Int32 (int) maximum + if (this.Int32Option.IsSet && this.Int32Option.Value > (int)200) + { + yield return new ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); + } + + // Int32 (int) minimum + if (this.Int32Option.IsSet && this.Int32Option.Value < (int)20) + { + yield return new ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); + } + + // Int32Range (int) maximum + if (this.Int32RangeOption.IsSet && this.Int32RangeOption.Value > (int)2147483647) + { + yield return new ValidationResult("Invalid value for Int32Range, must be a value less than or equal to 2147483647.", new [] { "Int32Range" }); + } + + // Int32Range (int) minimum + if (this.Int32RangeOption.IsSet && this.Int32RangeOption.Value < (int)-2147483648) + { + yield return new ValidationResult("Invalid value for Int32Range, must be a value greater than or equal to -2147483648.", new [] { "Int32Range" }); + } + + // Int64Negative (long) maximum + if (this.Int64NegativeOption.IsSet && this.Int64NegativeOption.Value > (long)-2147483649) + { + yield return new ValidationResult("Invalid value for Int64Negative, must be a value less than or equal to -2147483649.", new [] { "Int64Negative" }); + } + + // Int64NegativeExclusive (long) maximum + if (this.Int64NegativeExclusiveOption.IsSet && this.Int64NegativeExclusiveOption.Value <= (long)-2147483648) + { + yield return new ValidationResult("Invalid value for Int64NegativeExclusive, must be a value less than -2147483648.", new [] { "Int64NegativeExclusive" }); + } + + // Int64Positive (long) minimum + if (this.Int64PositiveOption.IsSet && this.Int64PositiveOption.Value < (long)2147483648) + { + yield return new ValidationResult("Invalid value for Int64Positive, must be a value greater than or equal to 2147483648.", new [] { "Int64Positive" }); + } + + // Int64PositiveExclusive (long) minimum + if (this.Int64PositiveExclusiveOption.IsSet && this.Int64PositiveExclusiveOption.Value < (long)2147483647) + { + yield return new ValidationResult("Invalid value for Int64PositiveExclusive, must be a value greater than 2147483647.", new [] { "Int64PositiveExclusive" }); + } + + // Integer (int) maximum + if (this.IntegerOption.IsSet && this.IntegerOption.Value > (int)100) + { + yield return new ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); + } + + // Integer (int) minimum + if (this.IntegerOption.IsSet && this.IntegerOption.Value < (int)10) + { + yield return new ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); + } + + if (this.PatternWithBackslashOption.Value != null) { + // PatternWithBackslash (string) pattern + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + + if (this.PatternWithBackslashOption.Value != null &&!regexPatternWithBackslash.Match(this.PatternWithBackslashOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); + } + } + + if (this.PatternWithDigitsOption.Value != null) { + // PatternWithDigits (string) pattern + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + + if (this.PatternWithDigitsOption.Value != null &&!regexPatternWithDigits.Match(this.PatternWithDigitsOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); + } + } + + if (this.PatternWithDigitsAndDelimiterOption.Value != null) { + // PatternWithDigitsAndDelimiter (string) pattern + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.PatternWithDigitsAndDelimiterOption.Value != null &&!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiterOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); + } + } + + if (this.StringOption.Value != null) { + // String (string) pattern + Regex regexString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + + if (this.StringOption.Value != null &&!regexString.Match(this.StringOption.Value).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for String, must match a pattern of " + regexString, new [] { "String" }); + } + } + + // UnsignedInteger (uint) maximum + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value > (uint)200) + { + yield return new ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); + } + + // UnsignedInteger (uint) minimum + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value < (uint)20) + { + yield return new ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); + } + + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FormatTestJsonConverter : JsonConverter + { + /// + /// The format to use to serialize Date + /// + public static string DateFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize DateTime + /// + public static string DateTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int32Range = default; + Option int64 = default; + Option int64Negative = default; + Option int64NegativeExclusive = default; + Option int64Positive = default; + Option int64PositiveExclusive = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "byte": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "date": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + number = new Option(utf8JsonReader.GetDecimal()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()!); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "dateTime": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "decimal": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "double": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varDouble = new Option(utf8JsonReader.GetDouble()); + break; + case "float": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varFloat = new Option((float)utf8JsonReader.GetDouble()); + break; + case "int32": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int32 = new Option(utf8JsonReader.GetInt32()); + break; + case "int32Range": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int32Range = new Option(utf8JsonReader.GetInt32()); + break; + case "int64": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64 = new Option(utf8JsonReader.GetInt64()); + break; + case "int64Negative": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64Negative = new Option(utf8JsonReader.GetInt32()); + break; + case "int64NegativeExclusive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64NegativeExclusive = new Option(utf8JsonReader.GetInt32()); + break; + case "int64Positive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64Positive = new Option(utf8JsonReader.GetInt32()); + break; + case "int64PositiveExclusive": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + int64PositiveExclusive = new Option(utf8JsonReader.GetInt32()); + break; + case "integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + integer = new Option(utf8JsonReader.GetInt32()); + break; + case "pattern_with_backslash": + patternWithBackslash = new Option(utf8JsonReader.GetString()!); + break; + case "pattern_with_digits": + patternWithDigits = new Option(utf8JsonReader.GetString()!); + break; + case "pattern_with_digits_and_delimiter": + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); + break; + case "string": + varString = new Option(utf8JsonReader.GetString()!); + break; + case "unsigned_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + break; + case "unsigned_long": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + unsignedLong = new Option(utf8JsonReader.GetUInt64()); + break; + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!varByte.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); + + if (!date.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); + + if (!number.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); + + if (!password.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); + + if (varByte.IsSet && varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); + + if (date.IsSet && date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); + + if (number.IsSet && number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); + + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); + + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); + + if (varDecimal.IsSet && varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + + if (varDouble.IsSet && varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + + if (varFloat.IsSet && varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + + if (int32.IsSet && int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + + if (int32Range.IsSet && int32Range.Value == null) + throw new ArgumentNullException(nameof(int32Range), "Property is not nullable for class FormatTest."); + + if (int64.IsSet && int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + + if (int64Negative.IsSet && int64Negative.Value == null) + throw new ArgumentNullException(nameof(int64Negative), "Property is not nullable for class FormatTest."); + + if (int64NegativeExclusive.IsSet && int64NegativeExclusive.Value == null) + throw new ArgumentNullException(nameof(int64NegativeExclusive), "Property is not nullable for class FormatTest."); + + if (int64Positive.IsSet && int64Positive.Value == null) + throw new ArgumentNullException(nameof(int64Positive), "Property is not nullable for class FormatTest."); + + if (int64PositiveExclusive.IsSet && int64PositiveExclusive.Value == null) + throw new ArgumentNullException(nameof(int64PositiveExclusive), "Property is not nullable for class FormatTest."); + + if (integer.IsSet && integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + + if (patternWithBackslash.IsSet && patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); + + if (patternWithDigits.IsSet && patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); + + if (patternWithDigitsAndDelimiter.IsSet && patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); + + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + + if (unsignedInteger.IsSet && unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + + if (unsignedLong.IsSet && unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + + return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int32Range, int64, int64Negative, int64NegativeExclusive, int64Positive, int64PositiveExclusive, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, formatTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) + { + if (formatTest.Byte == null) + throw new ArgumentNullException(nameof(formatTest.Byte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.StringOption.IsSet && formatTest.String == null) + throw new ArgumentNullException(nameof(formatTest.String), "Property is required for class FormatTest."); + + writer.WritePropertyName("byte"); + JsonSerializer.Serialize(writer, formatTest.Byte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + + writer.WriteNumber("number", formatTest.Number); + + writer.WriteString("password", formatTest.Password); + + if (formatTest.BinaryOption.IsSet) + { + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + } + if (formatTest.DateTimeOption.IsSet) + writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); + + if (formatTest.DecimalOption.IsSet) + { + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.Decimal, jsonSerializerOptions); + } + if (formatTest.DoubleOption.IsSet) + writer.WriteNumber("double", formatTest.DoubleOption.Value!.Value); + + if (formatTest.FloatOption.IsSet) + writer.WriteNumber("float", formatTest.FloatOption.Value!.Value); + + if (formatTest.Int32Option.IsSet) + writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); + + if (formatTest.Int32RangeOption.IsSet) + writer.WriteNumber("int32Range", formatTest.Int32RangeOption.Value!.Value); + + if (formatTest.Int64Option.IsSet) + writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); + + if (formatTest.Int64NegativeOption.IsSet) + writer.WriteNumber("int64Negative", formatTest.Int64NegativeOption.Value!.Value); + + if (formatTest.Int64NegativeExclusiveOption.IsSet) + writer.WriteNumber("int64NegativeExclusive", formatTest.Int64NegativeExclusiveOption.Value!.Value); + + if (formatTest.Int64PositiveOption.IsSet) + writer.WriteNumber("int64Positive", formatTest.Int64PositiveOption.Value!.Value); + + if (formatTest.Int64PositiveExclusiveOption.IsSet) + writer.WriteNumber("int64PositiveExclusive", formatTest.Int64PositiveExclusiveOption.Value!.Value); + + if (formatTest.IntegerOption.IsSet) + writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); + + if (formatTest.PatternWithBackslashOption.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); + + if (formatTest.PatternWithDigitsOption.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); + + if (formatTest.StringOption.IsSet) + writer.WriteString("string", formatTest.String); + + if (formatTest.UnsignedIntegerOption.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); + + if (formatTest.UnsignedLongOption.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); + + if (formatTest.UuidOption.IsSet) + writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); + } + } + + /// + /// The FormatTestSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(FormatTest))] + public partial class FormatTestSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs new file mode 100644 index 000000000000..6aa166222089 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Fruit.cs @@ -0,0 +1,228 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Fruit + /// + public partial class Fruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Apple apple, Option color = default) + { + Apple = apple; + ColorOption = color; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// color + public Fruit(Banana banana, Option color = default) + { + Banana = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Apple + /// + public Apple? Apple { get; set; } + + /// + /// Gets or Sets Banana + /// + public Banana? Banana { get; set; } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Fruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple? apple = default; + Banana? banana = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + if (apple != null) + return new Fruit(apple, color); + + if (banana != null) + return new Fruit(banana, color); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) + { + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); + } + } + + /// + /// The FruitSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Fruit))] + public partial class FruitSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FruitReq.cs new file mode 100644 index 000000000000..1f75be50f94b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/FruitReq.cs @@ -0,0 +1,198 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// FruitReq + /// + public partial class FruitReq : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public FruitReq(AppleReq appleReq) + { + AppleReq = appleReq; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FruitReq(BananaReq bananaReq) + { + BananaReq = bananaReq; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets AppleReq + /// + public AppleReq? AppleReq { get; set; } + + /// + /// Gets or Sets BananaReq + /// + public BananaReq? BananaReq { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class FruitReq {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class FruitReqJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + AppleReq? appleReq = default; + BananaReq? bananaReq = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderAppleReq = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderAppleReq, jsonSerializerOptions, out appleReq); + + Utf8JsonReader utf8JsonReaderBananaReq = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBananaReq, jsonSerializerOptions, out bananaReq); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (appleReq != null) + return new FruitReq(appleReq); + + if (bananaReq != null) + return new FruitReq(bananaReq); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, fruitReq, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, FruitReq fruitReq, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The FruitReqSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(FruitReq))] + public partial class FruitReqSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs new file mode 100644 index 000000000000..e44c82f23506 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GmFruit.cs @@ -0,0 +1,245 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// GmFruit + /// + public partial class GmFruit : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// color + public GmFruit(Option apple, Option banana, Option color = default) + { + AppleOption = apple; + BananaOption = banana; + ColorOption = color; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AppleOption { get; private set; } + + /// + /// Gets or Sets Apple + /// + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BananaOption { get; private set; } + + /// + /// Gets or Sets Banana + /// + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Gets or Sets Color + /// + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GmFruit {\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class GmFruitJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option color = default; + + Apple? apple = default; + Banana? banana = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderApple = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderApple, jsonSerializerOptions, out apple); + + Utf8JsonReader utf8JsonReaderBanana = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBanana, jsonSerializerOptions, out banana); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); + + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, color); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null) + { + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(writer, gmFruit.AppleOption.Value, jsonSerializerOptions); + } + + if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null) + { + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(writer, gmFruit.BananaOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, gmFruit, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) + { + if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + + if (gmFruit.ColorOption.IsSet) + writer.WriteString("color", gmFruit.Color); + } + } + + /// + /// The GmFruitSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(GmFruit))] + public partial class GmFruitSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GrandparentAnimal.cs new file mode 100644 index 000000000000..69049f30a58f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -0,0 +1,202 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// GrandparentAnimal + /// + public partial class GrandparentAnimal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructor] + public GrandparentAnimal() + { + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public string PetType { get; } = "GrandparentAnimal"; + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class GrandparentAnimal {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class GrandparentAnimalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option petType = default; + + string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type"); + + if (discriminator != null && discriminator.Equals("ChildCat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + if (discriminator != null && discriminator.Equals("ParentPet")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pet_type": + petType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + return new GrandparentAnimal(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) + { + if (grandparentAnimal is ChildCat childCat){ + JsonSerializer.Serialize(writer, childCat, jsonSerializerOptions); + return; + } + + if (grandparentAnimal is ParentPet parentPet){ + JsonSerializer.Serialize(writer, parentPet, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, grandparentAnimal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("pet_type", grandparentAnimal.PetType); + } + } + + /// + /// The GrandparentAnimalSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(GrandparentAnimal))] + public partial class GrandparentAnimalSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs new file mode 100644 index 000000000000..0bf77a18dca2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -0,0 +1,254 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// HasOnlyReadOnly + /// + public partial class HasOnlyReadOnly : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar + /// foo + [JsonConstructor] + internal HasOnlyReadOnly(Option bar = default, Option foo = default) + { + BarOption = bar; + FooOption = foo; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string? Bar { get { return this.BarOption; } } + + /// + /// Used to track the state of Foo + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FooOption { get; } + + /// + /// Gets or Sets Foo + /// + [JsonPropertyName("foo")] + public string? Foo { get { return this.FooOption; } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HasOnlyReadOnly {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Foo: ").Append(Foo).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as HasOnlyReadOnly).AreEqual; + } + + /// + /// Returns true if HasOnlyReadOnly instances are equal + /// + /// Instance of HasOnlyReadOnly to be compared + /// Boolean + public bool Equals(HasOnlyReadOnly? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + if (Foo != null) + hashCode = (hashCode * 59) + Foo.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class HasOnlyReadOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + Option foo = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()!); + break; + case "foo": + foo = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); + + if (foo.IsSet && foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); + + return new HasOnlyReadOnly(bar, foo); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, hasOnlyReadOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.BarOption.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar); + + if (hasOnlyReadOnly.FooOption.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo); + } + } + + /// + /// The HasOnlyReadOnlySerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(HasOnlyReadOnly))] + public partial class HasOnlyReadOnlySerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HealthCheckResult.cs new file mode 100644 index 000000000000..71f3c4dc4ec0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -0,0 +1,181 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + /// + public partial class HealthCheckResult : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// nullableMessage + [JsonConstructor] + public HealthCheckResult(Option nullableMessage = default) + { + NullableMessageOption = nullableMessage; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of NullableMessage + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NullableMessageOption { get; private set; } + + /// + /// Gets or Sets NullableMessage + /// + [JsonPropertyName("NullableMessage")] + public string? NullableMessage { get { return this.NullableMessageOption; } set { this.NullableMessageOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class HealthCheckResult {\n"); + sb.Append(" NullableMessage: ").Append(NullableMessage).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class HealthCheckResultJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option nullableMessage = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "NullableMessage": + nullableMessage = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + return new HealthCheckResult(nullableMessage); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, healthCheckResult, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) + { + if (healthCheckResult.NullableMessageOption.IsSet) + if (healthCheckResult.NullableMessageOption.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + else + writer.WriteNull("NullableMessage"); + } + } + + /// + /// The HealthCheckResultSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(HealthCheckResult))] + public partial class HealthCheckResultSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs new file mode 100644 index 000000000000..df5fac5540b5 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -0,0 +1,196 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// IsoscelesTriangle + /// + public partial class IsoscelesTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public IsoscelesTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class IsoscelesTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class IsoscelesTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, isoscelesTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + } + } + + /// + /// The IsoscelesTriangleSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(IsoscelesTriangle))] + public partial class IsoscelesTriangleSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/List.cs new file mode 100644 index 000000000000..024998ed763a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/List.cs @@ -0,0 +1,184 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// List + /// + public partial class List : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// var123List + [JsonConstructor] + public List(Option var123List = default) + { + Var123ListOption = var123List; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Var123List + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Var123ListOption { get; private set; } + + /// + /// Gets or Sets Var123List + /// + [JsonPropertyName("123-list")] + public string? Var123List { get { return this.Var123ListOption; } set { this.Var123ListOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class List {\n"); + sb.Append(" Var123List: ").Append(Var123List).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ListJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option var123List = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "123-list": + var123List = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (var123List.IsSet && var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); + + return new List(var123List); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, list, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) + { + if (list.Var123ListOption.IsSet && list.Var123List == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + + if (list.Var123ListOption.IsSet) + writer.WriteString("123-list", list.Var123List); + } + } + + /// + /// The ListSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(List))] + public partial class ListSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs new file mode 100644 index 000000000000..e54eebdaa1dc --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// LiteralStringClass + /// + public partial class LiteralStringClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// escapedLiteralString (default to "C:\\Users\\username") + /// unescapedLiteralString (default to "C:\Users\username") + [JsonConstructor] + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) + { + EscapedLiteralStringOption = escapedLiteralString; + UnescapedLiteralStringOption = unescapedLiteralString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of EscapedLiteralString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EscapedLiteralStringOption { get; private set; } + + /// + /// Gets or Sets EscapedLiteralString + /// + [JsonPropertyName("escapedLiteralString")] + public string? EscapedLiteralString { get { return this.EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } + + /// + /// Used to track the state of UnescapedLiteralString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnescapedLiteralStringOption { get; private set; } + + /// + /// Gets or Sets UnescapedLiteralString + /// + [JsonPropertyName("unescapedLiteralString")] + public string? UnescapedLiteralString { get { return this.UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class LiteralStringClass {\n"); + sb.Append(" EscapedLiteralString: ").Append(EscapedLiteralString).Append("\n"); + sb.Append(" UnescapedLiteralString: ").Append(UnescapedLiteralString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class LiteralStringClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option escapedLiteralString = default; + Option unescapedLiteralString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "escapedLiteralString": + escapedLiteralString = new Option(utf8JsonReader.GetString()!); + break; + case "unescapedLiteralString": + unescapedLiteralString = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (escapedLiteralString.IsSet && escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, literalStringClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) + { + if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.EscapedLiteralStringOption.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + } + } + + /// + /// The LiteralStringClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(LiteralStringClass))] + public partial class LiteralStringClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Mammal.cs new file mode 100644 index 000000000000..fe273665e2c2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Mammal.cs @@ -0,0 +1,279 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mammal + /// + public partial class Mammal : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Whale whale) + { + Whale = whale; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Zebra zebra) + { + Zebra = zebra; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Mammal(Pig pig) + { + Pig = pig; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Whale + /// + public Whale? Whale { get; set; } + + /// + /// Gets or Sets Zebra + /// + public Zebra? Zebra { get; set; } + + /// + /// Gets or Sets Pig + /// + public Pig? Pig { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Mammal {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MammalJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + Pig? pig = null; + Whale? whale = null; + Zebra? zebra = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("className") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("Pig") ?? false) + { + Utf8JsonReader utf8JsonReaderPig = utf8JsonReader; + pig = JsonSerializer.Deserialize(ref utf8JsonReaderPig, jsonSerializerOptions); + } + if (discriminator?.Equals("whale") ?? false) + { + Utf8JsonReader utf8JsonReaderWhale = utf8JsonReader; + whale = JsonSerializer.Deserialize(ref utf8JsonReaderWhale, jsonSerializerOptions); + } + if (discriminator?.Equals("zebra") ?? false) + { + Utf8JsonReader utf8JsonReaderZebra = utf8JsonReader; + zebra = JsonSerializer.Deserialize(ref utf8JsonReaderZebra, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); + + if (pig != null) + return new Mammal(pig); + + if (whale != null) + return new Mammal(whale); + + if (zebra != null) + return new Mammal(zebra); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (mammal.Whale != null) + { + WhaleJsonConverter whaleJsonConverter = (WhaleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Whale.GetType())); + whaleJsonConverter.WriteProperties(writer, mammal.Whale, jsonSerializerOptions); + } + + if (mammal.Zebra != null) + { + ZebraJsonConverter zebraJsonConverter = (ZebraJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Zebra.GetType())); + zebraJsonConverter.WriteProperties(writer, mammal.Zebra, jsonSerializerOptions); + } + + if (mammal.Pig != null) + { + PigJsonConverter pigJsonConverter = (PigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mammal.Pig.GetType())); + pigJsonConverter.WriteProperties(writer, mammal.Pig, jsonSerializerOptions); + } + + WriteProperties(writer, mammal, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The MammalSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Mammal))] + public partial class MammalSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs new file mode 100644 index 000000000000..cf14472204d4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MapTest.cs @@ -0,0 +1,350 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MapTest + /// + public partial class MapTest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// directMap + /// indirectMap + /// mapMapOfString + /// mapOfEnumString + [JsonConstructor] + public MapTest(Option?> directMap = default, Option?> indirectMap = default, Option>?> mapMapOfString = default, Option?> mapOfEnumString = default) + { + DirectMapOption = directMap; + IndirectMapOption = indirectMap; + MapMapOfStringOption = mapMapOfString; + MapOfEnumStringOption = mapOfEnumString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines Inner + /// + public enum InnerEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static InnerEnum InnerEnumFromString(string value) + { + if (value.Equals("UPPER")) + return InnerEnum.UPPER; + + if (value.Equals("lower")) + return InnerEnum.Lower; + + throw new NotImplementedException($"Could not convert value to type InnerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static InnerEnum? InnerEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return InnerEnum.UPPER; + + if (value.Equals("lower")) + return InnerEnum.Lower; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string InnerEnumToJsonValue(InnerEnum? value) + { + if (value == InnerEnum.UPPER) + return "UPPER"; + + if (value == InnerEnum.Lower) + return "lower"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of DirectMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> DirectMapOption { get; private set; } + + /// + /// Gets or Sets DirectMap + /// + [JsonPropertyName("direct_map")] + public Dictionary? DirectMap { get { return this.DirectMapOption; } set { this.DirectMapOption = new(value); } } + + /// + /// Used to track the state of IndirectMap + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> IndirectMapOption { get; private set; } + + /// + /// Gets or Sets IndirectMap + /// + [JsonPropertyName("indirect_map")] + public Dictionary? IndirectMap { get { return this.IndirectMapOption; } set { this.IndirectMapOption = new(value); } } + + /// + /// Used to track the state of MapMapOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option>?> MapMapOfStringOption { get; private set; } + + /// + /// Gets or Sets MapMapOfString + /// + [JsonPropertyName("map_map_of_string")] + public Dictionary>? MapMapOfString { get { return this.MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } + + /// + /// Used to track the state of MapOfEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapOfEnumStringOption { get; private set; } + + /// + /// Gets or Sets MapOfEnumString + /// + [JsonPropertyName("map_of_enum_string")] + public Dictionary? MapOfEnumString { get { return this.MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MapTest {\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); + sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); + sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MapTestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> directMap = default; + Option?> indirectMap = default; + Option>?> mapMapOfString = default; + Option?> mapOfEnumString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "direct_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "indirect_map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_map_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapMapOfString = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "map_of_enum_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (directMap.IsSet && directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); + + if (indirectMap.IsSet && indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); + + if (mapMapOfString.IsSet && mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); + + if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); + + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mapTest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) + { + if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + + if (mapTest.DirectMapOption.IsSet) + { + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + } + if (mapTest.IndirectMapOption.IsSet) + { + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + } + if (mapTest.MapMapOfStringOption.IsSet) + { + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + } + if (mapTest.MapOfEnumStringOption.IsSet) + { + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + } + } + } + + /// + /// The MapTestSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(MapTest))] + public partial class MapTestSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixLog.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixLog.cs new file mode 100644 index 000000000000..002521973975 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixLog.cs @@ -0,0 +1,1037 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixLog + /// + public partial class MixLog : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// description + /// formulaVersionDate + /// id + /// mixDate + /// totalOverPoors + /// totalRecalculations + /// totalSkips + /// totalUnderPours + /// batchNumber + /// BrandCode is only required for non-color mixes + /// BrandId is only required for color mixes + /// BrandName is only required for color mixes + /// CategoryCode is not used anymore + /// Color is only required for color mixes + /// colorDescription + /// comment + /// commercialProductCode + /// country + /// createdBy + /// createdByFirstName + /// createdByLastName + /// deltaECalculationRepaired + /// deltaECalculationSprayout + /// ownColorVariantNumber + /// primerProductId + /// ProductId is only required for color mixes + /// ProductLineCode is only required for color mixes + /// ProductName is only required for color mixes + /// selectedVersionIndex + /// shopId + /// SomeCode is only required for color mixes + /// totalPrice + [JsonConstructor] + public MixLog(string description, DateTime formulaVersionDate, Guid id, DateTime mixDate, int totalOverPoors, int totalRecalculations, int totalSkips, int totalUnderPours, Option batchNumber = default, Option brandCode = default, Option brandId = default, Option brandName = default, Option categoryCode = default, Option color = default, Option colorDescription = default, Option comment = default, Option commercialProductCode = default, Option country = default, Option createdBy = default, Option createdByFirstName = default, Option createdByLastName = default, Option deltaECalculationRepaired = default, Option deltaECalculationSprayout = default, Option ownColorVariantNumber = default, Option primerProductId = default, Option productId = default, Option productLineCode = default, Option productName = default, Option selectedVersionIndex = default, Option shopId = default, Option someCode = default, Option totalPrice = default) + { + Description = description; + FormulaVersionDate = formulaVersionDate; + Id = id; + MixDate = mixDate; + TotalOverPoors = totalOverPoors; + TotalRecalculations = totalRecalculations; + TotalSkips = totalSkips; + TotalUnderPours = totalUnderPours; + BatchNumberOption = batchNumber; + BrandCodeOption = brandCode; + BrandIdOption = brandId; + BrandNameOption = brandName; + CategoryCodeOption = categoryCode; + ColorOption = color; + ColorDescriptionOption = colorDescription; + CommentOption = comment; + CommercialProductCodeOption = commercialProductCode; + CountryOption = country; + CreatedByOption = createdBy; + CreatedByFirstNameOption = createdByFirstName; + CreatedByLastNameOption = createdByLastName; + DeltaECalculationRepairedOption = deltaECalculationRepaired; + DeltaECalculationSprayoutOption = deltaECalculationSprayout; + OwnColorVariantNumberOption = ownColorVariantNumber; + PrimerProductIdOption = primerProductId; + ProductIdOption = productId; + ProductLineCodeOption = productLineCode; + ProductNameOption = productName; + SelectedVersionIndexOption = selectedVersionIndex; + ShopIdOption = shopId; + SomeCodeOption = someCode; + TotalPriceOption = totalPrice; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Description + /// + [JsonPropertyName("description")] + public string Description { get; set; } + + /// + /// Gets or Sets FormulaVersionDate + /// + [JsonPropertyName("formulaVersionDate")] + public DateTime FormulaVersionDate { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Guid Id { get; set; } + + /// + /// Gets or Sets MixDate + /// + [JsonPropertyName("mixDate")] + public DateTime MixDate { get; set; } + + /// + /// Gets or Sets TotalOverPoors + /// + [JsonPropertyName("totalOverPoors")] + public int TotalOverPoors { get; set; } + + /// + /// Gets or Sets TotalRecalculations + /// + [JsonPropertyName("totalRecalculations")] + public int TotalRecalculations { get; set; } + + /// + /// Gets or Sets TotalSkips + /// + [JsonPropertyName("totalSkips")] + public int TotalSkips { get; set; } + + /// + /// Gets or Sets TotalUnderPours + /// + [JsonPropertyName("totalUnderPours")] + public int TotalUnderPours { get; set; } + + /// + /// Used to track the state of BatchNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BatchNumberOption { get; private set; } + + /// + /// Gets or Sets BatchNumber + /// + [JsonPropertyName("batchNumber")] + public string? BatchNumber { get { return this.BatchNumberOption; } set { this.BatchNumberOption = new(value); } } + + /// + /// Used to track the state of BrandCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandCodeOption { get; private set; } + + /// + /// BrandCode is only required for non-color mixes + /// + /// BrandCode is only required for non-color mixes + [JsonPropertyName("brandCode")] + public string? BrandCode { get { return this.BrandCodeOption; } set { this.BrandCodeOption = new(value); } } + + /// + /// Used to track the state of BrandId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandIdOption { get; private set; } + + /// + /// BrandId is only required for color mixes + /// + /// BrandId is only required for color mixes + [JsonPropertyName("brandId")] + public string? BrandId { get { return this.BrandIdOption; } set { this.BrandIdOption = new(value); } } + + /// + /// Used to track the state of BrandName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BrandNameOption { get; private set; } + + /// + /// BrandName is only required for color mixes + /// + /// BrandName is only required for color mixes + [JsonPropertyName("brandName")] + public string? BrandName { get { return this.BrandNameOption; } set { this.BrandNameOption = new(value); } } + + /// + /// Used to track the state of CategoryCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CategoryCodeOption { get; private set; } + + /// + /// CategoryCode is not used anymore + /// + /// CategoryCode is not used anymore + [JsonPropertyName("categoryCode")] + public string? CategoryCode { get { return this.CategoryCodeOption; } set { this.CategoryCodeOption = new(value); } } + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorOption { get; private set; } + + /// + /// Color is only required for color mixes + /// + /// Color is only required for color mixes + [JsonPropertyName("color")] + public string? Color { get { return this.ColorOption; } set { this.ColorOption = new(value); } } + + /// + /// Used to track the state of ColorDescription + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ColorDescriptionOption { get; private set; } + + /// + /// Gets or Sets ColorDescription + /// + [JsonPropertyName("colorDescription")] + public string? ColorDescription { get { return this.ColorDescriptionOption; } set { this.ColorDescriptionOption = new(value); } } + + /// + /// Used to track the state of Comment + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CommentOption { get; private set; } + + /// + /// Gets or Sets Comment + /// + [JsonPropertyName("comment")] + public string? Comment { get { return this.CommentOption; } set { this.CommentOption = new(value); } } + + /// + /// Used to track the state of CommercialProductCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CommercialProductCodeOption { get; private set; } + + /// + /// Gets or Sets CommercialProductCode + /// + [JsonPropertyName("commercialProductCode")] + public string? CommercialProductCode { get { return this.CommercialProductCodeOption; } set { this.CommercialProductCodeOption = new(value); } } + + /// + /// Used to track the state of Country + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CountryOption { get; private set; } + + /// + /// Gets or Sets Country + /// + [JsonPropertyName("country")] + public string? Country { get { return this.CountryOption; } set { this.CountryOption = new(value); } } + + /// + /// Used to track the state of CreatedBy + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByOption { get; private set; } + + /// + /// Gets or Sets CreatedBy + /// + [JsonPropertyName("createdBy")] + public string? CreatedBy { get { return this.CreatedByOption; } set { this.CreatedByOption = new(value); } } + + /// + /// Used to track the state of CreatedByFirstName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByFirstNameOption { get; private set; } + + /// + /// Gets or Sets CreatedByFirstName + /// + [JsonPropertyName("createdByFirstName")] + public string? CreatedByFirstName { get { return this.CreatedByFirstNameOption; } set { this.CreatedByFirstNameOption = new(value); } } + + /// + /// Used to track the state of CreatedByLastName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CreatedByLastNameOption { get; private set; } + + /// + /// Gets or Sets CreatedByLastName + /// + [JsonPropertyName("createdByLastName")] + public string? CreatedByLastName { get { return this.CreatedByLastNameOption; } set { this.CreatedByLastNameOption = new(value); } } + + /// + /// Used to track the state of DeltaECalculationRepaired + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeltaECalculationRepairedOption { get; private set; } + + /// + /// Gets or Sets DeltaECalculationRepaired + /// + [JsonPropertyName("deltaECalculationRepaired")] + public string? DeltaECalculationRepaired { get { return this.DeltaECalculationRepairedOption; } set { this.DeltaECalculationRepairedOption = new(value); } } + + /// + /// Used to track the state of DeltaECalculationSprayout + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeltaECalculationSprayoutOption { get; private set; } + + /// + /// Gets or Sets DeltaECalculationSprayout + /// + [JsonPropertyName("deltaECalculationSprayout")] + public string? DeltaECalculationSprayout { get { return this.DeltaECalculationSprayoutOption; } set { this.DeltaECalculationSprayoutOption = new(value); } } + + /// + /// Used to track the state of OwnColorVariantNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option OwnColorVariantNumberOption { get; private set; } + + /// + /// Gets or Sets OwnColorVariantNumber + /// + [JsonPropertyName("ownColorVariantNumber")] + public int? OwnColorVariantNumber { get { return this.OwnColorVariantNumberOption; } set { this.OwnColorVariantNumberOption = new(value); } } + + /// + /// Used to track the state of PrimerProductId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PrimerProductIdOption { get; private set; } + + /// + /// Gets or Sets PrimerProductId + /// + [JsonPropertyName("primerProductId")] + public string? PrimerProductId { get { return this.PrimerProductIdOption; } set { this.PrimerProductIdOption = new(value); } } + + /// + /// Used to track the state of ProductId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductIdOption { get; private set; } + + /// + /// ProductId is only required for color mixes + /// + /// ProductId is only required for color mixes + [JsonPropertyName("productId")] + public string? ProductId { get { return this.ProductIdOption; } set { this.ProductIdOption = new(value); } } + + /// + /// Used to track the state of ProductLineCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductLineCodeOption { get; private set; } + + /// + /// ProductLineCode is only required for color mixes + /// + /// ProductLineCode is only required for color mixes + [JsonPropertyName("productLineCode")] + public string? ProductLineCode { get { return this.ProductLineCodeOption; } set { this.ProductLineCodeOption = new(value); } } + + /// + /// Used to track the state of ProductName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ProductNameOption { get; private set; } + + /// + /// ProductName is only required for color mixes + /// + /// ProductName is only required for color mixes + [JsonPropertyName("productName")] + public string? ProductName { get { return this.ProductNameOption; } set { this.ProductNameOption = new(value); } } + + /// + /// Used to track the state of SelectedVersionIndex + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SelectedVersionIndexOption { get; private set; } + + /// + /// Gets or Sets SelectedVersionIndex + /// + [JsonPropertyName("selectedVersionIndex")] + public int? SelectedVersionIndex { get { return this.SelectedVersionIndexOption; } set { this.SelectedVersionIndexOption = new(value); } } + + /// + /// Used to track the state of ShopId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShopIdOption { get; private set; } + + /// + /// Gets or Sets ShopId + /// + [JsonPropertyName("shopId")] + public Guid? ShopId { get { return this.ShopIdOption; } set { this.ShopIdOption = new(value); } } + + /// + /// Used to track the state of SomeCode + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SomeCodeOption { get; private set; } + + /// + /// SomeCode is only required for color mixes + /// + /// SomeCode is only required for color mixes + [JsonPropertyName("someCode")] + public string? SomeCode { get { return this.SomeCodeOption; } set { this.SomeCodeOption = new(value); } } + + /// + /// Used to track the state of TotalPrice + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TotalPriceOption { get; private set; } + + /// + /// Gets or Sets TotalPrice + /// + [JsonPropertyName("totalPrice")] + public float? TotalPrice { get { return this.TotalPriceOption; } set { this.TotalPriceOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixLog {\n"); + sb.Append(" Description: ").Append(Description).Append("\n"); + sb.Append(" FormulaVersionDate: ").Append(FormulaVersionDate).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" MixDate: ").Append(MixDate).Append("\n"); + sb.Append(" TotalOverPoors: ").Append(TotalOverPoors).Append("\n"); + sb.Append(" TotalRecalculations: ").Append(TotalRecalculations).Append("\n"); + sb.Append(" TotalSkips: ").Append(TotalSkips).Append("\n"); + sb.Append(" TotalUnderPours: ").Append(TotalUnderPours).Append("\n"); + sb.Append(" BatchNumber: ").Append(BatchNumber).Append("\n"); + sb.Append(" BrandCode: ").Append(BrandCode).Append("\n"); + sb.Append(" BrandId: ").Append(BrandId).Append("\n"); + sb.Append(" BrandName: ").Append(BrandName).Append("\n"); + sb.Append(" CategoryCode: ").Append(CategoryCode).Append("\n"); + sb.Append(" Color: ").Append(Color).Append("\n"); + sb.Append(" ColorDescription: ").Append(ColorDescription).Append("\n"); + sb.Append(" Comment: ").Append(Comment).Append("\n"); + sb.Append(" CommercialProductCode: ").Append(CommercialProductCode).Append("\n"); + sb.Append(" Country: ").Append(Country).Append("\n"); + sb.Append(" CreatedBy: ").Append(CreatedBy).Append("\n"); + sb.Append(" CreatedByFirstName: ").Append(CreatedByFirstName).Append("\n"); + sb.Append(" CreatedByLastName: ").Append(CreatedByLastName).Append("\n"); + sb.Append(" DeltaECalculationRepaired: ").Append(DeltaECalculationRepaired).Append("\n"); + sb.Append(" DeltaECalculationSprayout: ").Append(DeltaECalculationSprayout).Append("\n"); + sb.Append(" OwnColorVariantNumber: ").Append(OwnColorVariantNumber).Append("\n"); + sb.Append(" PrimerProductId: ").Append(PrimerProductId).Append("\n"); + sb.Append(" ProductId: ").Append(ProductId).Append("\n"); + sb.Append(" ProductLineCode: ").Append(ProductLineCode).Append("\n"); + sb.Append(" ProductName: ").Append(ProductName).Append("\n"); + sb.Append(" SelectedVersionIndex: ").Append(SelectedVersionIndex).Append("\n"); + sb.Append(" ShopId: ").Append(ShopId).Append("\n"); + sb.Append(" SomeCode: ").Append(SomeCode).Append("\n"); + sb.Append(" TotalPrice: ").Append(TotalPrice).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixLogJsonConverter : JsonConverter + { + /// + /// The format to use to serialize FormulaVersionDate + /// + public static string FormulaVersionDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize MixDate + /// + public static string MixDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixLog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option description = default; + Option formulaVersionDate = default; + Option id = default; + Option mixDate = default; + Option totalOverPoors = default; + Option totalRecalculations = default; + Option totalSkips = default; + Option totalUnderPours = default; + Option batchNumber = default; + Option brandCode = default; + Option brandId = default; + Option brandName = default; + Option categoryCode = default; + Option color = default; + Option colorDescription = default; + Option comment = default; + Option commercialProductCode = default; + Option country = default; + Option createdBy = default; + Option createdByFirstName = default; + Option createdByLastName = default; + Option deltaECalculationRepaired = default; + Option deltaECalculationSprayout = default; + Option ownColorVariantNumber = default; + Option primerProductId = default; + Option productId = default; + Option productLineCode = default; + Option productName = default; + Option selectedVersionIndex = default; + Option shopId = default; + Option someCode = default; + Option totalPrice = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "description": + description = new Option(utf8JsonReader.GetString()!); + break; + case "formulaVersionDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + formulaVersionDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetGuid()); + break; + case "mixDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + mixDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "totalOverPoors": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalOverPoors = new Option(utf8JsonReader.GetInt32()); + break; + case "totalRecalculations": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalRecalculations = new Option(utf8JsonReader.GetInt32()); + break; + case "totalSkips": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalSkips = new Option(utf8JsonReader.GetInt32()); + break; + case "totalUnderPours": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalUnderPours = new Option(utf8JsonReader.GetInt32()); + break; + case "batchNumber": + batchNumber = new Option(utf8JsonReader.GetString()!); + break; + case "brandCode": + brandCode = new Option(utf8JsonReader.GetString()!); + break; + case "brandId": + brandId = new Option(utf8JsonReader.GetString()!); + break; + case "brandName": + brandName = new Option(utf8JsonReader.GetString()!); + break; + case "categoryCode": + categoryCode = new Option(utf8JsonReader.GetString()!); + break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; + case "colorDescription": + colorDescription = new Option(utf8JsonReader.GetString()!); + break; + case "comment": + comment = new Option(utf8JsonReader.GetString()!); + break; + case "commercialProductCode": + commercialProductCode = new Option(utf8JsonReader.GetString()!); + break; + case "country": + country = new Option(utf8JsonReader.GetString()!); + break; + case "createdBy": + createdBy = new Option(utf8JsonReader.GetString()!); + break; + case "createdByFirstName": + createdByFirstName = new Option(utf8JsonReader.GetString()!); + break; + case "createdByLastName": + createdByLastName = new Option(utf8JsonReader.GetString()!); + break; + case "deltaECalculationRepaired": + deltaECalculationRepaired = new Option(utf8JsonReader.GetString()!); + break; + case "deltaECalculationSprayout": + deltaECalculationSprayout = new Option(utf8JsonReader.GetString()!); + break; + case "ownColorVariantNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + ownColorVariantNumber = new Option(utf8JsonReader.GetInt32()); + break; + case "primerProductId": + primerProductId = new Option(utf8JsonReader.GetString()!); + break; + case "productId": + productId = new Option(utf8JsonReader.GetString()!); + break; + case "productLineCode": + productLineCode = new Option(utf8JsonReader.GetString()!); + break; + case "productName": + productName = new Option(utf8JsonReader.GetString()!); + break; + case "selectedVersionIndex": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + selectedVersionIndex = new Option(utf8JsonReader.GetInt32()); + break; + case "shopId": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shopId = new Option(utf8JsonReader.GetGuid()); + break; + case "someCode": + someCode = new Option(utf8JsonReader.GetString()); + break; + case "totalPrice": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + totalPrice = new Option((float)utf8JsonReader.GetDouble()); + break; + default: + break; + } + } + } + + if (!description.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(description)); + + if (!formulaVersionDate.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(formulaVersionDate)); + + if (!id.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(id)); + + if (!mixDate.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(mixDate)); + + if (!totalOverPoors.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalOverPoors)); + + if (!totalRecalculations.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalRecalculations)); + + if (!totalSkips.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalSkips)); + + if (!totalUnderPours.IsSet) + throw new ArgumentException("Property is required for class MixLog.", nameof(totalUnderPours)); + + if (description.IsSet && description.Value == null) + throw new ArgumentNullException(nameof(description), "Property is not nullable for class MixLog."); + + if (formulaVersionDate.IsSet && formulaVersionDate.Value == null) + throw new ArgumentNullException(nameof(formulaVersionDate), "Property is not nullable for class MixLog."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixLog."); + + if (mixDate.IsSet && mixDate.Value == null) + throw new ArgumentNullException(nameof(mixDate), "Property is not nullable for class MixLog."); + + if (totalOverPoors.IsSet && totalOverPoors.Value == null) + throw new ArgumentNullException(nameof(totalOverPoors), "Property is not nullable for class MixLog."); + + if (totalRecalculations.IsSet && totalRecalculations.Value == null) + throw new ArgumentNullException(nameof(totalRecalculations), "Property is not nullable for class MixLog."); + + if (totalSkips.IsSet && totalSkips.Value == null) + throw new ArgumentNullException(nameof(totalSkips), "Property is not nullable for class MixLog."); + + if (totalUnderPours.IsSet && totalUnderPours.Value == null) + throw new ArgumentNullException(nameof(totalUnderPours), "Property is not nullable for class MixLog."); + + if (batchNumber.IsSet && batchNumber.Value == null) + throw new ArgumentNullException(nameof(batchNumber), "Property is not nullable for class MixLog."); + + if (brandCode.IsSet && brandCode.Value == null) + throw new ArgumentNullException(nameof(brandCode), "Property is not nullable for class MixLog."); + + if (brandId.IsSet && brandId.Value == null) + throw new ArgumentNullException(nameof(brandId), "Property is not nullable for class MixLog."); + + if (brandName.IsSet && brandName.Value == null) + throw new ArgumentNullException(nameof(brandName), "Property is not nullable for class MixLog."); + + if (categoryCode.IsSet && categoryCode.Value == null) + throw new ArgumentNullException(nameof(categoryCode), "Property is not nullable for class MixLog."); + + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class MixLog."); + + if (colorDescription.IsSet && colorDescription.Value == null) + throw new ArgumentNullException(nameof(colorDescription), "Property is not nullable for class MixLog."); + + if (comment.IsSet && comment.Value == null) + throw new ArgumentNullException(nameof(comment), "Property is not nullable for class MixLog."); + + if (commercialProductCode.IsSet && commercialProductCode.Value == null) + throw new ArgumentNullException(nameof(commercialProductCode), "Property is not nullable for class MixLog."); + + if (country.IsSet && country.Value == null) + throw new ArgumentNullException(nameof(country), "Property is not nullable for class MixLog."); + + if (createdBy.IsSet && createdBy.Value == null) + throw new ArgumentNullException(nameof(createdBy), "Property is not nullable for class MixLog."); + + if (createdByFirstName.IsSet && createdByFirstName.Value == null) + throw new ArgumentNullException(nameof(createdByFirstName), "Property is not nullable for class MixLog."); + + if (createdByLastName.IsSet && createdByLastName.Value == null) + throw new ArgumentNullException(nameof(createdByLastName), "Property is not nullable for class MixLog."); + + if (deltaECalculationRepaired.IsSet && deltaECalculationRepaired.Value == null) + throw new ArgumentNullException(nameof(deltaECalculationRepaired), "Property is not nullable for class MixLog."); + + if (deltaECalculationSprayout.IsSet && deltaECalculationSprayout.Value == null) + throw new ArgumentNullException(nameof(deltaECalculationSprayout), "Property is not nullable for class MixLog."); + + if (primerProductId.IsSet && primerProductId.Value == null) + throw new ArgumentNullException(nameof(primerProductId), "Property is not nullable for class MixLog."); + + if (productId.IsSet && productId.Value == null) + throw new ArgumentNullException(nameof(productId), "Property is not nullable for class MixLog."); + + if (productLineCode.IsSet && productLineCode.Value == null) + throw new ArgumentNullException(nameof(productLineCode), "Property is not nullable for class MixLog."); + + if (productName.IsSet && productName.Value == null) + throw new ArgumentNullException(nameof(productName), "Property is not nullable for class MixLog."); + + if (selectedVersionIndex.IsSet && selectedVersionIndex.Value == null) + throw new ArgumentNullException(nameof(selectedVersionIndex), "Property is not nullable for class MixLog."); + + if (shopId.IsSet && shopId.Value == null) + throw new ArgumentNullException(nameof(shopId), "Property is not nullable for class MixLog."); + + return new MixLog(description.Value!, formulaVersionDate.Value!.Value!, id.Value!.Value!, mixDate.Value!.Value!, totalOverPoors.Value!.Value!, totalRecalculations.Value!.Value!, totalSkips.Value!.Value!, totalUnderPours.Value!.Value!, batchNumber, brandCode, brandId, brandName, categoryCode, color, colorDescription, comment, commercialProductCode, country, createdBy, createdByFirstName, createdByLastName, deltaECalculationRepaired, deltaECalculationSprayout, ownColorVariantNumber, primerProductId, productId, productLineCode, productName, selectedVersionIndex, shopId, someCode, totalPrice); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixLog, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixLog mixLog, JsonSerializerOptions jsonSerializerOptions) + { + if (mixLog.Description == null) + throw new ArgumentNullException(nameof(mixLog.Description), "Property is required for class MixLog."); + + if (mixLog.BatchNumberOption.IsSet && mixLog.BatchNumber == null) + throw new ArgumentNullException(nameof(mixLog.BatchNumber), "Property is required for class MixLog."); + + if (mixLog.BrandCodeOption.IsSet && mixLog.BrandCode == null) + throw new ArgumentNullException(nameof(mixLog.BrandCode), "Property is required for class MixLog."); + + if (mixLog.BrandIdOption.IsSet && mixLog.BrandId == null) + throw new ArgumentNullException(nameof(mixLog.BrandId), "Property is required for class MixLog."); + + if (mixLog.BrandNameOption.IsSet && mixLog.BrandName == null) + throw new ArgumentNullException(nameof(mixLog.BrandName), "Property is required for class MixLog."); + + if (mixLog.CategoryCodeOption.IsSet && mixLog.CategoryCode == null) + throw new ArgumentNullException(nameof(mixLog.CategoryCode), "Property is required for class MixLog."); + + if (mixLog.ColorOption.IsSet && mixLog.Color == null) + throw new ArgumentNullException(nameof(mixLog.Color), "Property is required for class MixLog."); + + if (mixLog.ColorDescriptionOption.IsSet && mixLog.ColorDescription == null) + throw new ArgumentNullException(nameof(mixLog.ColorDescription), "Property is required for class MixLog."); + + if (mixLog.CommentOption.IsSet && mixLog.Comment == null) + throw new ArgumentNullException(nameof(mixLog.Comment), "Property is required for class MixLog."); + + if (mixLog.CommercialProductCodeOption.IsSet && mixLog.CommercialProductCode == null) + throw new ArgumentNullException(nameof(mixLog.CommercialProductCode), "Property is required for class MixLog."); + + if (mixLog.CountryOption.IsSet && mixLog.Country == null) + throw new ArgumentNullException(nameof(mixLog.Country), "Property is required for class MixLog."); + + if (mixLog.CreatedByOption.IsSet && mixLog.CreatedBy == null) + throw new ArgumentNullException(nameof(mixLog.CreatedBy), "Property is required for class MixLog."); + + if (mixLog.CreatedByFirstNameOption.IsSet && mixLog.CreatedByFirstName == null) + throw new ArgumentNullException(nameof(mixLog.CreatedByFirstName), "Property is required for class MixLog."); + + if (mixLog.CreatedByLastNameOption.IsSet && mixLog.CreatedByLastName == null) + throw new ArgumentNullException(nameof(mixLog.CreatedByLastName), "Property is required for class MixLog."); + + if (mixLog.DeltaECalculationRepairedOption.IsSet && mixLog.DeltaECalculationRepaired == null) + throw new ArgumentNullException(nameof(mixLog.DeltaECalculationRepaired), "Property is required for class MixLog."); + + if (mixLog.DeltaECalculationSprayoutOption.IsSet && mixLog.DeltaECalculationSprayout == null) + throw new ArgumentNullException(nameof(mixLog.DeltaECalculationSprayout), "Property is required for class MixLog."); + + if (mixLog.PrimerProductIdOption.IsSet && mixLog.PrimerProductId == null) + throw new ArgumentNullException(nameof(mixLog.PrimerProductId), "Property is required for class MixLog."); + + if (mixLog.ProductIdOption.IsSet && mixLog.ProductId == null) + throw new ArgumentNullException(nameof(mixLog.ProductId), "Property is required for class MixLog."); + + if (mixLog.ProductLineCodeOption.IsSet && mixLog.ProductLineCode == null) + throw new ArgumentNullException(nameof(mixLog.ProductLineCode), "Property is required for class MixLog."); + + if (mixLog.ProductNameOption.IsSet && mixLog.ProductName == null) + throw new ArgumentNullException(nameof(mixLog.ProductName), "Property is required for class MixLog."); + + writer.WriteString("description", mixLog.Description); + + writer.WriteString("formulaVersionDate", mixLog.FormulaVersionDate.ToString(FormulaVersionDateFormat)); + + writer.WriteString("id", mixLog.Id); + + writer.WriteString("mixDate", mixLog.MixDate.ToString(MixDateFormat)); + + writer.WriteNumber("totalOverPoors", mixLog.TotalOverPoors); + + writer.WriteNumber("totalRecalculations", mixLog.TotalRecalculations); + + writer.WriteNumber("totalSkips", mixLog.TotalSkips); + + writer.WriteNumber("totalUnderPours", mixLog.TotalUnderPours); + + if (mixLog.BatchNumberOption.IsSet) + writer.WriteString("batchNumber", mixLog.BatchNumber); + + if (mixLog.BrandCodeOption.IsSet) + writer.WriteString("brandCode", mixLog.BrandCode); + + if (mixLog.BrandIdOption.IsSet) + writer.WriteString("brandId", mixLog.BrandId); + + if (mixLog.BrandNameOption.IsSet) + writer.WriteString("brandName", mixLog.BrandName); + + if (mixLog.CategoryCodeOption.IsSet) + writer.WriteString("categoryCode", mixLog.CategoryCode); + + if (mixLog.ColorOption.IsSet) + writer.WriteString("color", mixLog.Color); + + if (mixLog.ColorDescriptionOption.IsSet) + writer.WriteString("colorDescription", mixLog.ColorDescription); + + if (mixLog.CommentOption.IsSet) + writer.WriteString("comment", mixLog.Comment); + + if (mixLog.CommercialProductCodeOption.IsSet) + writer.WriteString("commercialProductCode", mixLog.CommercialProductCode); + + if (mixLog.CountryOption.IsSet) + writer.WriteString("country", mixLog.Country); + + if (mixLog.CreatedByOption.IsSet) + writer.WriteString("createdBy", mixLog.CreatedBy); + + if (mixLog.CreatedByFirstNameOption.IsSet) + writer.WriteString("createdByFirstName", mixLog.CreatedByFirstName); + + if (mixLog.CreatedByLastNameOption.IsSet) + writer.WriteString("createdByLastName", mixLog.CreatedByLastName); + + if (mixLog.DeltaECalculationRepairedOption.IsSet) + writer.WriteString("deltaECalculationRepaired", mixLog.DeltaECalculationRepaired); + + if (mixLog.DeltaECalculationSprayoutOption.IsSet) + writer.WriteString("deltaECalculationSprayout", mixLog.DeltaECalculationSprayout); + + if (mixLog.OwnColorVariantNumberOption.IsSet) + if (mixLog.OwnColorVariantNumberOption.Value != null) + writer.WriteNumber("ownColorVariantNumber", mixLog.OwnColorVariantNumberOption.Value!.Value); + else + writer.WriteNull("ownColorVariantNumber"); + + if (mixLog.PrimerProductIdOption.IsSet) + writer.WriteString("primerProductId", mixLog.PrimerProductId); + + if (mixLog.ProductIdOption.IsSet) + writer.WriteString("productId", mixLog.ProductId); + + if (mixLog.ProductLineCodeOption.IsSet) + writer.WriteString("productLineCode", mixLog.ProductLineCode); + + if (mixLog.ProductNameOption.IsSet) + writer.WriteString("productName", mixLog.ProductName); + + if (mixLog.SelectedVersionIndexOption.IsSet) + writer.WriteNumber("selectedVersionIndex", mixLog.SelectedVersionIndexOption.Value!.Value); + + if (mixLog.ShopIdOption.IsSet) + writer.WriteString("shopId", mixLog.ShopIdOption.Value!.Value); + + if (mixLog.SomeCodeOption.IsSet) + if (mixLog.SomeCodeOption.Value != null) + writer.WriteString("someCode", mixLog.SomeCode); + else + writer.WriteNull("someCode"); + + if (mixLog.TotalPriceOption.IsSet) + if (mixLog.TotalPriceOption.Value != null) + writer.WriteNumber("totalPrice", mixLog.TotalPriceOption.Value!.Value); + else + writer.WriteNull("totalPrice"); + } + } + + /// + /// The MixLogSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(MixLog))] + public partial class MixLogSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs new file mode 100644 index 000000000000..cb6c05a7c77f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOf.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedAnyOf + /// + public partial class MixedAnyOf : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// content + [JsonConstructor] + public MixedAnyOf(Option content = default) + { + ContentOption = content; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Content + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ContentOption { get; private set; } + + /// + /// Gets or Sets Content + /// + [JsonPropertyName("content")] + public MixedAnyOfContent? Content { get { return this.ContentOption; } set { this.ContentOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedAnyOf {\n"); + sb.Append(" Content: ").Append(Content).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedAnyOfJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedAnyOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option content = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "content": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (content.IsSet && content.Value == null) + throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedAnyOf."); + + return new MixedAnyOf(content); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedAnyOf, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedAnyOf mixedAnyOf, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedAnyOf.ContentOption.IsSet && mixedAnyOf.Content == null) + throw new ArgumentNullException(nameof(mixedAnyOf.Content), "Property is required for class MixedAnyOf."); + + if (mixedAnyOf.ContentOption.IsSet) + { + writer.WritePropertyName("content"); + JsonSerializer.Serialize(writer, mixedAnyOf.Content, jsonSerializerOptions); + } + } + } + + /// + /// The MixedAnyOfSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(MixedAnyOf))] + public partial class MixedAnyOfSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs new file mode 100644 index 000000000000..72287b1d1b45 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs @@ -0,0 +1,293 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mixed anyOf types for testing + /// + public partial class MixedAnyOfContent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + public MixedAnyOfContent(Option @string, Option @bool, Option @int, Option @decimal, Option mixedSubId) + { + StringOption = @string; + BoolOption = @bool; + IntOption = @int; + DecimalOption = @decimal; + MixedSubIdOption = mixedSubId; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of String + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringOption { get; private set; } + + /// + /// Gets or Sets String + /// + public string? String { get { return this.StringOption; } set { this.StringOption = new(value); } } + + /// + /// Used to track the state of Bool + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BoolOption { get; private set; } + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get { return this.BoolOption; } set { this.BoolOption = new(value); } } + + /// + /// Used to track the state of Int + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntOption { get; private set; } + + /// + /// Gets or Sets Int + /// + public int? Int { get { return this.IntOption; } set { this.IntOption = new(value); } } + + /// + /// Used to track the state of Decimal + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DecimalOption { get; private set; } + + /// + /// Gets or Sets Decimal + /// + public decimal? Decimal { get { return this.DecimalOption; } set { this.DecimalOption = new(value); } } + + /// + /// Used to track the state of MixedSubId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MixedSubIdOption { get; private set; } + + /// + /// Gets or Sets MixedSubId + /// + public MixedSubId? MixedSubId { get { return this.MixedSubIdOption; } set { this.MixedSubIdOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedAnyOfContent {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedAnyOfContentJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedAnyOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string? varString = default; + bool? varBool = default; + int? varInt = default; + decimal? varDecimal = default; + MixedSubId? mixedSubId = default; + + Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; + while (utf8JsonReaderAnyOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderAnyOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderAnyOf.CurrentDepth) + break; + + if (utf8JsonReaderAnyOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderAnyOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderInt = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt); + + Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal); + + Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + Option varStringParsedValue = varString == null + ? default + : new Option(varString); + Option varBoolParsedValue = varBool == null + ? default + : new Option(varBool); + Option varIntParsedValue = varInt == null + ? default + : new Option(varInt); + Option varDecimalParsedValue = varDecimal == null + ? default + : new Option(varDecimal); + Option mixedSubIdParsedValue = mixedSubId == null + ? default + : new Option(mixedSubId); + + return new MixedAnyOfContent(varStringParsedValue, varBoolParsedValue, varIntParsedValue, varDecimalParsedValue, mixedSubIdParsedValue); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (mixedAnyOfContent.StringOption.IsSet && mixedAnyOfContent.StringOption.Value != null) + writer.WriteString("content", mixedAnyOfContent.StringOption.Value); + + if (mixedAnyOfContent.BoolOption.IsSet && mixedAnyOfContent.BoolOption.Value != null) + writer.WriteBoolean("content", mixedAnyOfContent.BoolOption.Value.Value); + + if (mixedAnyOfContent.IntOption.IsSet && mixedAnyOfContent.IntOption.Value != null) + writer.WriteNumber("content", mixedAnyOfContent.IntOption.Value.Value); + + if (mixedAnyOfContent.DecimalOption.IsSet && mixedAnyOfContent.DecimalOption.Value != null) + writer.WriteNumber("content", mixedAnyOfContent.DecimalOption.Value.Value); + + if (mixedAnyOfContent.MixedSubIdOption.IsSet && mixedAnyOfContent.MixedSubIdOption.Value != null) + { + MixedSubIdJsonConverter MixedSubIdJsonConverter = (MixedSubIdJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(mixedAnyOfContent.MixedSubIdOption.Value.GetType())); + MixedSubIdJsonConverter.WriteProperties(writer, mixedAnyOfContent.MixedSubIdOption.Value, jsonSerializerOptions); + } + + WriteProperties(writer, mixedAnyOfContent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedAnyOfContent mixedAnyOfContent, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The MixedAnyOfContentSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(MixedAnyOfContent))] + public partial class MixedAnyOfContentSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs new file mode 100644 index 000000000000..2f8ac2dc1d53 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOf.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedOneOf + /// + public partial class MixedOneOf : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// content + [JsonConstructor] + public MixedOneOf(Option content = default) + { + ContentOption = content; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Content + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ContentOption { get; private set; } + + /// + /// Gets or Sets Content + /// + [JsonPropertyName("content")] + public MixedOneOfContent? Content { get { return this.ContentOption; } set { this.ContentOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedOneOf {\n"); + sb.Append(" Content: ").Append(Content).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedOneOfJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedOneOf Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option content = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "content": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + content = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (content.IsSet && content.Value == null) + throw new ArgumentNullException(nameof(content), "Property is not nullable for class MixedOneOf."); + + return new MixedOneOf(content); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedOneOf, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedOneOf mixedOneOf, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedOneOf.ContentOption.IsSet && mixedOneOf.Content == null) + throw new ArgumentNullException(nameof(mixedOneOf.Content), "Property is required for class MixedOneOf."); + + if (mixedOneOf.ContentOption.IsSet) + { + writer.WritePropertyName("content"); + JsonSerializer.Serialize(writer, mixedOneOf.Content, jsonSerializerOptions); + } + } + } + + /// + /// The MixedOneOfSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(MixedOneOf))] + public partial class MixedOneOfSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOfContent.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOfContent.cs new file mode 100644 index 000000000000..8ea30fde6f80 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedOneOfContent.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Mixed oneOf types for testing + /// + public partial class MixedOneOfContent : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(string @string) + { + String = @string; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(bool @bool) + { + Bool = @bool; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(int @int) + { + Int = @int; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(decimal @decimal) + { + Decimal = @decimal; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public MixedOneOfContent(MixedSubId mixedSubId) + { + MixedSubId = mixedSubId; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets String + /// + public string? String { get; set; } + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get; set; } + + /// + /// Gets or Sets Int + /// + public int? Int { get; set; } + + /// + /// Gets or Sets Decimal + /// + public decimal? Decimal { get; set; } + + /// + /// Gets or Sets MixedSubId + /// + public MixedSubId? MixedSubId { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedOneOfContent {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedOneOfContentJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedOneOfContent Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string? varString = default; + bool? varBool = default; + int? varInt = default; + decimal? varDecimal = default; + MixedSubId? mixedSubId = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderInt = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderInt, jsonSerializerOptions, out varInt); + + Utf8JsonReader utf8JsonReaderDecimal = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderDecimal, jsonSerializerOptions, out varDecimal); + + Utf8JsonReader utf8JsonReaderMixedSubId = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderMixedSubId, jsonSerializerOptions, out mixedSubId); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varString != null) + return new MixedOneOfContent(varString); + + if (varBool != null) + return new MixedOneOfContent(varBool.Value); + + if (varInt != null) + return new MixedOneOfContent(varInt.Value); + + if (varDecimal != null) + return new MixedOneOfContent(varDecimal.Value); + + if (mixedSubId != null) + return new MixedOneOfContent(mixedSubId); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedOneOfContent, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedOneOfContent mixedOneOfContent, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The MixedOneOfContentSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(MixedOneOfContent))] + public partial class MixedOneOfContentSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs new file mode 100644 index 000000000000..a9e28c2f3e83 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedPropertiesAndAdditionalPropertiesClass + /// + public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// dateTime + /// map + /// uuid + /// uuidWithPattern + [JsonConstructor] + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option?> map = default, Option uuid = default, Option uuidWithPattern = default) + { + DateTimeOption = dateTime; + MapOption = map; + UuidOption = uuid; + UuidWithPatternOption = uuidWithPattern; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DateTimeOption { get; private set; } + + /// + /// Gets or Sets DateTime + /// + [JsonPropertyName("dateTime")] + public DateTime? DateTime { get { return this.DateTimeOption; } set { this.DateTimeOption = new(value); } } + + /// + /// Used to track the state of Map + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> MapOption { get; private set; } + + /// + /// Gets or Sets Map + /// + [JsonPropertyName("map")] + public Dictionary? Map { get { return this.MapOption; } set { this.MapOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Used to track the state of UuidWithPattern + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidWithPatternOption { get; private set; } + + /// + /// Gets or Sets UuidWithPattern + /// + [JsonPropertyName("uuid_with_pattern")] + public Guid? UuidWithPattern { get { return this.UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + sb.Append(" DateTime: ").Append(DateTime).Append("\n"); + sb.Append(" Map: ").Append(Map).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" UuidWithPattern: ").Append(UuidWithPattern).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + // UuidWithPattern (Guid) pattern + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + + if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()!).Success) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); + } + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedPropertiesAndAdditionalPropertiesClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateTime + /// + public static string DateTimeFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option dateTime = default; + Option?> map = default; + Option uuid = default; + Option uuidWithPattern = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "dateTime": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "map": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + case "uuid_with_pattern": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (map.IsSet && map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedPropertiesAndAdditionalPropertiesClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); + + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) + { + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + } + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); + } + } + + /// + /// The MixedPropertiesAndAdditionalPropertiesClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(MixedPropertiesAndAdditionalPropertiesClass))] + public partial class MixedPropertiesAndAdditionalPropertiesClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs new file mode 100644 index 000000000000..696681a920f3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/MixedSubId.cs @@ -0,0 +1,184 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// MixedSubId + /// + public partial class MixedSubId : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + [JsonConstructor] + public MixedSubId(Option id = default) + { + IdOption = id; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public string? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class MixedSubId {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class MixedSubIdJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override MixedSubId Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + id = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class MixedSubId."); + + return new MixedSubId(id); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, mixedSubId, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, MixedSubId mixedSubId, JsonSerializerOptions jsonSerializerOptions) + { + if (mixedSubId.IdOption.IsSet && mixedSubId.Id == null) + throw new ArgumentNullException(nameof(mixedSubId.Id), "Property is required for class MixedSubId."); + + if (mixedSubId.IdOption.IsSet) + writer.WriteString("id", mixedSubId.Id); + } + } + + /// + /// The MixedSubIdSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(MixedSubId))] + public partial class MixedSubIdSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs new file mode 100644 index 000000000000..a6022a5f9cce --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Model200Response.cs @@ -0,0 +1,211 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name starting with number + /// + public partial class Model200Response : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// class + /// name + [JsonConstructor] + public Model200Response(Option @class = default, Option name = default) + { + ClassOption = @class; + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Class + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ClassOption { get; private set; } + + /// + /// Gets or Sets Class + /// + [JsonPropertyName("class")] + public string? Class { get { return this.ClassOption; } set { this.ClassOption = new(value); } } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public int? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Model200Response {\n"); + sb.Append(" Class: ").Append(Class).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class Model200ResponseJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClass = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "class": + varClass = new Option(utf8JsonReader.GetString()!); + break; + case "name": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + name = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); + + return new Model200Response(varClass, name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, model200Response, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) + { + if (model200Response.ClassOption.IsSet && model200Response.Class == null) + throw new ArgumentNullException(nameof(model200Response.Class), "Property is required for class Model200Response."); + + if (model200Response.ClassOption.IsSet) + writer.WriteString("class", model200Response.Class); + + if (model200Response.NameOption.IsSet) + writer.WriteNumber("name", model200Response.NameOption.Value!.Value); + } + } + + /// + /// The Model200ResponseSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Model200Response))] + public partial class Model200ResponseSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs new file mode 100644 index 000000000000..49dcb68c571f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ModelClient.cs @@ -0,0 +1,184 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ModelClient + /// + public partial class ModelClient : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varClient + [JsonConstructor] + public ModelClient(Option varClient = default) + { + VarClientOption = varClient; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of VarClient + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarClientOption { get; private set; } + + /// + /// Gets or Sets VarClient + /// + [JsonPropertyName("client")] + public string? VarClient { get { return this.VarClientOption; } set { this.VarClientOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ModelClient {\n"); + sb.Append(" VarClient: ").Append(VarClient).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ModelClientJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varClient = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "client": + varClient = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (varClient.IsSet && varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); + + return new ModelClient(varClient); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, modelClient, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) + { + if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + + if (modelClient.VarClientOption.IsSet) + writer.WriteString("client", modelClient.VarClient); + } + } + + /// + /// The ModelClientSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ModelClient))] + public partial class ModelClientSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs new file mode 100644 index 000000000000..2632fefd0fac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Name.cs @@ -0,0 +1,301 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing model name same as property name + /// + public partial class Name : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varName + /// property + /// snakeCase + /// var123Number + [JsonConstructor] + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) + { + VarName = varName; + PropertyOption = property; + SnakeCaseOption = snakeCase; + Var123NumberOption = var123Number; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets VarName + /// + [JsonPropertyName("name")] + public int VarName { get; set; } + + /// + /// Used to track the state of Property + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PropertyOption { get; private set; } + + /// + /// Gets or Sets Property + /// + [JsonPropertyName("property")] + public string? Property { get { return this.PropertyOption; } set { this.PropertyOption = new(value); } } + + /// + /// Used to track the state of SnakeCase + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SnakeCaseOption { get; } + + /// + /// Gets or Sets SnakeCase + /// + [JsonPropertyName("snake_case")] + public int? SnakeCase { get { return this.SnakeCaseOption; } } + + /// + /// Used to track the state of Var123Number + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option Var123NumberOption { get; } + + /// + /// Gets or Sets Var123Number + /// + [JsonPropertyName("123Number")] + public int? Var123Number { get { return this.Var123NumberOption; } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Name {\n"); + sb.Append(" VarName: ").Append(VarName).Append("\n"); + sb.Append(" Property: ").Append(Property).Append("\n"); + sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n"); + sb.Append(" Var123Number: ").Append(Var123Number).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as Name).AreEqual; + } + + /// + /// Returns true if Name instances are equal + /// + /// Instance of Name to be compared + /// Boolean + public bool Equals(Name? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (SnakeCase != null) + hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); + + if (Var123Number != null) + hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NameJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varName = new Option(utf8JsonReader.GetInt32()); + break; + case "property": + property = new Option(utf8JsonReader.GetString()!); + break; + case "snake_case": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + snakeCase = new Option(utf8JsonReader.GetInt32()); + break; + case "123Number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + var123Number = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (!varName.IsSet) + throw new ArgumentException("Property is required for class Name.", nameof(varName)); + + if (varName.IsSet && varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); + + if (property.IsSet && property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); + + if (snakeCase.IsSet && snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); + + if (var123Number.IsSet && var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); + + return new Name(varName.Value!.Value!, property, snakeCase, var123Number); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, name, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) + { + if (name.PropertyOption.IsSet && name.Property == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + + writer.WriteNumber("name", name.VarName); + + if (name.PropertyOption.IsSet) + writer.WriteString("property", name.Property); + + if (name.SnakeCaseOption.IsSet) + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); + + if (name.Var123NumberOption.IsSet) + writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); + } + } + + /// + /// The NameSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Name))] + public partial class NameSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs new file mode 100644 index 000000000000..e3a042f07ea2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -0,0 +1,202 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NotificationtestGetElementsV1ResponseMPayload + /// + public partial class NotificationtestGetElementsV1ResponseMPayload : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// aObjVariableobject + /// pkiNotificationtestID + [JsonConstructor] + public NotificationtestGetElementsV1ResponseMPayload(List> aObjVariableobject, int pkiNotificationtestID) + { + AObjVariableobject = aObjVariableobject; + PkiNotificationtestID = pkiNotificationtestID; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets AObjVariableobject + /// + [JsonPropertyName("a_objVariableobject")] + public List> AObjVariableobject { get; set; } + + /// + /// Gets or Sets PkiNotificationtestID + /// + [JsonPropertyName("pkiNotificationtestID")] + public int PkiNotificationtestID { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NotificationtestGetElementsV1ResponseMPayload {\n"); + sb.Append(" AObjVariableobject: ").Append(AObjVariableobject).Append("\n"); + sb.Append(" PkiNotificationtestID: ").Append(PkiNotificationtestID).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NotificationtestGetElementsV1ResponseMPayloadJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option>?> aObjVariableobject = default; + Option pkiNotificationtestID = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "a_objVariableobject": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "pkiNotificationtestID": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + break; + default: + break; + } + } + } + + if (!aObjVariableobject.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); + + if (!pkiNotificationtestID.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); + + if (aObjVariableobject.IsSet && aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, notificationtestGetElementsV1ResponseMPayload, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) + { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + + writer.WritePropertyName("a_objVariableobject"); + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); + } + } + + /// + /// The NotificationtestGetElementsV1ResponseMPayloadSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(NotificationtestGetElementsV1ResponseMPayload))] + public partial class NotificationtestGetElementsV1ResponseMPayloadSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs new file mode 100644 index 000000000000..97697787aa33 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableClass.cs @@ -0,0 +1,506 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NullableClass + /// + public partial class NullableClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// arrayAndItemsNullableProp + /// arrayItemsNullable + /// arrayNullableProp + /// booleanProp + /// dateProp + /// datetimeProp + /// integerProp + /// numberProp + /// objectAndItemsNullableProp + /// objectItemsNullable + /// objectNullableProp + /// stringProp + [JsonConstructor] + public NullableClass(Option?> arrayAndItemsNullableProp = default, Option?> arrayItemsNullable = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectItemsNullable = default, Option?> objectNullableProp = default, Option stringProp = default) + { + ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayItemsNullableOption = arrayItemsNullable; + ArrayNullablePropOption = arrayNullableProp; + BooleanPropOption = booleanProp; + DatePropOption = dateProp; + DatetimePropOption = datetimeProp; + IntegerPropOption = integerProp; + NumberPropOption = numberProp; + ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectItemsNullableOption = objectItemsNullable; + ObjectNullablePropOption = objectNullableProp; + StringPropOption = stringProp; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of ArrayAndItemsNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayAndItemsNullablePropOption { get; private set; } + + /// + /// Gets or Sets ArrayAndItemsNullableProp + /// + [JsonPropertyName("array_and_items_nullable_prop")] + public List? ArrayAndItemsNullableProp { get { return this.ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } + + /// + /// Used to track the state of ArrayItemsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ArrayItemsNullable + /// + [JsonPropertyName("array_items_nullable")] + public List? ArrayItemsNullable { get { return this.ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } + + /// + /// Used to track the state of ArrayNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ArrayNullablePropOption { get; private set; } + + /// + /// Gets or Sets ArrayNullableProp + /// + [JsonPropertyName("array_nullable_prop")] + public List? ArrayNullableProp { get { return this.ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } + + /// + /// Used to track the state of BooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BooleanPropOption { get; private set; } + + /// + /// Gets or Sets BooleanProp + /// + [JsonPropertyName("boolean_prop")] + public bool? BooleanProp { get { return this.BooleanPropOption; } set { this.BooleanPropOption = new(value); } } + + /// + /// Used to track the state of DateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DatePropOption { get; private set; } + + /// + /// Gets or Sets DateProp + /// + [JsonPropertyName("date_prop")] + public DateOnly? DateProp { get { return this.DatePropOption; } set { this.DatePropOption = new(value); } } + + /// + /// Used to track the state of DatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DatetimePropOption { get; private set; } + + /// + /// Gets or Sets DatetimeProp + /// + [JsonPropertyName("datetime_prop")] + public DateTime? DatetimeProp { get { return this.DatetimePropOption; } set { this.DatetimePropOption = new(value); } } + + /// + /// Used to track the state of IntegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IntegerPropOption { get; private set; } + + /// + /// Gets or Sets IntegerProp + /// + [JsonPropertyName("integer_prop")] + public int? IntegerProp { get { return this.IntegerPropOption; } set { this.IntegerPropOption = new(value); } } + + /// + /// Used to track the state of NumberProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NumberPropOption { get; private set; } + + /// + /// Gets or Sets NumberProp + /// + [JsonPropertyName("number_prop")] + public decimal? NumberProp { get { return this.NumberPropOption; } set { this.NumberPropOption = new(value); } } + + /// + /// Used to track the state of ObjectAndItemsNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ObjectAndItemsNullablePropOption { get; private set; } + + /// + /// Gets or Sets ObjectAndItemsNullableProp + /// + [JsonPropertyName("object_and_items_nullable_prop")] + public Dictionary? ObjectAndItemsNullableProp { get { return this.ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } + + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ObjectItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ObjectItemsNullable + /// + [JsonPropertyName("object_items_nullable")] + public Dictionary? ObjectItemsNullable { get { return this.ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + + /// + /// Used to track the state of ObjectNullableProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ObjectNullablePropOption { get; private set; } + + /// + /// Gets or Sets ObjectNullableProp + /// + [JsonPropertyName("object_nullable_prop")] + public Dictionary? ObjectNullableProp { get { return this.ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } + + /// + /// Used to track the state of StringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StringPropOption { get; private set; } + + /// + /// Gets or Sets StringProp + /// + [JsonPropertyName("string_prop")] + public string? StringProp { get { return this.StringPropOption; } set { this.StringPropOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableClass {\n"); + sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append("\n"); + sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); + sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append("\n"); + sb.Append(" BooleanProp: ").Append(BooleanProp).Append("\n"); + sb.Append(" DateProp: ").Append(DateProp).Append("\n"); + sb.Append(" DatetimeProp: ").Append(DatetimeProp).Append("\n"); + sb.Append(" IntegerProp: ").Append(IntegerProp).Append("\n"); + sb.Append(" NumberProp: ").Append(NumberProp).Append("\n"); + sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n"); + sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); + sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n"); + sb.Append(" StringProp: ").Append(StringProp).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize DateProp + /// + public static string DatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize DatetimeProp + /// + public static string DatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> arrayAndItemsNullableProp = default; + Option?> arrayItemsNullable = default; + Option?> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option?> objectAndItemsNullableProp = default; + Option?> objectItemsNullable = default; + Option?> objectNullableProp = default; + Option stringProp = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "array_and_items_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "array_items_nullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "array_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + booleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + integerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "number_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + numberProp = new Option(utf8JsonReader.GetDecimal()); + break; + case "object_and_items_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "object_items_nullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "object_nullable_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "string_prop": + stringProp = new Option(utf8JsonReader.GetString()); + break; + default: + break; + } + } + } + + if (arrayItemsNullable.IsSet && arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); + + if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); + + return new NullableClass(arrayAndItemsNullableProp, arrayItemsNullable, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectItemsNullable, objectNullableProp, stringProp); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, nullableClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) + { + if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) + if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayItemsNullableOption.IsSet) + { + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } + if (nullableClass.ArrayNullablePropOption.IsSet) + if (nullableClass.ArrayNullablePropOption.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanPropOption.IsSet) + if (nullableClass.BooleanPropOption.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DatePropOption.IsSet) + if (nullableClass.DatePropOption.Value != null) + writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimePropOption.IsSet) + if (nullableClass.DatetimePropOption.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerPropOption.IsSet) + if (nullableClass.IntegerPropOption.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberPropOption.IsSet) + if (nullableClass.NumberPropOption.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); + else + writer.WriteNull("number_prop"); + + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) + if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectItemsNullableOption.IsSet) + { + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } + if (nullableClass.ObjectNullablePropOption.IsSet) + if (nullableClass.ObjectNullablePropOption.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringPropOption.IsSet) + if (nullableClass.StringPropOption.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp); + else + writer.WriteNull("string_prop"); + } + } + + /// + /// The NullableClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(NullableClass))] + public partial class NullableClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs new file mode 100644 index 000000000000..7db4f508852b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -0,0 +1,183 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NullableGuidClass + /// + public partial class NullableGuidClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// uuid + [JsonConstructor] + public NullableGuidClass(Option uuid = default) + { + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("uuid")] + public Guid? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableGuidClass {\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableGuidClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + uuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + return new NullableGuidClass(uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, nullableGuidClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) + { + if (nullableGuidClass.UuidOption.IsSet) + if (nullableGuidClass.UuidOption.Value != null) + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); + else + writer.WriteNull("uuid"); + } + } + + /// + /// The NullableGuidClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(NullableGuidClass))] + public partial class NullableGuidClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableShape.cs new file mode 100644 index 000000000000..25248c75ffaf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NullableShape.cs @@ -0,0 +1,249 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// 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. + /// + public partial class NullableShape : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public NullableShape(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public NullableShape(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle? Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral? Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NullableShape {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NullableShapeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral? quadrilateral = null; + Triangle? triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("shapeType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("Quadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator?.Equals("Triangle") ?? false) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); + + if (quadrilateral != null) + return new NullableShape(quadrilateral); + + if (triangle != null) + return new NullableShape(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (nullableShape.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, nullableShape.Triangle, jsonSerializerOptions); + } + + if (nullableShape.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(nullableShape.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, nullableShape.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, nullableShape, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The NullableShapeSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(NullableShape))] + public partial class NullableShapeSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs new file mode 100644 index 000000000000..b33930dee1b7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -0,0 +1,182 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NumberOnly + /// + public partial class NumberOnly : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// justNumber + [JsonConstructor] + public NumberOnly(Option justNumber = default) + { + JustNumberOption = justNumber; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of JustNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option JustNumberOption { get; private set; } + + /// + /// Gets or Sets JustNumber + /// + [JsonPropertyName("JustNumber")] + public decimal? JustNumber { get { return this.JustNumberOption; } set { this.JustNumberOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NumberOnly {\n"); + sb.Append(" JustNumber: ").Append(JustNumber).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NumberOnlyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option justNumber = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "JustNumber": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + justNumber = new Option(utf8JsonReader.GetDecimal()); + break; + default: + break; + } + } + } + + if (justNumber.IsSet && justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); + + return new NumberOnly(justNumber); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, numberOnly, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) + { + if (numberOnly.JustNumberOption.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); + } + } + + /// + /// The NumberOnlySerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(NumberOnly))] + public partial class NumberOnlySerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs new file mode 100644 index 000000000000..72d8feb0ba05 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ObjectWithDeprecatedFields + /// + public partial class ObjectWithDeprecatedFields : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bars + /// deprecatedRef + /// id + /// uuid + [JsonConstructor] + public ObjectWithDeprecatedFields(Option?> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) + { + BarsOption = bars; + DeprecatedRefOption = deprecatedRef; + IdOption = id; + UuidOption = uuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bars + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> BarsOption { get; private set; } + + /// + /// Gets or Sets Bars + /// + [JsonPropertyName("bars")] + [Obsolete] + public List? Bars { get { return this.BarsOption; } set { this.BarsOption = new(value); } } + + /// + /// Used to track the state of DeprecatedRef + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option DeprecatedRefOption { get; private set; } + + /// + /// Gets or Sets DeprecatedRef + /// + [JsonPropertyName("deprecatedRef")] + [Obsolete] + public DeprecatedObject? DeprecatedRef { get { return this.DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + [Obsolete] + public decimal? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UuidOption { get; private set; } + + /// + /// Gets or Sets Uuid + /// + [JsonPropertyName("uuid")] + public string? Uuid { get { return this.UuidOption; } set { this.UuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ObjectWithDeprecatedFields {\n"); + sb.Append(" Bars: ").Append(Bars).Append("\n"); + sb.Append(" DeprecatedRef: ").Append(DeprecatedRef).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Uuid: ").Append(Uuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ObjectWithDeprecatedFieldsJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bars": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "deprecatedRef": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetDecimal()); + break; + case "uuid": + uuid = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (bars.IsSet && bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (deprecatedRef.IsSet && deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); + + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, objectWithDeprecatedFields, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) + { + if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.BarsOption.IsSet) + { + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + } + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) + { + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + } + if (objectWithDeprecatedFields.IdOption.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); + + if (objectWithDeprecatedFields.UuidOption.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + } + } + + /// + /// The ObjectWithDeprecatedFieldsSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ObjectWithDeprecatedFields))] + public partial class ObjectWithDeprecatedFieldsSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OneOfString.cs new file mode 100644 index 000000000000..269f97ae4fd3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OneOfString.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// OneOfString + /// + public partial class OneOfString : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + internal OneOfString(string @string) + { + String = @string; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets String + /// + public string? String { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OneOfString {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OneOfStringJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + string? varString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varString != null) + return new OneOfString(varString); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, oneOfString, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, OneOfString oneOfString, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The OneOfStringSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(OneOfString))] + public partial class OneOfStringSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs new file mode 100644 index 000000000000..ad8a7fe42d07 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Order.cs @@ -0,0 +1,406 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Order + /// + public partial class Order : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// complete (default to false) + /// id + /// petId + /// quantity + /// shipDate + /// Order Status + [JsonConstructor] + public Order(Option complete = default, Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default) + { + CompleteOption = complete; + IdOption = id; + PetIdOption = petId; + QuantityOption = quantity; + ShipDateOption = shipDate; + StatusOption = status; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Order Status + /// + /// Order Status + public enum StatusEnum + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Returns a + /// + /// + /// + /// + public static StatusEnum StatusEnumFromString(string value) + { + if (value.Equals("placed")) + return StatusEnum.Placed; + + if (value.Equals("approved")) + return StatusEnum.Approved; + + if (value.Equals("delivered")) + return StatusEnum.Delivered; + + throw new NotImplementedException($"Could not convert value to type StatusEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static StatusEnum? StatusEnumFromStringOrDefault(string value) + { + if (value.Equals("placed")) + return StatusEnum.Placed; + + if (value.Equals("approved")) + return StatusEnum.Approved; + + if (value.Equals("delivered")) + return StatusEnum.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string StatusEnumToJsonValue(StatusEnum? value) + { + if (value == StatusEnum.Placed) + return "placed"; + + if (value == StatusEnum.Approved) + return "approved"; + + if (value == StatusEnum.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// Order Status + /// + /// Order Status + [JsonPropertyName("status")] + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CompleteOption { get; private set; } + + /// + /// Gets or Sets Complete + /// + [JsonPropertyName("complete")] + public bool? Complete { get { return this.CompleteOption; } set { this.CompleteOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of PetId + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PetIdOption { get; private set; } + + /// + /// Gets or Sets PetId + /// + [JsonPropertyName("petId")] + public long? PetId { get { return this.PetIdOption; } set { this.PetIdOption = new(value); } } + + /// + /// Used to track the state of Quantity + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option QuantityOption { get; private set; } + + /// + /// Gets or Sets Quantity + /// + [JsonPropertyName("quantity")] + public int? Quantity { get { return this.QuantityOption; } set { this.QuantityOption = new(value); } } + + /// + /// Used to track the state of ShipDate + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ShipDateOption { get; private set; } + + /// + /// Gets or Sets ShipDate + /// + /* 2020-02-02T20:20:20.000222Z */ + [JsonPropertyName("shipDate")] + public DateTime? ShipDate { get { return this.ShipDateOption; } set { this.ShipDateOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Order {\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" PetId: ").Append(PetId).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OrderJsonConverter : JsonConverter + { + /// + /// The format to use to serialize ShipDate + /// + public static string ShipDateFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "complete": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + complete = new Option(utf8JsonReader.GetBoolean()); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "petId": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + petId = new Option(utf8JsonReader.GetInt64()); + break; + case "quantity": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + quantity = new Option(utf8JsonReader.GetInt32()); + break; + case "shipDate": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "status": + string? statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); + break; + default: + break; + } + } + } + + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); + + if (petId.IsSet && petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); + + if (quantity.IsSet && quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); + + if (shipDate.IsSet && shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); + + return new Order(complete, id, petId, quantity, shipDate, status); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, order, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) + { + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); + + if (order.IdOption.IsSet) + writer.WriteNumber("id", order.IdOption.Value!.Value); + + if (order.PetIdOption.IsSet) + writer.WriteNumber("petId", order.PetIdOption.Value!.Value); + + if (order.QuantityOption.IsSet) + writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); + + if (order.ShipDateOption.IsSet) + writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); + + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); + writer.WriteString("status", statusRawValue); + } + } + + /// + /// The OrderSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Order))] + public partial class OrderSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs new file mode 100644 index 000000000000..9e354ba31085 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -0,0 +1,238 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// OuterComposite + /// + public partial class OuterComposite : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// myBoolean + /// myNumber + /// myString + [JsonConstructor] + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) + { + MyBooleanOption = myBoolean; + MyNumberOption = myNumber; + MyStringOption = myString; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of MyBoolean + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyBooleanOption { get; private set; } + + /// + /// Gets or Sets MyBoolean + /// + [JsonPropertyName("my_boolean")] + public bool? MyBoolean { get { return this.MyBooleanOption; } set { this.MyBooleanOption = new(value); } } + + /// + /// Used to track the state of MyNumber + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyNumberOption { get; private set; } + + /// + /// Gets or Sets MyNumber + /// + [JsonPropertyName("my_number")] + public decimal? MyNumber { get { return this.MyNumberOption; } set { this.MyNumberOption = new(value); } } + + /// + /// Used to track the state of MyString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option MyStringOption { get; private set; } + + /// + /// Gets or Sets MyString + /// + [JsonPropertyName("my_string")] + public string? MyString { get { return this.MyStringOption; } set { this.MyStringOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class OuterComposite {\n"); + sb.Append(" MyBoolean: ").Append(MyBoolean).Append("\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); + sb.Append(" MyString: ").Append(MyString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class OuterCompositeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option myBoolean = default; + Option myNumber = default; + Option myString = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "my_boolean": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + myBoolean = new Option(utf8JsonReader.GetBoolean()); + break; + case "my_number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + myNumber = new Option(utf8JsonReader.GetDecimal()); + break; + case "my_string": + myString = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (myBoolean.IsSet && myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); + + if (myNumber.IsSet && myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); + + if (myString.IsSet && myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); + + return new OuterComposite(myBoolean, myNumber, myString); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, outerComposite, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) + { + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + + if (outerComposite.MyBooleanOption.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); + + if (outerComposite.MyNumberOption.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); + + if (outerComposite.MyStringOption.IsSet) + writer.WriteString("my_string", outerComposite.MyString); + } + } + + /// + /// The OuterCompositeSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(OuterComposite))] + public partial class OuterCompositeSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnum.cs new file mode 100644 index 000000000000..803ca5e1771d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnum + /// + public enum OuterEnum + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnum FromString(string value) + { + if (value.Equals("placed")) + return OuterEnum.Placed; + + if (value.Equals("approved")) + return OuterEnum.Approved; + + if (value.Equals("delivered")) + return OuterEnum.Delivered; + + throw new NotImplementedException($"Could not convert value to type OuterEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnum? FromStringOrDefault(string value) + { + if (value.Equals("placed")) + return OuterEnum.Placed; + + if (value.Equals("approved")) + return OuterEnum.Approved; + + if (value.Equals("delivered")) + return OuterEnum.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnum value) + { + if (value == OuterEnum.Placed) + return "placed"; + + if (value == OuterEnum.Approved) + return "approved"; + + if (value == OuterEnum.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnum? result = rawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnum outerEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnum.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnum from the Json object + /// + /// + /// + /// + /// + public override OuterEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnum? result = rawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnum? outerEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnum?.ToString() ?? "null"); + } + } + + + /// + /// The OuterEnumSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(OuterEnum))] + public partial class OuterEnumSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs new file mode 100644 index 000000000000..1d30a9abb740 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumDefaultValue + /// + public enum OuterEnumDefaultValue + { + /// + /// Enum Placed for value: placed + /// + Placed = 1, + + /// + /// Enum Approved for value: approved + /// + Approved = 2, + + /// + /// Enum Delivered for value: delivered + /// + Delivered = 3 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumDefaultValueValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumDefaultValue FromString(string value) + { + if (value.Equals("placed")) + return OuterEnumDefaultValue.Placed; + + if (value.Equals("approved")) + return OuterEnumDefaultValue.Approved; + + if (value.Equals("delivered")) + return OuterEnumDefaultValue.Delivered; + + throw new NotImplementedException($"Could not convert value to type OuterEnumDefaultValue: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumDefaultValue? FromStringOrDefault(string value) + { + if (value.Equals("placed")) + return OuterEnumDefaultValue.Placed; + + if (value.Equals("approved")) + return OuterEnumDefaultValue.Approved; + + if (value.Equals("delivered")) + return OuterEnumDefaultValue.Delivered; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnumDefaultValue value) + { + if (value == OuterEnumDefaultValue.Placed) + return "placed"; + + if (value == OuterEnumDefaultValue.Approved) + return "approved"; + + if (value == OuterEnumDefaultValue.Delivered) + return "delivered"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumDefaultValueJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumDefaultValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumDefaultValue? result = rawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumDefaultValue to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumDefaultValue outerEnumDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumDefaultValue.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumDefaultValueNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumDefaultValue from the Json object + /// + /// + /// + /// + /// + public override OuterEnumDefaultValue? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumDefaultValue? result = rawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumDefaultValue? outerEnumDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumDefaultValue?.ToString() ?? "null"); + } + } + + + /// + /// The OuterEnumDefaultValueSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(OuterEnumDefaultValue))] + public partial class OuterEnumDefaultValueSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumInteger.cs new file mode 100644 index 000000000000..0d9bcfd0835b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumInteger + /// + public enum OuterEnumInteger + { + /// + /// Enum NUMBER_0 for value: 0 + /// + NUMBER_0 = 0, + + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumIntegerValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumInteger FromString(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumInteger.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumInteger.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumInteger.NUMBER_2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumInteger: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumInteger? FromStringOrDefault(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumInteger.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumInteger.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumInteger.NUMBER_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(OuterEnumInteger value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumIntegerJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumInteger Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumInteger? result = rawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumInteger to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumInteger outerEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumInteger.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumIntegerNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumInteger from the Json object + /// + /// + /// + /// + /// + public override OuterEnumInteger? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumInteger? result = rawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumInteger? outerEnumInteger, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumInteger?.ToString() ?? "null"); + } + } + + + /// + /// The OuterEnumIntegerSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(OuterEnumInteger))] + public partial class OuterEnumIntegerSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs new file mode 100644 index 000000000000..b0d7b8ea0756 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines OuterEnumIntegerDefaultValue + /// + public enum OuterEnumIntegerDefaultValue + { + /// + /// Enum NUMBER_0 for value: 0 + /// + NUMBER_0 = 0, + + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumIntegerDefaultValueValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumIntegerDefaultValue FromString(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumIntegerDefaultValue: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumIntegerDefaultValue? FromStringOrDefault(string value) + { + if (value.Equals((0).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_0; + + if (value.Equals((1).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_1; + + if (value.Equals((2).ToString())) + return OuterEnumIntegerDefaultValue.NUMBER_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static int ToJsonValue(OuterEnumIntegerDefaultValue value) + { + return (int) value; + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumIntegerDefaultValueJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumIntegerDefaultValue Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumIntegerDefaultValue? result = rawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumIntegerDefaultValue to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumIntegerDefaultValue.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumIntegerDefaultValueNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumIntegerDefaultValue from the Json object + /// + /// + /// + /// + /// + public override OuterEnumIntegerDefaultValue? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumIntegerDefaultValue? result = rawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumIntegerDefaultValue?.ToString() ?? "null"); + } + } + + + /// + /// The OuterEnumIntegerDefaultValueSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(OuterEnumIntegerDefaultValue))] + public partial class OuterEnumIntegerDefaultValueSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumTest.cs new file mode 100644 index 000000000000..56a81b57e54d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -0,0 +1,269 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines Outer_Enum_Test + /// + public enum OuterEnumTest + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Converts to and from the JSON value + /// + public static class OuterEnumTestValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumTest FromString(string value) + { + if (value.Equals("UPPER")) + return OuterEnumTest.UPPER; + + if (value.Equals("lower")) + return OuterEnumTest.Lower; + + if (value.Equals("")) + return OuterEnumTest.Empty; + + if (value.Equals("Value\twith tab")) + return OuterEnumTest.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return OuterEnumTest.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return OuterEnumTest.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return OuterEnumTest.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return OuterEnumTest.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type OuterEnumTest: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static OuterEnumTest? FromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return OuterEnumTest.UPPER; + + if (value.Equals("lower")) + return OuterEnumTest.Lower; + + if (value.Equals("")) + return OuterEnumTest.Empty; + + if (value.Equals("Value\twith tab")) + return OuterEnumTest.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return OuterEnumTest.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return OuterEnumTest.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return OuterEnumTest.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return OuterEnumTest.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(OuterEnumTest value) + { + if (value == OuterEnumTest.UPPER) + return "UPPER"; + + if (value == OuterEnumTest.Lower) + return "lower"; + + if (value == OuterEnumTest.Empty) + return ""; + + if (value == OuterEnumTest.ValuewithTab) + return "Value\twith tab"; + + if (value == OuterEnumTest.ValueWithQuote) + return "Value with \" quote"; + + if (value == OuterEnumTest.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == OuterEnumTest.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == OuterEnumTest.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class OuterEnumTestJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override OuterEnumTest Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumTest? result = rawValue == null + ? null + : OuterEnumTestValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the OuterEnumTest to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumTest outerEnumTest, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumTest.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class OuterEnumTestNullableJsonConverter : JsonConverter + { + /// + /// Returns a OuterEnumTest from the Json object + /// + /// + /// + /// + /// + public override OuterEnumTest? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + OuterEnumTest? result = rawValue == null + ? null + : OuterEnumTestValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, OuterEnumTest? outerEnumTest, JsonSerializerOptions options) + { + writer.WriteStringValue(outerEnumTest?.ToString() ?? "null"); + } + } + + + /// + /// The OuterEnumTestSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(OuterEnumTest))] + public partial class OuterEnumTestSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ParentPet.cs new file mode 100644 index 000000000000..6218c3add483 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ParentPet.cs @@ -0,0 +1,168 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ParentPet + /// + public partial class ParentPet : GrandparentAnimal, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructor] + public ParentPet() : base() + { + OnCreated(); + } + + partial void OnCreated(); + + /// + /// The discriminator + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public new string PetType { get; } = "ParentPet"; + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ParentPet {\n"); + sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + } + + /// + /// A Json converter for type + /// + public class ParentPetJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option petType = default; + + string? discriminator = ClientUtils.GetDiscriminator(utf8JsonReader, "pet_type"); + + if (discriminator != null && discriminator.Equals("ChildCat")) + return JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions) ?? throw new JsonException("The result was an unexpected value."); + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "pet_type": + petType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); + + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + return new ParentPet(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) + { + if (parentPet is ChildCat childCat){ + JsonSerializer.Serialize(writer, childCat, jsonSerializerOptions); + return; + } + + writer.WriteStartObject(); + + WriteProperties(writer, parentPet, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("pet_type", parentPet.PetType); + } + } + + /// + /// The ParentPetSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ParentPet))] + public partial class ParentPetSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs new file mode 100644 index 000000000000..f055e78da6e8 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pet.cs @@ -0,0 +1,406 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Pet + /// + public partial class Pet : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + /// photoUrls + /// category + /// id + /// pet status in the store + /// tags + [JsonConstructor] + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option?> tags = default) + { + Name = name; + PhotoUrls = photoUrls; + CategoryOption = category; + IdOption = id; + StatusOption = status; + TagsOption = tags; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// pet status in the store + /// + /// pet status in the store + public enum StatusEnum + { + /// + /// Enum Available for value: available + /// + Available = 1, + + /// + /// Enum Pending for value: pending + /// + Pending = 2, + + /// + /// Enum Sold for value: sold + /// + Sold = 3 + } + + /// + /// Returns a + /// + /// + /// + /// + public static StatusEnum StatusEnumFromString(string value) + { + if (value.Equals("available")) + return StatusEnum.Available; + + if (value.Equals("pending")) + return StatusEnum.Pending; + + if (value.Equals("sold")) + return StatusEnum.Sold; + + throw new NotImplementedException($"Could not convert value to type StatusEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static StatusEnum? StatusEnumFromStringOrDefault(string value) + { + if (value.Equals("available")) + return StatusEnum.Available; + + if (value.Equals("pending")) + return StatusEnum.Pending; + + if (value.Equals("sold")) + return StatusEnum.Sold; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string StatusEnumToJsonValue(StatusEnum? value) + { + if (value == StatusEnum.Available) + return "available"; + + if (value == StatusEnum.Pending) + return "pending"; + + if (value == StatusEnum.Sold) + return "sold"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Status + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option StatusOption { get; private set; } + + /// + /// pet status in the store + /// + /// pet status in the store + [JsonPropertyName("status")] + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + + /// + /// Gets or Sets Name + /// + /* doggie */ + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// Gets or Sets PhotoUrls + /// + [JsonPropertyName("photoUrls")] + public List PhotoUrls { get; set; } + + /// + /// Used to track the state of Category + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option CategoryOption { get; private set; } + + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Category? Category { get { return this.CategoryOption; } set { this.CategoryOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Tags + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> TagsOption { get; private set; } + + /// + /// Gets or Sets Tags + /// + [JsonPropertyName("tags")] + public List? Tags { get { return this.TagsOption; } set { this.TagsOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Pet {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Tags: ").Append(Tags).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PetJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + Option?> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option?> tags = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + case "photoUrls": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "status": + string? statusRawValue = utf8JsonReader.GetString(); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); + break; + case "tags": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (!name.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(name)); + + if (!photoUrls.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); + + if (photoUrls.IsSet && photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); + + if (category.IsSet && category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + + if (tags.IsSet && tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + + return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, pet, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) + { + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.CategoryOption.IsSet && pet.Category == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + + if (pet.TagsOption.IsSet && pet.Tags == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + + writer.WriteString("name", pet.Name); + + writer.WritePropertyName("photoUrls"); + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.CategoryOption.IsSet) + { + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + } + if (pet.IdOption.IsSet) + writer.WriteNumber("id", pet.IdOption.Value!.Value); + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); + writer.WriteString("status", statusRawValue); + if (pet.TagsOption.IsSet) + { + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + } + } + } + + /// + /// The PetSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Pet))] + public partial class PetSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pig.cs new file mode 100644 index 000000000000..57c4f9a91217 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Pig.cs @@ -0,0 +1,249 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Pig + /// + public partial class Pig : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Pig(BasquePig basquePig) + { + BasquePig = basquePig; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Pig(DanishPig danishPig) + { + DanishPig = danishPig; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets BasquePig + /// + public BasquePig? BasquePig { get; set; } + + /// + /// Gets or Sets DanishPig + /// + public DanishPig? DanishPig { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Pig {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PigJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + + BasquePig? basquePig = null; + DanishPig? danishPig = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("className") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("BasquePig") ?? false) + { + Utf8JsonReader utf8JsonReaderBasquePig = utf8JsonReader; + basquePig = JsonSerializer.Deserialize(ref utf8JsonReaderBasquePig, jsonSerializerOptions); + } + if (discriminator?.Equals("DanishPig") ?? false) + { + Utf8JsonReader utf8JsonReaderDanishPig = utf8JsonReader; + danishPig = JsonSerializer.Deserialize(ref utf8JsonReaderDanishPig, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Pig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); + + if (basquePig != null) + return new Pig(basquePig); + + if (danishPig != null) + return new Pig(danishPig); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (pig.BasquePig != null) + { + BasquePigJsonConverter basquePigJsonConverter = (BasquePigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.BasquePig.GetType())); + basquePigJsonConverter.WriteProperties(writer, pig.BasquePig, jsonSerializerOptions); + } + + if (pig.DanishPig != null) + { + DanishPigJsonConverter danishPigJsonConverter = (DanishPigJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(pig.DanishPig.GetType())); + danishPigJsonConverter.WriteProperties(writer, pig.DanishPig, jsonSerializerOptions); + } + + WriteProperties(writer, pig, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The PigSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Pig))] + public partial class PigSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/PolymorphicProperty.cs new file mode 100644 index 000000000000..9e1aaafe221e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -0,0 +1,249 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// PolymorphicProperty + /// + public partial class PolymorphicProperty : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(bool @bool) + { + Bool = @bool; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(string @string) + { + String = @string; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(Object @object) + { + Object = @object; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + internal PolymorphicProperty(List list) + { + List = list; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Bool + /// + public bool? Bool { get; set; } + + /// + /// Gets or Sets String + /// + public string? String { get; set; } + + /// + /// Gets or Sets Object + /// + public Object? Object { get; set; } + + /// + /// Gets or Sets List + /// + public List? List { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class PolymorphicProperty {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class PolymorphicPropertyJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + bool? varBool = default; + string? varString = default; + Object? varObject = default; + List? list = default; + + Utf8JsonReader utf8JsonReaderOneOf = utf8JsonReader; + while (utf8JsonReaderOneOf.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderOneOf.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderOneOf.CurrentDepth) + break; + + if (utf8JsonReaderOneOf.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderOneOf.CurrentDepth - 1) + { + Utf8JsonReader utf8JsonReaderBool = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderBool, jsonSerializerOptions, out varBool); + + Utf8JsonReader utf8JsonReaderString = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderString, jsonSerializerOptions, out varString); + + Utf8JsonReader utf8JsonReaderObject = utf8JsonReader; + ClientUtils.TryDeserialize(ref utf8JsonReaderObject, jsonSerializerOptions, out varObject); + + Utf8JsonReader utf8JsonReaderList = utf8JsonReader; + ClientUtils.TryDeserialize?>(ref utf8JsonReaderList, jsonSerializerOptions, out list); + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + default: + break; + } + } + } + + if (varBool != null) + return new PolymorphicProperty(varBool.Value); + + if (varString != null) + return new PolymorphicProperty(varString); + + if (varObject != null) + return new PolymorphicProperty(varObject); + + if (list != null) + return new PolymorphicProperty(list); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, polymorphicProperty, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, PolymorphicProperty polymorphicProperty, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The PolymorphicPropertySerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(PolymorphicProperty))] + public partial class PolymorphicPropertySerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Quadrilateral.cs new file mode 100644 index 000000000000..8e308392490d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -0,0 +1,249 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Quadrilateral + /// + public partial class Quadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Quadrilateral(SimpleQuadrilateral simpleQuadrilateral) + { + SimpleQuadrilateral = simpleQuadrilateral; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Quadrilateral(ComplexQuadrilateral complexQuadrilateral) + { + ComplexQuadrilateral = complexQuadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets SimpleQuadrilateral + /// + public SimpleQuadrilateral? SimpleQuadrilateral { get; set; } + + /// + /// Gets or Sets ComplexQuadrilateral + /// + public ComplexQuadrilateral? ComplexQuadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Quadrilateral {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class QuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + + ComplexQuadrilateral? complexQuadrilateral = null; + SimpleQuadrilateral? simpleQuadrilateral = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("quadrilateralType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("ComplexQuadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderComplexQuadrilateral = utf8JsonReader; + complexQuadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderComplexQuadrilateral, jsonSerializerOptions); + } + if (discriminator?.Equals("SimpleQuadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderSimpleQuadrilateral = utf8JsonReader; + simpleQuadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderSimpleQuadrilateral, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); + + if (complexQuadrilateral != null) + return new Quadrilateral(complexQuadrilateral); + + if (simpleQuadrilateral != null) + return new Quadrilateral(simpleQuadrilateral); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (quadrilateral.SimpleQuadrilateral != null) + { + SimpleQuadrilateralJsonConverter simpleQuadrilateralJsonConverter = (SimpleQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.SimpleQuadrilateral.GetType())); + simpleQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.SimpleQuadrilateral, jsonSerializerOptions); + } + + if (quadrilateral.ComplexQuadrilateral != null) + { + ComplexQuadrilateralJsonConverter complexQuadrilateralJsonConverter = (ComplexQuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(quadrilateral.ComplexQuadrilateral.GetType())); + complexQuadrilateralJsonConverter.WriteProperties(writer, quadrilateral.ComplexQuadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, quadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The QuadrilateralSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Quadrilateral))] + public partial class QuadrilateralSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs new file mode 100644 index 000000000000..3d15636fda9a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// QuadrilateralInterface + /// + public partial class QuadrilateralInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + [JsonConstructor] + public QuadrilateralInterface(string quadrilateralType) + { + QuadrilateralType = quadrilateralType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class QuadrilateralInterface {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class QuadrilateralInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + return new QuadrilateralInterface(quadrilateralType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, quadrilateralInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); + } + } + + /// + /// The QuadrilateralInterfaceSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(QuadrilateralInterface))] + public partial class QuadrilateralInterfaceSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs new file mode 100644 index 000000000000..4d458434bb1c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -0,0 +1,251 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ReadOnlyFirst + /// + public partial class ReadOnlyFirst : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// bar + /// baz + [JsonConstructor] + public ReadOnlyFirst(Option bar = default, Option baz = default) + { + BarOption = bar; + BazOption = baz; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BarOption { get; } + + /// + /// Gets or Sets Bar + /// + [JsonPropertyName("bar")] + public string? Bar { get { return this.BarOption; } } + + /// + /// Used to track the state of Baz + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option BazOption { get; private set; } + + /// + /// Gets or Sets Baz + /// + [JsonPropertyName("baz")] + public string? Baz { get { return this.BazOption; } set { this.BazOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ReadOnlyFirst {\n"); + sb.Append(" Bar: ").Append(Bar).Append("\n"); + sb.Append(" Baz: ").Append(Baz).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as ReadOnlyFirst).AreEqual; + } + + /// + /// Returns true if ReadOnlyFirst instances are equal + /// + /// Instance of ReadOnlyFirst to be compared + /// Boolean + public bool Equals(ReadOnlyFirst? input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); + + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ReadOnlyFirstJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option bar = default; + Option baz = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "bar": + bar = new Option(utf8JsonReader.GetString()!); + break; + case "baz": + baz = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); + + if (baz.IsSet && baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); + + return new ReadOnlyFirst(bar, baz); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, readOnlyFirst, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) + { + if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BarOption.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar); + + if (readOnlyFirst.BazOption.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz); + } + } + + /// + /// The ReadOnlyFirstSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ReadOnlyFirst))] + public partial class ReadOnlyFirstSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..f8095975d33e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,2388 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + [JsonConstructor] + public RequiredClass(DateOnly requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateOnly? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; + NotRequiredNullableDatePropOption = notRequiredNullableDateProp; + NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; + NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumIntegerOption = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnlyOption = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumStringOption = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValueOption = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringPropOption = notrequiredNullableStringProp; + NotrequiredNullableUuidOption = notrequiredNullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumInteger + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumIntegerOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumIntegerOnly + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNullableEnumString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableEnumStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateOnly RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Used to track the state of NotRequiredNotnullableDateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNotnullableDatePropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateOnly? NotRequiredNotnullableDateProp { get { return this.NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNotnullableintegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNotnullableintegerPropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this.NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNullableDateProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNullableDatePropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public DateOnly? NotRequiredNullableDateProp { get { return this.NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } + + /// + /// Used to track the state of NotRequiredNullableIntegerProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotRequiredNullableIntegerPropOption { get; private set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this.NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List? NotrequiredNotnullableArrayOfString { get { return this.NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableBooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this.NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this.NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableStringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableStringPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string? NotrequiredNotnullableStringProp { get { return this.NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableUuidOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this.NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableArrayOfString + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public List? NotrequiredNullableArrayOfString { get { return this.NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableBooleanProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableBooleanPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public bool? NotrequiredNullableBooleanProp { get { return this.NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableDatetimeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableDatetimePropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public DateTime? NotrequiredNullableDatetimeProp { get { return this.NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableStringProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableStringPropOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public string? NotrequiredNullableStringProp { get { return this.NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNullableUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNullableUuidOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("notrequired_nullable_uuid")] + public Guid? NotrequiredNullableUuid { get { return this.NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List? RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateOnly? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string? RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /* 72f98069-206d-4f12-9f12-3d1e525a8e84 */ + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option?> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option?> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option?> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + Option?> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_notnullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumInteger = new Option((RequiredClass.RequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string? requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumInteger = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumInteger = new Option((RequiredClass.NotrequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string? notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableDatetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); + + if (requiredNotNullableDateProp.IsSet && requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.IsSet && requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.IsSet && requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.IsSet && requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.IsSet && requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.IsSet && requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.IsSet && requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.IsSet && requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.IsSet && requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.IsSet && requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.IsSet && requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.IsSet && notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.IsSet && notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.IsSet && notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.IsSet && notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.IsSet && notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.IsSet && notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.IsSet && notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.IsSet && notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.IsSet && notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.IsSet && notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); + + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); + + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); + + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); + + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); + + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); + + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); + + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); + + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); + + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) + if (requiredClass.NotRequiredNullableDatePropOption.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); + + if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) + if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); + + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) + if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) + if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + + if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) + if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + + if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); + + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringPropOption.IsSet) + if (requiredClass.NotrequiredNullableStringPropOption.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); + else + writer.WriteNull("notrequired_nullable_string_prop"); + + if (requiredClass.NotrequiredNullableUuidOption.IsSet) + if (requiredClass.NotrequiredNullableUuidOption.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); + else + writer.WriteNull("notrequired_nullable_uuid"); + + if (requiredClass.RequiredNullableArrayOfString != null) + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); + + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); + + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); + + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); + + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); + + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); + + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); + + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); + } + } + + /// + /// The RequiredClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(RequiredClass))] + public partial class RequiredClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs new file mode 100644 index 000000000000..14b4548c6105 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Return.cs @@ -0,0 +1,256 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Model for testing reserved words + /// + public partial class Return : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// lock + /// abstract + /// varReturn + /// unsafe + [JsonConstructor] + public Return(string @lock, string? @abstract = default, Option varReturn = default, Option @unsafe = default) + { + Lock = @lock; + Abstract = @abstract; + VarReturnOption = varReturn; + UnsafeOption = @unsafe; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Lock + /// + [JsonPropertyName("lock")] + public string Lock { get; set; } + + /// + /// Gets or Sets Abstract + /// + [JsonPropertyName("abstract")] + public string? Abstract { get; set; } + + /// + /// Used to track the state of VarReturn + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarReturnOption { get; private set; } + + /// + /// Gets or Sets VarReturn + /// + [JsonPropertyName("return")] + public int? VarReturn { get { return this.VarReturnOption; } set { this.VarReturnOption = new(value); } } + + /// + /// Used to track the state of Unsafe + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UnsafeOption { get; private set; } + + /// + /// Gets or Sets Unsafe + /// + [JsonPropertyName("unsafe")] + public string? Unsafe { get { return this.UnsafeOption; } set { this.UnsafeOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Return {\n"); + sb.Append(" Lock: ").Append(Lock).Append("\n"); + sb.Append(" Abstract: ").Append(Abstract).Append("\n"); + sb.Append(" VarReturn: ").Append(VarReturn).Append("\n"); + sb.Append(" Unsafe: ").Append(Unsafe).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ReturnJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varLock = default; + Option varAbstract = default; + Option varReturn = default; + Option varUnsafe = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "lock": + varLock = new Option(utf8JsonReader.GetString()!); + break; + case "abstract": + varAbstract = new Option(utf8JsonReader.GetString()); + break; + case "return": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + varReturn = new Option(utf8JsonReader.GetInt32()); + break; + case "unsafe": + varUnsafe = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!varLock.IsSet) + throw new ArgumentException("Property is required for class Return.", nameof(varLock)); + + if (!varAbstract.IsSet) + throw new ArgumentException("Property is required for class Return.", nameof(varAbstract)); + + if (varLock.IsSet && varLock.Value == null) + throw new ArgumentNullException(nameof(varLock), "Property is not nullable for class Return."); + + if (varReturn.IsSet && varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); + + if (varUnsafe.IsSet && varUnsafe.Value == null) + throw new ArgumentNullException(nameof(varUnsafe), "Property is not nullable for class Return."); + + return new Return(varLock.Value!, varAbstract.Value!, varReturn, varUnsafe); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, varReturn, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) + { + if (varReturn.Lock == null) + throw new ArgumentNullException(nameof(varReturn.Lock), "Property is required for class Return."); + + if (varReturn.UnsafeOption.IsSet && varReturn.Unsafe == null) + throw new ArgumentNullException(nameof(varReturn.Unsafe), "Property is required for class Return."); + + writer.WriteString("lock", varReturn.Lock); + + if (varReturn.Abstract != null) + writer.WriteString("abstract", varReturn.Abstract); + else + writer.WriteNull("abstract"); + + if (varReturn.VarReturnOption.IsSet) + writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); + + if (varReturn.UnsafeOption.IsSet) + writer.WriteString("unsafe", varReturn.Unsafe); + } + } + + /// + /// The ReturnSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Return))] + public partial class ReturnSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs new file mode 100644 index 000000000000..8df9de9ae715 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -0,0 +1,214 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Role report Hash + /// + public partial class RolesReportsHash : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// role + /// roleUuid + [JsonConstructor] + public RolesReportsHash(Option role = default, Option roleUuid = default) + { + RoleOption = role; + RoleUuidOption = roleUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Role + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option RoleOption { get; private set; } + + /// + /// Gets or Sets Role + /// + [JsonPropertyName("role")] + public RolesReportsHashRole? Role { get { return this.RoleOption; } set { this.RoleOption = new(value); } } + + /// + /// Used to track the state of RoleUuid + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option RoleUuidOption { get; private set; } + + /// + /// Gets or Sets RoleUuid + /// + [JsonPropertyName("role_uuid")] + public Guid? RoleUuid { get { return this.RoleUuidOption; } set { this.RoleUuidOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RolesReportsHash {\n"); + sb.Append(" Role: ").Append(Role).Append("\n"); + sb.Append(" RoleUuid: ").Append(RoleUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RolesReportsHashJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option role = default; + Option roleUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "role": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "role_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + roleUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (role.IsSet && role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); + + if (roleUuid.IsSet && roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); + + return new RolesReportsHash(role, roleUuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, rolesReportsHash, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) + { + if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + + if (rolesReportsHash.RoleOption.IsSet) + { + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + } + if (rolesReportsHash.RoleUuidOption.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); + } + } + + /// + /// The RolesReportsHashSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(RolesReportsHash))] + public partial class RolesReportsHashSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs new file mode 100644 index 000000000000..ba4ac84d8e20 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -0,0 +1,184 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RolesReportsHashRole + /// + public partial class RolesReportsHashRole : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// name + [JsonConstructor] + public RolesReportsHashRole(Option name = default) + { + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RolesReportsHashRole {\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RolesReportsHashRoleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); + + return new RolesReportsHashRole(name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, rolesReportsHashRole, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) + { + if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + + if (rolesReportsHashRole.NameOption.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name); + } + } + + /// + /// The RolesReportsHashRoleSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(RolesReportsHashRole))] + public partial class RolesReportsHashRoleSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs new file mode 100644 index 000000000000..6ce8c2b68a1b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ScaleneTriangle + /// + public partial class ScaleneTriangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + /// triangleType + [JsonConstructor] + public ScaleneTriangle(string shapeType, string triangleType) + { + ShapeType = shapeType; + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ScaleneTriangle {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ScaleneTriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, scaleneTriangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) + { + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + + writer.WriteString("triangleType", scaleneTriangle.TriangleType); + } + } + + /// + /// The ScaleneTriangleSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ScaleneTriangle))] + public partial class ScaleneTriangleSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Shape.cs new file mode 100644 index 000000000000..71620d915bbb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Shape.cs @@ -0,0 +1,249 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Shape + /// + public partial class Shape : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Shape(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Shape(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle? Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral? Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Shape {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral? quadrilateral = null; + Triangle? triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("shapeType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("Quadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator?.Equals("Triangle") ?? false) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); + + if (quadrilateral != null) + return new Shape(quadrilateral); + + if (triangle != null) + return new Shape(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (shape.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, shape.Triangle, jsonSerializerOptions); + } + + if (shape.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shape.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, shape.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, shape, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The ShapeSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Shape))] + public partial class ShapeSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs new file mode 100644 index 000000000000..3070f52be3ac --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ShapeInterface + /// + public partial class ShapeInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// shapeType + [JsonConstructor] + public ShapeInterface(string shapeType) + { + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShapeInterface {\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + return new ShapeInterface(shapeType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, shapeInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + + writer.WriteString("shapeType", shapeInterface.ShapeType); + } + } + + /// + /// The ShapeInterfaceSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ShapeInterface))] + public partial class ShapeInterfaceSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeOrNull.cs new file mode 100644 index 000000000000..37b5fddee5e3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -0,0 +1,249 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// The value may be a shape or the 'null' value. This is introduced in OAS schema >= 3.1. + /// + public partial class ShapeOrNull : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public ShapeOrNull(Triangle triangle) + { + Triangle = triangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public ShapeOrNull(Quadrilateral quadrilateral) + { + Quadrilateral = quadrilateral; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets Triangle + /// + public Triangle? Triangle { get; set; } + + /// + /// Gets or Sets Quadrilateral + /// + public Quadrilateral? Quadrilateral { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ShapeOrNull {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ShapeOrNullJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option shapeType = default; + + Quadrilateral? quadrilateral = null; + Triangle? triangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("shapeType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("Quadrilateral") ?? false) + { + Utf8JsonReader utf8JsonReaderQuadrilateral = utf8JsonReader; + quadrilateral = JsonSerializer.Deserialize(ref utf8JsonReaderQuadrilateral, jsonSerializerOptions); + } + if (discriminator?.Equals("Triangle") ?? false) + { + Utf8JsonReader utf8JsonReaderTriangle = utf8JsonReader; + triangle = JsonSerializer.Deserialize(ref utf8JsonReaderTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); + + if (quadrilateral != null) + return new ShapeOrNull(quadrilateral); + + if (triangle != null) + return new ShapeOrNull(triangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (shapeOrNull.Triangle != null) + { + TriangleJsonConverter triangleJsonConverter = (TriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Triangle.GetType())); + triangleJsonConverter.WriteProperties(writer, shapeOrNull.Triangle, jsonSerializerOptions); + } + + if (shapeOrNull.Quadrilateral != null) + { + QuadrilateralJsonConverter quadrilateralJsonConverter = (QuadrilateralJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(shapeOrNull.Quadrilateral.GetType())); + quadrilateralJsonConverter.WriteProperties(writer, shapeOrNull.Quadrilateral, jsonSerializerOptions); + } + + WriteProperties(writer, shapeOrNull, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The ShapeOrNullSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ShapeOrNull))] + public partial class ShapeOrNullSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs new file mode 100644 index 000000000000..61ff978f3c24 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -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 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// SimpleQuadrilateral + /// + public partial class SimpleQuadrilateral : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// quadrilateralType + /// shapeType + [JsonConstructor] + public SimpleQuadrilateral(string quadrilateralType, string shapeType) + { + QuadrilateralType = quadrilateralType; + ShapeType = shapeType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets QuadrilateralType + /// + [JsonPropertyName("quadrilateralType")] + public string QuadrilateralType { get; set; } + + /// + /// Gets or Sets ShapeType + /// + [JsonPropertyName("shapeType")] + public string ShapeType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SimpleQuadrilateral {\n"); + sb.Append(" QuadrilateralType: ").Append(QuadrilateralType).Append("\n"); + sb.Append(" ShapeType: ").Append(ShapeType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SimpleQuadrilateralJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option quadrilateralType = default; + Option shapeType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "quadrilateralType": + quadrilateralType = new Option(utf8JsonReader.GetString()!); + break; + case "shapeType": + shapeType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); + + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, simpleQuadrilateral, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) + { + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + } + } + + /// + /// The SimpleQuadrilateralSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(SimpleQuadrilateral))] + public partial class SimpleQuadrilateralSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs new file mode 100644 index 000000000000..c72f3539283b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -0,0 +1,211 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// SpecialModelName + /// + public partial class SpecialModelName : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// varSpecialModelName + /// specialPropertyName + [JsonConstructor] + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) + { + VarSpecialModelNameOption = varSpecialModelName; + SpecialPropertyNameOption = specialPropertyName; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of VarSpecialModelName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option VarSpecialModelNameOption { get; private set; } + + /// + /// Gets or Sets VarSpecialModelName + /// + [JsonPropertyName("_special_model.name_")] + public string? VarSpecialModelName { get { return this.VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } + + /// + /// Used to track the state of SpecialPropertyName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SpecialPropertyNameOption { get; private set; } + + /// + /// Gets or Sets SpecialPropertyName + /// + [JsonPropertyName("$special[property.name]")] + public long? SpecialPropertyName { get { return this.SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class SpecialModelName {\n"); + sb.Append(" VarSpecialModelName: ").Append(VarSpecialModelName).Append("\n"); + sb.Append(" SpecialPropertyName: ").Append(SpecialPropertyName).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class SpecialModelNameJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option varSpecialModelName = default; + Option specialPropertyName = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "_special_model.name_": + varSpecialModelName = new Option(utf8JsonReader.GetString()!); + break; + case "$special[property.name]": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + specialPropertyName = new Option(utf8JsonReader.GetInt64()); + break; + default: + break; + } + } + } + + if (varSpecialModelName.IsSet && varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); + + if (specialPropertyName.IsSet && specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); + + return new SpecialModelName(varSpecialModelName, specialPropertyName); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, specialModelName, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) + { + if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + + if (specialModelName.VarSpecialModelNameOption.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); + + if (specialModelName.SpecialPropertyNameOption.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); + } + } + + /// + /// The SpecialModelNameSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(SpecialModelName))] + public partial class SpecialModelNameSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs new file mode 100644 index 000000000000..9ac29533f720 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Tag.cs @@ -0,0 +1,211 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Tag + /// + public partial class Tag : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// id + /// name + [JsonConstructor] + public Tag(Option id = default, Option name = default) + { + IdOption = id; + NameOption = name; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NameOption { get; private set; } + + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string? Name { get { return this.NameOption; } set { this.NameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Tag {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TagJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option id = default; + Option name = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); + + return new Tag(id, name); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, tag, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) + { + if (tag.NameOption.IsSet && tag.Name == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + + if (tag.IdOption.IsSet) + writer.WriteNumber("id", tag.IdOption.Value!.Value); + + if (tag.NameOption.IsSet) + writer.WriteString("name", tag.Name); + } + } + + /// + /// The TagSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Tag))] + public partial class TagSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs new file mode 100644 index 000000000000..b5f8d88ed68d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -0,0 +1,184 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestCollectionEndingWithWordList + /// + public partial class TestCollectionEndingWithWordList : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// value + [JsonConstructor] + public TestCollectionEndingWithWordList(Option value = default) + { + ValueOption = value; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Value + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ValueOption { get; private set; } + + /// + /// Gets or Sets Value + /// + [JsonPropertyName("value")] + public string? Value { get { return this.ValueOption; } set { this.ValueOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestCollectionEndingWithWordList {\n"); + sb.Append(" Value: ").Append(Value).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestCollectionEndingWithWordListJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option value = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "value": + value = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (value.IsSet && value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); + + return new TestCollectionEndingWithWordList(value); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testCollectionEndingWithWordList, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) + { + if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + + if (testCollectionEndingWithWordList.ValueOption.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value); + } + } + + /// + /// The TestCollectionEndingWithWordListSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(TestCollectionEndingWithWordList))] + public partial class TestCollectionEndingWithWordListSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs new file mode 100644 index 000000000000..bfc3a14472d7 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestCollectionEndingWithWordListObject + /// + public partial class TestCollectionEndingWithWordListObject : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// testCollectionEndingWithWordList + [JsonConstructor] + public TestCollectionEndingWithWordListObject(Option?> testCollectionEndingWithWordList = default) + { + TestCollectionEndingWithWordListOption = testCollectionEndingWithWordList; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of TestCollectionEndingWithWordList + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option?> TestCollectionEndingWithWordListOption { get; private set; } + + /// + /// Gets or Sets TestCollectionEndingWithWordList + /// + [JsonPropertyName("TestCollectionEndingWithWordList")] + public List? TestCollectionEndingWithWordList { get { return this.TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestCollectionEndingWithWordListObject {\n"); + sb.Append(" TestCollectionEndingWithWordList: ").Append(TestCollectionEndingWithWordList).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestCollectionEndingWithWordListObjectJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option?> testCollectionEndingWithWordList = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "TestCollectionEndingWithWordList": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + default: + break; + } + } + } + + if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); + + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testCollectionEndingWithWordListObject, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) + { + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) + { + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + } + } + } + + /// + /// The TestCollectionEndingWithWordListObjectSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(TestCollectionEndingWithWordListObject))] + public partial class TestCollectionEndingWithWordListObjectSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs new file mode 100644 index 000000000000..de60d7c2281f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -0,0 +1,184 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TestInlineFreeformAdditionalPropertiesRequest + /// + public partial class TestInlineFreeformAdditionalPropertiesRequest : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// someProperty + [JsonConstructor] + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) + { + SomePropertyOption = someProperty; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of SomeProperty + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option SomePropertyOption { get; private set; } + + /// + /// Gets or Sets SomeProperty + /// + [JsonPropertyName("someProperty")] + public string? SomeProperty { get { return this.SomePropertyOption; } set { this.SomePropertyOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TestInlineFreeformAdditionalPropertiesRequest {\n"); + sb.Append(" SomeProperty: ").Append(SomeProperty).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TestInlineFreeformAdditionalPropertiesRequestJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option someProperty = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "someProperty": + someProperty = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (someProperty.IsSet && someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); + + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, testInlineFreeformAdditionalPropertiesRequest, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) + { + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + } + } + + /// + /// The TestInlineFreeformAdditionalPropertiesRequestSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(TestInlineFreeformAdditionalPropertiesRequest))] + public partial class TestInlineFreeformAdditionalPropertiesRequestSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Triangle.cs new file mode 100644 index 000000000000..5c2490410259 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Triangle.cs @@ -0,0 +1,279 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Triangle + /// + public partial class Triangle : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(EquilateralTriangle equilateralTriangle) + { + EquilateralTriangle = equilateralTriangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(IsoscelesTriangle isoscelesTriangle) + { + IsoscelesTriangle = isoscelesTriangle; + OnCreated(); + } + + /// + /// Initializes a new instance of the class. + /// + /// + public Triangle(ScaleneTriangle scaleneTriangle) + { + ScaleneTriangle = scaleneTriangle; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets EquilateralTriangle + /// + public EquilateralTriangle? EquilateralTriangle { get; set; } + + /// + /// Gets or Sets IsoscelesTriangle + /// + public IsoscelesTriangle? IsoscelesTriangle { get; set; } + + /// + /// Gets or Sets ScaleneTriangle + /// + public ScaleneTriangle? ScaleneTriangle { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Triangle {\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + return this.BaseValidate(validationContext); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + protected IEnumerable BaseValidate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TriangleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option triangleType = default; + + EquilateralTriangle? equilateralTriangle = null; + IsoscelesTriangle? isoscelesTriangle = null; + ScaleneTriangle? scaleneTriangle = null; + + Utf8JsonReader utf8JsonReaderDiscriminator = utf8JsonReader; + while (utf8JsonReaderDiscriminator.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReaderDiscriminator.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth) + break; + + if (utf8JsonReaderDiscriminator.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReaderDiscriminator.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReaderDiscriminator.GetString(); + utf8JsonReaderDiscriminator.Read(); + if (localVarJsonPropertyName?.Equals("triangleType") ?? false) + { + string? discriminator = utf8JsonReaderDiscriminator.GetString(); + if (discriminator?.Equals("EquilateralTriangle") ?? false) + { + Utf8JsonReader utf8JsonReaderEquilateralTriangle = utf8JsonReader; + equilateralTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderEquilateralTriangle, jsonSerializerOptions); + } + if (discriminator?.Equals("IsoscelesTriangle") ?? false) + { + Utf8JsonReader utf8JsonReaderIsoscelesTriangle = utf8JsonReader; + isoscelesTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderIsoscelesTriangle, jsonSerializerOptions); + } + if (discriminator?.Equals("ScaleneTriangle") ?? false) + { + Utf8JsonReader utf8JsonReaderScaleneTriangle = utf8JsonReader; + scaleneTriangle = JsonSerializer.Deserialize(ref utf8JsonReaderScaleneTriangle, jsonSerializerOptions); + } + } + } + } + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); + + if (equilateralTriangle != null) + return new Triangle(equilateralTriangle); + + if (isoscelesTriangle != null) + return new Triangle(isoscelesTriangle); + + if (scaleneTriangle != null) + return new Triangle(scaleneTriangle); + + throw new JsonException(); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + if (triangle.EquilateralTriangle != null) + { + EquilateralTriangleJsonConverter equilateralTriangleJsonConverter = (EquilateralTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.EquilateralTriangle.GetType())); + equilateralTriangleJsonConverter.WriteProperties(writer, triangle.EquilateralTriangle, jsonSerializerOptions); + } + + if (triangle.IsoscelesTriangle != null) + { + IsoscelesTriangleJsonConverter isoscelesTriangleJsonConverter = (IsoscelesTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.IsoscelesTriangle.GetType())); + isoscelesTriangleJsonConverter.WriteProperties(writer, triangle.IsoscelesTriangle, jsonSerializerOptions); + } + + if (triangle.ScaleneTriangle != null) + { + ScaleneTriangleJsonConverter scaleneTriangleJsonConverter = (ScaleneTriangleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(triangle.ScaleneTriangle.GetType())); + scaleneTriangleJsonConverter.WriteProperties(writer, triangle.ScaleneTriangle, jsonSerializerOptions); + } + + WriteProperties(writer, triangle, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) + { + + } + } + + /// + /// The TriangleSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Triangle))] + public partial class TriangleSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs new file mode 100644 index 000000000000..a2ef4da28f5a --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -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: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// TriangleInterface + /// + public partial class TriangleInterface : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// triangleType + [JsonConstructor] + public TriangleInterface(string triangleType) + { + TriangleType = triangleType; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets TriangleType + /// + [JsonPropertyName("triangleType")] + public string TriangleType { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class TriangleInterface {\n"); + sb.Append(" TriangleType: ").Append(TriangleType).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class TriangleInterfaceJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option triangleType = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "triangleType": + triangleType = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + return new TriangleInterface(triangleType.Value!); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, triangleInterface, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) + { + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + + writer.WriteString("triangleType", triangleInterface.TriangleType); + } + } + + /// + /// The TriangleInterfaceSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(TriangleInterface))] + public partial class TriangleInterfaceSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs new file mode 100644 index 000000000000..6692b4f25093 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/User.cs @@ -0,0 +1,507 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// User + /// + public partial class User : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// 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 + /// 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. + /// email + /// firstName + /// id + /// lastName + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// password + /// phone + /// User Status + /// username + [JsonConstructor] + public User(Option anyTypeProp = default, Option anyTypePropNullable = default, Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option objectWithNoDeclaredPropsNullable = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default) + { + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; + EmailOption = email; + FirstNameOption = firstName; + IdOption = id; + LastNameOption = lastName; + ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; + PasswordOption = password; + PhoneOption = phone; + UserStatusOption = userStatus; + UsernameOption = username; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropOption { get; private set; } + + /// + /// 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 + /// + /// 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 + [JsonPropertyName("anyTypeProp")] + public Object? AnyTypeProp { get { return this.AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropNullableOption { get; private set; } + + /// + /// 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. + /// + /// 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. + [JsonPropertyName("anyTypePropNullable")] + public Object? AnyTypePropNullable { get { return this.AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } + + /// + /// Used to track the state of Email + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option EmailOption { get; private set; } + + /// + /// Gets or Sets Email + /// + [JsonPropertyName("email")] + public string? Email { get { return this.EmailOption; } set { this.EmailOption = new(value); } } + + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option FirstNameOption { get; private set; } + + /// + /// Gets or Sets FirstName + /// + [JsonPropertyName("firstName")] + public string? FirstName { get { return this.FirstNameOption; } set { this.FirstNameOption = new(value); } } + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option IdOption { get; private set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this.IdOption; } set { this.IdOption = new(value); } } + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option LastNameOption { get; private set; } + + /// + /// Gets or Sets LastName + /// + [JsonPropertyName("lastName")] + public string? LastName { get { return this.LastNameOption; } set { this.LastNameOption = new(value); } } + + /// + /// Used to track the state of ObjectWithNoDeclaredProps + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsOption { get; private set; } + + /// + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// + /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + [JsonPropertyName("objectWithNoDeclaredProps")] + public Object? ObjectWithNoDeclaredProps { get { return this.ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } + + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } + + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + [JsonPropertyName("objectWithNoDeclaredPropsNullable")] + public Object? ObjectWithNoDeclaredPropsNullable { get { return this.ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } + + /// + /// Used to track the state of Password + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PasswordOption { get; private set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string? Password { get { return this.PasswordOption; } set { this.PasswordOption = new(value); } } + + /// + /// Used to track the state of Phone + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option PhoneOption { get; private set; } + + /// + /// Gets or Sets Phone + /// + [JsonPropertyName("phone")] + public string? Phone { get { return this.PhoneOption; } set { this.PhoneOption = new(value); } } + + /// + /// Used to track the state of UserStatus + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UserStatusOption { get; private set; } + + /// + /// User Status + /// + /// User Status + [JsonPropertyName("userStatus")] + public int? UserStatus { get { return this.UserStatusOption; } set { this.UserStatusOption = new(value); } } + + /// + /// Used to track the state of Username + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option UsernameOption { get; private set; } + + /// + /// Gets or Sets Username + /// + [JsonPropertyName("username")] + public string? Username { get { return this.UsernameOption; } set { this.UsernameOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class User {\n"); + sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); + sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append("\n"); + sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); + sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class UserJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option objectWithNoDeclaredPropsNullable = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "anyTypeProp": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "anyTypePropNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "email": + email = new Option(utf8JsonReader.GetString()!); + break; + case "firstName": + firstName = new Option(utf8JsonReader.GetString()!); + break; + case "id": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + id = new Option(utf8JsonReader.GetInt64()); + break; + case "lastName": + lastName = new Option(utf8JsonReader.GetString()!); + break; + case "objectWithNoDeclaredProps": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "objectWithNoDeclaredPropsNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "password": + password = new Option(utf8JsonReader.GetString()!); + break; + case "phone": + phone = new Option(utf8JsonReader.GetString()!); + break; + case "userStatus": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + userStatus = new Option(utf8JsonReader.GetInt32()); + break; + case "username": + username = new Option(utf8JsonReader.GetString()!); + break; + default: + break; + } + } + } + + if (email.IsSet && email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); + + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); + + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); + + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); + + if (objectWithNoDeclaredProps.IsSet && objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); + + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); + + if (phone.IsSet && phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); + + if (userStatus.IsSet && userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); + + if (username.IsSet && username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); + + return new User(anyTypeProp, anyTypePropNullable, email, firstName, id, lastName, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, password, phone, userStatus, username); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, user, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) + { + if (user.EmailOption.IsSet && user.Email == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstNameOption.IsSet && user.FirstName == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastNameOption.IsSet && user.LastName == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.PasswordOption.IsSet && user.Password == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.PhoneOption.IsSet && user.Phone == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.UsernameOption.IsSet && user.Username == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + + if (user.AnyTypePropOption.IsSet) + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.EmailOption.IsSet) + writer.WriteString("email", user.Email); + + if (user.FirstNameOption.IsSet) + writer.WriteString("firstName", user.FirstName); + + if (user.IdOption.IsSet) + writer.WriteNumber("id", user.IdOption.Value!.Value); + + if (user.LastNameOption.IsSet) + writer.WriteString("lastName", user.LastName); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet) + { + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + } + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); + if (user.PasswordOption.IsSet) + writer.WriteString("password", user.Password); + + if (user.PhoneOption.IsSet) + writer.WriteString("phone", user.Phone); + + if (user.UserStatusOption.IsSet) + writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); + + if (user.UsernameOption.IsSet) + writer.WriteString("username", user.Username); + } + } + + /// + /// The UserSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(User))] + public partial class UserSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs new file mode 100644 index 000000000000..f3f3e60766df --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Whale.cs @@ -0,0 +1,233 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Whale + /// + public partial class Whale : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + /// hasBaleen + /// hasTeeth + [JsonConstructor] + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) + { + ClassName = className; + HasBaleenOption = hasBaleen; + HasTeethOption = hasTeeth; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Used to track the state of HasBaleen + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option HasBaleenOption { get; private set; } + + /// + /// Gets or Sets HasBaleen + /// + [JsonPropertyName("hasBaleen")] + public bool? HasBaleen { get { return this.HasBaleenOption; } set { this.HasBaleenOption = new(value); } } + + /// + /// Used to track the state of HasTeeth + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option HasTeethOption { get; private set; } + + /// + /// Gets or Sets HasTeeth + /// + [JsonPropertyName("hasTeeth")] + public bool? HasTeeth { get { return this.HasTeethOption; } set { this.HasTeethOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Whale {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" HasBaleen: ").Append(HasBaleen).Append("\n"); + sb.Append(" HasTeeth: ").Append(HasTeeth).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class WhaleJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "hasBaleen": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + hasBaleen = new Option(utf8JsonReader.GetBoolean()); + break; + case "hasTeeth": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + hasTeeth = new Option(utf8JsonReader.GetBoolean()); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Whale.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); + + if (hasBaleen.IsSet && hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); + + if (hasTeeth.IsSet && hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); + + return new Whale(className.Value!, hasBaleen, hasTeeth); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, whale, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) + { + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + + writer.WriteString("className", whale.ClassName); + + if (whale.HasBaleenOption.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); + + if (whale.HasTeethOption.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); + } + } + + /// + /// The WhaleSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Whale))] + public partial class WhaleSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs new file mode 100644 index 000000000000..0d0e7222c42b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/Zebra.cs @@ -0,0 +1,287 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Zebra + /// + public partial class Zebra : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// className + /// type + [JsonConstructor] + public Zebra(string className, Option type = default) + { + ClassName = className; + TypeOption = type; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines Type + /// + public enum TypeEnum + { + /// + /// Enum Plains for value: plains + /// + Plains = 1, + + /// + /// Enum Mountain for value: mountain + /// + Mountain = 2, + + /// + /// Enum Grevys for value: grevys + /// + Grevys = 3 + } + + /// + /// Returns a + /// + /// + /// + /// + public static TypeEnum TypeEnumFromString(string value) + { + if (value.Equals("plains")) + return TypeEnum.Plains; + + if (value.Equals("mountain")) + return TypeEnum.Mountain; + + if (value.Equals("grevys")) + return TypeEnum.Grevys; + + throw new NotImplementedException($"Could not convert value to type TypeEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static TypeEnum? TypeEnumFromStringOrDefault(string value) + { + if (value.Equals("plains")) + return TypeEnum.Plains; + + if (value.Equals("mountain")) + return TypeEnum.Mountain; + + if (value.Equals("grevys")) + return TypeEnum.Grevys; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string TypeEnumToJsonValue(TypeEnum? value) + { + if (value == TypeEnum.Plains) + return "plains"; + + if (value == TypeEnum.Mountain) + return "mountain"; + + if (value == TypeEnum.Grevys) + return "grevys"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TypeOption { get; private set; } + + /// + /// Gets or Sets Type + /// + [JsonPropertyName("type")] + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } + + /// + /// Gets or Sets ClassName + /// + [JsonPropertyName("className")] + public string ClassName { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class Zebra {\n"); + sb.Append(" ClassName: ").Append(ClassName).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ZebraJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option className = default; + Option type = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "className": + className = new Option(utf8JsonReader.GetString()!); + break; + case "type": + string? typeRawValue = utf8JsonReader.GetString(); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); + break; + default: + break; + } + } + } + + if (!className.IsSet) + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); + + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + + return new Zebra(className.Value!, type); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, zebra, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) + { + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + + writer.WriteString("className", zebra.ClassName); + + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); + writer.WriteString("type", typeRawValue); + } + } + + /// + /// The ZebraSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(Zebra))] + public partial class ZebraSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs new file mode 100644 index 000000000000..15c22d0fc3b0 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -0,0 +1,185 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + } + + /// + /// Converts to and from the JSON value + /// + public static class ZeroBasedEnumValueConverter + { + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnum FromString(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnum: '{value}'"); + } + + /// + /// Parses a given value to + /// + /// + /// + public static ZeroBasedEnum? FromStringOrDefault(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnum.NotUnknown; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ToJsonValue(ZeroBasedEnum value) + { + if (value == ZeroBasedEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + } + + /// + /// A Json converter for type + /// + /// + public class ZeroBasedEnumJsonConverter : JsonConverter + { + /// + /// Returns a from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnum Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + ZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the ZeroBasedEnum to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnum zeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnum.ToString()); + } + } + + /// + /// A Json converter for type + /// + public class ZeroBasedEnumNullableJsonConverter : JsonConverter + { + /// + /// Returns a ZeroBasedEnum from the Json object + /// + /// + /// + /// + /// + public override ZeroBasedEnum? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + string? rawValue = reader.GetString(); + + ZeroBasedEnum? result = rawValue == null + ? null + : ZeroBasedEnumValueConverter.FromStringOrDefault(rawValue); + + if (result != null) + return result.Value; + + throw new JsonException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnum? zeroBasedEnum, JsonSerializerOptions options) + { + writer.WriteStringValue(zeroBasedEnum?.ToString() ?? "null"); + } + } + + + /// + /// The ZeroBasedEnumSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ZeroBasedEnum))] + public partial class ZeroBasedEnumSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs new file mode 100644 index 000000000000..74792442fd0e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -0,0 +1,249 @@ +// +/* + * OpenAPI Petstore + * + * 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 + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// ZeroBasedEnumClass + /// + public partial class ZeroBasedEnumClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// zeroBasedEnum + [JsonConstructor] + public ZeroBasedEnumClass(Option zeroBasedEnum = default) + { + ZeroBasedEnumOption = zeroBasedEnum; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines ZeroBasedEnum + /// + public enum ZeroBasedEnumEnum + { + /// + /// Enum Unknown for value: unknown + /// + Unknown, + + /// + /// Enum NotUnknown for value: notUnknown + /// + NotUnknown + } + + /// + /// Returns a + /// + /// + /// + /// + public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnumEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnumEnum.NotUnknown; + + throw new NotImplementedException($"Could not convert value to type ZeroBasedEnumEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static ZeroBasedEnumEnum? ZeroBasedEnumEnumFromStringOrDefault(string value) + { + if (value.Equals("unknown")) + return ZeroBasedEnumEnum.Unknown; + + if (value.Equals("notUnknown")) + return ZeroBasedEnumEnum.NotUnknown; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) + { + if (value == ZeroBasedEnumEnum.Unknown) + return "unknown"; + + if (value == ZeroBasedEnumEnum.NotUnknown) + return "notUnknown"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of ZeroBasedEnum + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option ZeroBasedEnumOption { get; private set; } + + /// + /// Gets or Sets ZeroBasedEnum + /// + [JsonPropertyName("ZeroBasedEnum")] + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ZeroBasedEnumClass {\n"); + sb.Append(" ZeroBasedEnum: ").Append(ZeroBasedEnum).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class ZeroBasedEnumClassJsonConverter : JsonConverter + { + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option zeroBasedEnum = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "ZeroBasedEnum": + string? zeroBasedEnumRawValue = utf8JsonReader.GetString(); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); + break; + default: + break; + } + } + } + + if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); + + return new ZeroBasedEnumClass(zeroBasedEnum); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, zeroBasedEnumClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) + { + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); + writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); + } + } + + /// + /// The ZeroBasedEnumClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(ZeroBasedEnumClass))] + public partial class ZeroBasedEnumClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..36cbc4f59ca3 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,32 @@ + + + + true + net9.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + enable + false + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..b0c1678a304f --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/README.md @@ -0,0 +1,223 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net9.0', + 'validatable=true', + 'nullableReferenceTypes=true', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + Call123TestSpecialTagsApiResponse apiResponse = await api.Call123TestSpecialTagsAsync("todo"); + ModelClient model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + // the type of token here depends on the api security specifications + ApiKeyToken token = new("", ClientUtils.ApiKeyHeader.Authorization); + options.AddTokens(token); + + // optionally choose the method the tokens will be provided with, default is RateLimitProvider + options.UseProvider, ApiKeyToken>(); + + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + + +Authentication schemes defined for the API: + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: +- write:pets: modify pets in your account +- read:pets: read your pets + + +### api_key + +- **Type**: API key +- **API key parameter name**: api-key +- **Location**: HTTP header + + +### api_key_query + +- **Type**: API key +- **API key parameter name**: api_key_query +- **Location**: URL query string + + +### http_basic_test + +- **Type**: HTTP basic authentication + + +### bearer_test + +- **Type**: Bearer Authentication + + +### http_signature_test + +- **Type**: HTTP signature authentication + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.11.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: OpenAPI Petstore +- appVersion: 1.0.0 +- appDescription: This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: false +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: true +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {321C8C3F-0156-40C1-AE42-D59761FB9B6C} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net9.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.gitignore b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.openapi-generator-ignore b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.openapi-generator/FILES new file mode 100644 index 000000000000..5abbcf46f35c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.openapi-generator/FILES @@ -0,0 +1,36 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/apis/DefaultApi.md +docs/models/NowGet200Response.md +docs/scripts/git_push.ps1 +docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools.Test/README.md +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/IApi.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiFactory.cs +src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs +src/Org.OpenAPITools/Client/ApiResponse`1.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/CookieContainer.cs +src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs +src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs +src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +src/Org.OpenAPITools/Client/HostConfiguration.cs +src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs +src/Org.OpenAPITools/Client/Option.cs +src/Org.OpenAPITools/Client/RateLimitProvider`1.cs +src/Org.OpenAPITools/Client/TokenBase.cs +src/Org.OpenAPITools/Client/TokenContainer`1.cs +src/Org.OpenAPITools/Client/TokenProvider`1.cs +src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs +src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs +src/Org.OpenAPITools/Model/NowGet200Response.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj +src/Org.OpenAPITools/README.md diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.openapi-generator/VERSION b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/Org.OpenAPITools.sln b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/Org.OpenAPITools.sln new file mode 100644 index 000000000000..547505a9856b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E60EF87-DB0B-4D01-A36E-F5E90F7EC757}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/README.md b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/README.md new file mode 100644 index 000000000000..f9c1c7f74621 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/README.md @@ -0,0 +1 @@ +# Created with Openapi Generator diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/api/openapi.yaml similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/api/openapi.yaml rename to samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/api/openapi.yaml diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/appveyor.yml b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/apis/DefaultApi.md b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/apis/DefaultApi.md new file mode 100644 index 000000000000..6b1991021ac2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/apis/DefaultApi.md @@ -0,0 +1,90 @@ +# Org.OpenAPITools.Api.DefaultApi + +All URIs are relative to *http://localhost* + +| Method | HTTP request | Description | +|--------|--------------|-------------| +| [**NowGet**](DefaultApi.md#nowget) | **GET** /now | | + + +# **NowGet** +> NowGet200Response NowGet () + + + +### Example +```csharp +using System.Collections.Generic; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class NowGetExample + { + public static void Main() + { + Configuration config = new Configuration(); + config.BasePath = "http://localhost"; + var apiInstance = new DefaultApi(config); + + try + { + NowGet200Response result = apiInstance.NowGet(); + Debug.WriteLine(result); + } + catch (ApiException e) + { + Debug.Print("Exception when calling DefaultApi.NowGet: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); + } + } + } +} +``` + +#### Using the NowGetWithHttpInfo variant +This returns an ApiResponse object which contains the response data, status code and headers. + +```csharp +try +{ + ApiResponse response = apiInstance.NowGetWithHttpInfo(); + Debug.Write("Status Code: " + response.StatusCode); + Debug.Write("Response Headers: " + response.Headers); + Debug.Write("Response Body: " + response.Data); +} +catch (ApiException e) +{ + Debug.Print("Exception when calling DefaultApi.NowGetWithHttpInfo: " + e.Message); + Debug.Print("Status Code: " + e.ErrorCode); + Debug.Print(e.StackTrace); +} +``` + +### Parameters +This endpoint does not need any parameter. +### Return type + +[**NowGet200Response**](NowGet200Response.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + + +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | now dates | - | + +[[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/csharp/generichost/net9/UseDateTimeForDate/docs/models/NowGet200Response.md b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/models/NowGet200Response.md new file mode 100644 index 000000000000..58b6c7c79f01 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/models/NowGet200Response.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.NowGet200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Now** | **DateTime** | | [optional] +**Today** | **DateTime** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/scripts/git_push.ps1 b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/scripts/git_push.ps1 new file mode 100644 index 000000000000..73ed35c2bb10 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/scripts/git_push.ps1 @@ -0,0 +1,75 @@ +param( + [Parameter()][Alias("g")][String]$GitHost = "github.com", + [Parameter()][Alias("u")][String]$GitUserId = "GIT_USER_ID", + [Parameter()][Alias("r")][String]$GitRepoId = "GIT_REPO_ID", + [Parameter()][Alias("m")][string]$Message = "Minor update", + [Parameter()][Alias("h")][switch]$Help +) + +function Publish-ToGitHost{ + if ([string]::IsNullOrWhiteSpace($Message) -or $Message -eq "Minor update"){ + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + $Message = Read-Host -Prompt "Please provide a commit message or press enter" + $Message = if([string]::IsNullOrWhiteSpace($Message)) { "no message provided" } else { $Message } + } + + git init + git add . + git commit -am "${Message}" + $branchName=$(git rev-parse --abbrev-ref HEAD) + $gitRemote=$(git remote) + + if([string]::IsNullOrWhiteSpace($gitRemote)){ + git remote add origin https://${GitHost}/${GitUserId}/${GitRepoId}.git + } + + Write-Output "Pulling from https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git pull origin $branchName --ff-only + + if ($LastExitCode -ne 0){ + if (${GitHost} -eq "github.com"){ + Write-Output "The ${GitRepoId} repository may not exist yet. Creating it now with the GitHub CLI." + gh auth login --hostname github.com --web + gh repo create $GitRepoId --private + # sleep 2 seconds to ensure git finishes creation of the repo + Start-Sleep -Seconds 2 + } + else{ + throw "There was an issue pulling the origin branch. The remote repository may not exist yet." + } + } + + Write-Output "Pushing to https://${GitHost}/${GitUserId}/${GitRepoId}.git" + git push origin $branchName +} + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 + +if ($Help){ + Write-Output " + This script will initialize a git repository, then add and commit all files. + The local repository will then be pushed to your preferred git provider. + If the remote repository does not exist yet and you are using GitHub, + the repository will be created for you provided you have the GitHub CLI installed. + + Parameters: + -g | -GitHost -> ex: github.com + -m | -Message -> the git commit message + -r | -GitRepoId -> the name of the repository + -u | -GitUserId -> your user id + " + + return +} + +$rootPath=Resolve-Path -Path $PSScriptRoot/../.. + +Push-Location $rootPath + +try { + Publish-ToGitHost $GitHost $GitUserId $GitRepoId $Message +} +finally{ + Pop-Location +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/scripts/git_push.sh b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/scripts/git_push.sh new file mode 100644 index 000000000000..882104922184 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/docs/scripts/git_push.sh @@ -0,0 +1,49 @@ +#!/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_USER_ID} +git_repo_id=${2:-GIT_REPO_ID} +release_note=${3:-Minor update} +git_host=${4:-github.com} + +starting_directory=$(pwd) +script_root="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" +cd $script_root +cd ../.. + +if [ "$release_note" = "" ] || [ "$release_note" = "Minor update" ]; then + # it seems unlikely that we would want our git commit message to be the default, so lets prompt the user + echo "Please provide a commit message or press enter" + read user_input + release_note=$user_input + if [ "$release_note" = "" ]; then + release_note="no message provided" + fi +fi + +git init +git add . +git commit -am "$release_note" +branch_name=$(git rev-parse --abbrev-ref HEAD) +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 + +echo "[INFO] Pulling from https://${git_host}/${git_user_id}/${git_repo_id}.git" +git pull origin $branch_name --ff-only + +echo "[INFO] Pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin $branch_name + +cd $starting_directory diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs new file mode 100644 index 000000000000..40e1298ee62c --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -0,0 +1,58 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Security.Cryptography; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Extensions; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Base class for API tests + /// + public class ApiTestsBase + { + protected readonly IHost _host; + + public ApiTestsBase(string[] args) + { + _host = CreateHostBuilder(args).Build(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, services, options) => + { + + }); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs new file mode 100644 index 000000000000..05dc933c03b1 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs @@ -0,0 +1,64 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Xunit; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + + +/* ********************************************************************************* +* Follow these manual steps to construct tests. +* This file will not be overwritten. +* ********************************************************************************* +* 1. Navigate to ApiTests.Base.cs and ensure any tokens are being created correctly. +* Take care not to commit credentials to any repository. +* +* 2. Mocking is coordinated by ApiTestsBase#AddApiHttpClients. +* To mock the client, use the generic AddApiHttpClients. +* To mock the server, change the client's BaseAddress. +* +* 3. Locate the test you want below +* - remove the skip property from the Fact attribute +* - set the value of any variables if necessary +* +* 4. Run the tests and ensure they work. +* +*/ + + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Class for testing DefaultApi + /// + public sealed class DefaultApiTests : ApiTestsBase + { + private readonly IDefaultApi _instance; + + public DefaultApiTests(): base(Array.Empty()) + { + _instance = _host.Services.GetRequiredService(); + } + + /// + /// Test NowGet + /// + [Fact (Skip = "not implemented")] + public async Task NowGetAsyncTest() + { + var response = await _instance.NowGetAsync(); + var model = response.Ok(); + Assert.IsType(model); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs new file mode 100644 index 000000000000..c910325e620b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -0,0 +1,103 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using System.Security.Cryptography; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Extensions; +using Xunit; + +namespace Org.OpenAPITools.Test.Api +{ + /// + /// Tests the dependency injection. + /// + public class DependencyInjectionTest + { + private readonly IHost _hostUsingConfigureWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + }) + .Build(); + + private readonly IHost _hostUsingConfigureWithAClient = + Host.CreateDefaultBuilder([]).ConfigureApi((context, services, options) => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }) + .Build(); + + private readonly IHost _hostUsingAddWithoutAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + }); + }) + .Build(); + + private readonly IHost _hostUsingAddWithAClient = + Host.CreateDefaultBuilder([]).ConfigureServices((host, services) => + { + services.AddApi(options => + { + + options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); + }); + }) + .Build(); + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithAClientTest() + { + var defaultApi = _hostUsingConfigureWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the configure method + /// + [Fact] + public void ConfigureApiWithoutAClientTest() + { + var defaultApi = _hostUsingConfigureWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithAClientTest() + { + var defaultApi = _hostUsingAddWithAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + + /// + /// Test dependency injection when using the add method + /// + [Fact] + public void AddApiWithoutAClientTest() + { + var defaultApi = _hostUsingAddWithoutAClient.Services.GetRequiredService(); + Assert.True(defaultApi.HttpClient.BaseAddress != null); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Model/NowGet200ResponseTests.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Model/NowGet200ResponseTests.cs new file mode 100644 index 000000000000..920dfd9700ea --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Model/NowGet200ResponseTests.cs @@ -0,0 +1,74 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing NowGet200Response + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class NowGet200ResponseTests : IDisposable + { + // TODO uncomment below to declare an instance variable for NowGet200Response + //private NowGet200Response instance; + + public NowGet200ResponseTests() + { + // TODO uncomment below to create an instance of NowGet200Response + //instance = new NowGet200Response(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of NowGet200Response + /// + [Fact] + public void NowGet200ResponseInstanceTest() + { + // TODO uncomment below to test "IsType" NowGet200Response + //Assert.IsType(instance); + } + + /// + /// Test the property 'Now' + /// + [Fact] + public void NowTest() + { + // TODO unit test for the property 'Now' + } + + /// + /// Test the property 'Today' + /// + [Fact] + public void TodayTest() + { + // TODO unit test for the property 'Today' + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..a4e283f2d333 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net9.0 + false + enable + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/README.md b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools.Test/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..7782f09b34bf --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,332 @@ +// +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Net; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text.Json; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +using System.Diagnostics.CodeAnalysis; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// This class is registered as transient. + /// + public interface IDefaultApi : IApi + { + /// + /// The class containing the events + /// + DefaultApiEvents Events { get; } + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + Task NowGetAsync(System.Threading.CancellationToken cancellationToken = default); + + /// + /// + /// + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <?> + Task NowGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default); + } + + /// + /// The + /// + public interface INowGetApiResponse : Org.OpenAPITools.Client.IApiResponse, IOk + { + /// + /// Returns true if the response is 200 Ok + /// + /// + bool IsOk { get; } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class DefaultApiEvents + { + /// + /// The event raised after the server response + /// + public event EventHandler? OnNowGet; + + /// + /// The event raised after an error querying the server + /// + public event EventHandler? OnErrorNowGet; + + internal void ExecuteOnNowGet(DefaultApi.NowGetApiResponse apiResponse) + { + OnNowGet?.Invoke(this, new ApiResponseEventArgs(apiResponse)); + } + + internal void ExecuteOnErrorNowGet(Exception exception) + { + OnErrorNowGet?.Invoke(this, new ExceptionEventArgs(exception)); + } + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public sealed partial class DefaultApi : IDefaultApi + { + private JsonSerializerOptions _jsonSerializerOptions; + + /// + /// The logger factory + /// + public ILoggerFactory LoggerFactory { get; } + + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The HttpClient + /// + public HttpClient HttpClient { get; } + + /// + /// The class containing the events + /// + public DefaultApiEvents Events { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(ILogger logger, ILoggerFactory loggerFactory, HttpClient httpClient, JsonSerializerOptionsProvider jsonSerializerOptionsProvider, DefaultApiEvents defaultApiEvents) + { + _jsonSerializerOptions = jsonSerializerOptionsProvider.Options; + LoggerFactory = loggerFactory; + Logger = LoggerFactory.CreateLogger(); + HttpClient = httpClient; + Events = defaultApiEvents; + } + + /// + /// Processes the server response + /// + /// + private void AfterNowGetDefaultImplementation(INowGetApiResponse apiResponseLocalVar) + { + bool suppressDefaultLog = false; + AfterNowGet(ref suppressDefaultLog, apiResponseLocalVar); + if (!suppressDefaultLog) + Logger.LogInformation("{0,-9} | {1} | {3}", (apiResponseLocalVar.DownloadedAt - apiResponseLocalVar.RequestedAt).TotalSeconds, apiResponseLocalVar.StatusCode, apiResponseLocalVar.Path); + } + + /// + /// Processes the server response + /// + /// + /// + partial void AfterNowGet(ref bool suppressDefaultLog, INowGetApiResponse apiResponseLocalVar); + + /// + /// Logs exceptions that occur while retrieving the server response + /// + /// + /// + /// + private void OnErrorNowGetDefaultImplementation(Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar) + { + bool suppressDefaultLogLocalVar = false; + OnErrorNowGet(ref suppressDefaultLogLocalVar, exceptionLocalVar, pathFormatLocalVar, pathLocalVar); + if (!suppressDefaultLogLocalVar) + Logger.LogError(exceptionLocalVar, "An error occurred while sending the request to the server."); + } + + /// + /// A partial method that gives developers a way to provide customized exception handling + /// + /// + /// + /// + /// + partial void OnErrorNowGet(ref bool suppressDefaultLogLocalVar, Exception exceptionLocalVar, string pathFormatLocalVar, string pathLocalVar); + + /// + /// + /// + /// Cancellation Token to cancel the request. + /// <> + public async Task NowGetOrDefaultAsync(System.Threading.CancellationToken cancellationToken = default) + { + try + { + return await NowGetAsync(cancellationToken).ConfigureAwait(false); + } + catch (Exception) + { + return null; + } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Cancellation Token to cancel the request. + /// <> + public async Task NowGetAsync(System.Threading.CancellationToken cancellationToken = default) + { + UriBuilder uriBuilderLocalVar = new UriBuilder(); + + try + { + using (HttpRequestMessage httpRequestMessageLocalVar = new HttpRequestMessage()) + { + uriBuilderLocalVar.Host = HttpClient.BaseAddress!.Host; + uriBuilderLocalVar.Port = HttpClient.BaseAddress.Port; + uriBuilderLocalVar.Scheme = HttpClient.BaseAddress.Scheme; + uriBuilderLocalVar.Path = ClientUtils.CONTEXT_PATH + "/now"; + + httpRequestMessageLocalVar.RequestUri = uriBuilderLocalVar.Uri; + + string[] acceptLocalVars = new string[] { + "application/json" + }; + + string? acceptLocalVar = ClientUtils.SelectHeaderAccept(acceptLocalVars); + + if (acceptLocalVar != null) + httpRequestMessageLocalVar.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue(acceptLocalVar)); + + httpRequestMessageLocalVar.Method = HttpMethod.Get; + + DateTime requestedAtLocalVar = DateTime.UtcNow; + + using (HttpResponseMessage httpResponseMessageLocalVar = await HttpClient.SendAsync(httpRequestMessageLocalVar, cancellationToken).ConfigureAwait(false)) + { + string responseContentLocalVar = await httpResponseMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); + + ILogger apiResponseLoggerLocalVar = LoggerFactory.CreateLogger(); + + NowGetApiResponse apiResponseLocalVar = new(apiResponseLoggerLocalVar, httpRequestMessageLocalVar, httpResponseMessageLocalVar, responseContentLocalVar, "/now", requestedAtLocalVar, _jsonSerializerOptions); + + AfterNowGetDefaultImplementation(apiResponseLocalVar); + + Events.ExecuteOnNowGet(apiResponseLocalVar); + + return apiResponseLocalVar; + } + } + } + catch(Exception e) + { + OnErrorNowGetDefaultImplementation(e, "/now", uriBuilderLocalVar.Path); + Events.ExecuteOnErrorNowGet(e); + throw; + } + } + + /// + /// The + /// + public partial class NowGetApiResponse : Org.OpenAPITools.Client.ApiResponse, INowGetApiResponse + { + /// + /// The logger + /// + public ILogger Logger { get; } + + /// + /// The + /// + /// + /// + /// + /// + /// + /// + /// + public NowGetApiResponse(ILogger logger, System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) : base(httpRequestMessage, httpResponseMessage, rawContent, path, requestedAt, jsonSerializerOptions) + { + Logger = logger; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + + /// + /// Returns true if the response is 200 Ok + /// + /// + public bool IsOk => 200 == (int)StatusCode; + + /// + /// Deserializes the response if the response is 200 Ok + /// + /// + public Org.OpenAPITools.Model.NowGet200Response? Ok() + { + // This logic may be modified with the AsModel.mustache template + return IsOk + ? System.Text.Json.JsonSerializer.Deserialize(RawContent, _jsonSerializerOptions) + : null; + } + + /// + /// Returns true if the response is 200 Ok and the deserialized response is not null + /// + /// + /// + public bool TryOk([NotNullWhen(true)]out Org.OpenAPITools.Model.NowGet200Response? result) + { + result = null; + + try + { + result = Ok(); + } catch (Exception e) + { + OnDeserializationErrorDefaultImplementation(e, (HttpStatusCode)200); + } + + return result != null; + } + + private void OnDeserializationErrorDefaultImplementation(Exception exception, HttpStatusCode httpStatusCode) + { + bool suppressDefaultLog = false; + OnDeserializationError(ref suppressDefaultLog, exception, httpStatusCode); + if (!suppressDefaultLog) + Logger.LogError(exception, "An error occurred while deserializing the {code} response.", httpStatusCode); + } + + partial void OnDeserializationError(ref bool suppressDefaultLog, Exception exception, HttpStatusCode httpStatusCode); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs new file mode 100644 index 000000000000..28520f043f2d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Api/IApi.cs @@ -0,0 +1,15 @@ +using System.Net.Http; + +namespace Org.OpenAPITools.Api +{ + /// + /// Any Api client + /// + public interface IApi + { + /// + /// The HttpClient + /// + HttpClient HttpClient { get; } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiException.cs new file mode 100644 index 000000000000..f7cda3e72ce2 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiException.cs @@ -0,0 +1,52 @@ +// +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// API Exception + /// + public class ApiException : Exception + { + /// + /// The reason the api request failed + /// + public string? ReasonPhrase { get; } + + /// + /// The HttpStatusCode + /// + public System.Net.HttpStatusCode StatusCode { get; } + + /// + /// The raw data returned by the api + /// + public string RawContent { get; } + + /// + /// Construct the ApiException from parts of the response + /// + /// + /// + /// + public ApiException(string? reasonPhrase, System.Net.HttpStatusCode statusCode, string rawContent) : base(reasonPhrase ?? rawContent) + { + ReasonPhrase = reasonPhrase; + + StatusCode = statusCode; + + RawContent = rawContent; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs new file mode 100644 index 000000000000..b9b27c613f86 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiFactory.cs @@ -0,0 +1,49 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; + +namespace Org.OpenAPITools.Client +{ + /// + /// An IApiFactory interface + /// + public interface IApiFactory + { + /// + /// A method to create an IApi of type IResult + /// + /// + /// + IResult Create() where IResult : IApi; + } + + /// + /// An ApiFactory + /// + public class ApiFactory : IApiFactory + { + /// + /// The service provider + /// + public IServiceProvider Services { get; } + + /// + /// Initializes a new instance of the class. + /// + /// + public ApiFactory(IServiceProvider services) + { + Services = services; + } + + /// + /// A method to create an IApi of type IResult + /// + /// + /// + public IResult Create() where IResult : IApi + { + return Services.GetRequiredService(); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs new file mode 100644 index 000000000000..3cb65e5adc0b --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponseEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ApiResponseEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public ApiResponse ApiResponse { get; } + + /// + /// The ApiResponseEventArgs + /// + /// + public ApiResponseEventArgs(ApiResponse apiResponse) + { + ApiResponse = apiResponse; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs new file mode 100644 index 000000000000..0027952859de --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse`1.cs @@ -0,0 +1,172 @@ +// +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Diagnostics.CodeAnalysis; +using System.Net; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a non-generic contract for the ApiResponse wrapper. + /// + public partial interface IApiResponse + { + /// + /// The IsSuccessStatusCode from the api response + /// + bool IsSuccessStatusCode { get; } + + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + HttpStatusCode StatusCode { get; } + + /// + /// The raw content of this response. + /// + string RawContent { get; } + + /// + /// The DateTime when the request was retrieved. + /// + DateTime DownloadedAt { get; } + + /// + /// The headers contained in the api response + /// + System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The path used when making the request. + /// + string Path { get; } + + /// + /// The reason phrase contained in the api response + /// + string? ReasonPhrase { get; } + + /// + /// The DateTime when the request was sent. + /// + DateTime RequestedAt { get; } + + /// + /// The Uri used when making the request. + /// + Uri? RequestUri { get; } + } + + /// + /// API Response + /// + public partial class ApiResponse : IApiResponse + { + /// + /// Gets the status code (HTTP status code) + /// + /// The status code. + public HttpStatusCode StatusCode { get; } + + /// + /// The raw data + /// + public string RawContent { get; protected set; } + + /// + /// The IsSuccessStatusCode from the api response + /// + public bool IsSuccessStatusCode { get; } + + /// + /// The reason phrase contained in the api response + /// + public string? ReasonPhrase { get; } + + /// + /// The headers contained in the api response + /// + public System.Net.Http.Headers.HttpResponseHeaders Headers { get; } + + /// + /// The DateTime when the request was retrieved. + /// + public DateTime DownloadedAt { get; } = DateTime.UtcNow; + + /// + /// The DateTime when the request was sent. + /// + public DateTime RequestedAt { get; } + + /// + /// The path used when making the request. + /// + public string Path { get; } + + /// + /// The Uri used when making the request. + /// + public Uri? RequestUri { get; } + + /// + /// The + /// + protected System.Text.Json.JsonSerializerOptions _jsonSerializerOptions; + + /// + /// Construct the response using an HttpResponseMessage + /// + /// + /// + /// + /// + /// + /// + public ApiResponse(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage, string rawContent, string path, DateTime requestedAt, System.Text.Json.JsonSerializerOptions jsonSerializerOptions) + { + StatusCode = httpResponseMessage.StatusCode; + Headers = httpResponseMessage.Headers; + IsSuccessStatusCode = httpResponseMessage.IsSuccessStatusCode; + ReasonPhrase = httpResponseMessage.ReasonPhrase; + RawContent = rawContent; + Path = path; + RequestUri = httpRequestMessage.RequestUri; + RequestedAt = requestedAt; + _jsonSerializerOptions = jsonSerializerOptions; + OnCreated(httpRequestMessage, httpResponseMessage); + } + + partial void OnCreated(global::System.Net.Http.HttpRequestMessage httpRequestMessage, System.Net.Http.HttpResponseMessage httpResponseMessage); + } + + /// + /// An interface for responses of type + /// + /// + public interface IOk : IApiResponse + { + /// + /// Deserializes the response if the response is Ok + /// + /// + TType Ok(); + + /// + /// Returns true if the response is Ok and the deserialized response is not null + /// + /// + /// + bool TryOk([NotNullWhen(true)]out TType? result); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs new file mode 100644 index 000000000000..4cdf0f206124 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -0,0 +1,318 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.IO; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using System.Text.RegularExpressions; +using Org.OpenAPITools.Model; +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Org.OpenAPITools.Test")] + +namespace Org.OpenAPITools.Client +{ + /// + /// Utility functions providing some benefit to API client consumers. + /// + public static class ClientUtils + { + + /// + /// A delegate for events. + /// + /// + /// + /// + /// + public delegate void EventHandler(object sender, T e) where T : EventArgs; + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(string json, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(json, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Returns true when deserialization succeeds. + /// + /// + /// + /// + /// + /// + public static bool TryDeserialize(ref Utf8JsonReader reader, JsonSerializerOptions options, [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? result) + { + try + { + result = JsonSerializer.Deserialize(ref reader, options); + return result != null; + } + catch (Exception) + { + result = default; + return false; + } + } + + /// + /// Sanitize filename by removing the path + /// + /// Filename + /// Filename + public static string SanitizeFilename(string filename) + { + Match match = Regex.Match(filename, @".*[/\\](.*)$"); + return match.Success ? match.Groups[1].Value : filename; + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// The DateTime serialization format. + /// Formatted string. + public static string? ParameterToString(object? obj, string? format = ISO8601_DATETIME_FORMAT) + { + if (obj is DateTime dateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTime.ToString(format); + if (obj is DateTimeOffset dateTimeOffset) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return dateTimeOffset.ToString(format); + if (obj is DateOnly dateOnly) + return dateOnly.ToString(format); + if (obj is bool boolean) + return boolean + ? "true" + : "false"; + if (obj is ICollection collection) + { + List entries = new(); + foreach (var entry in collection) + entries.Add(ParameterToString(entry)); + return string.Join(",", entries); + } + + return Convert.ToString(obj, System.Globalization.CultureInfo.InvariantCulture); + } + + /// + /// URL encode a string + /// Credit/Ref: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Extensions/StringExtensions.cs#L50 + /// + /// string to be URL encoded + /// Byte array + public static string UrlEncode(string input) + { + const int maxLength = 32766; + + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.Length <= maxLength) + { + return Uri.EscapeDataString(input); + } + + StringBuilder sb = new StringBuilder(input.Length * 2); + int index = 0; + + while (index < input.Length) + { + int length = Math.Min(input.Length - index, maxLength); + string subString = input.Substring(index, length); + + sb.Append(Uri.EscapeDataString(subString)); + index += subString.Length; + } + + return sb.ToString(); + } + + /// + /// Encode string in base64 format. + /// + /// string to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + return Convert.ToBase64String(global::System.Text.Encoding.UTF8.GetBytes(text)); + } + + /// + /// Convert stream to byte array + /// + /// Input stream to be converted + /// Byte array + public static byte[] ReadAsBytes(Stream inputStream) + { + using (var ms = new MemoryStream()) + { + inputStream.CopyTo(ms); + return ms.ToArray(); + } + } + + /// + /// Select the Content-Type header's value from the given content-type array: + /// if JSON type exists in the given array, use it; + /// otherwise use the first one defined in 'consumes' + /// + /// The Content-Type array to select from. + /// The Content-Type header to use. + public static string? SelectHeaderContentType(string[] contentTypes) + { + if (contentTypes.Length == 0) + return null; + + foreach (var contentType in contentTypes) + { + if (IsJsonMime(contentType)) + return contentType; + } + + return contentTypes[0]; // use the first content type specified in 'consumes' + } + + /// + /// 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) + /// + /// The accepts array to select from. + /// The Accept header to use. + public static string? SelectHeaderAccept(string[] accepts) + { + if (accepts.Length == 0) + return null; + + if (accepts.Contains("application/json", StringComparer.OrdinalIgnoreCase)) + return "application/json"; + + return string.Join(",", accepts); + } + + /// + /// Provides a case-insensitive check that a provided content type is a known JSON-like content type. + /// + public static readonly Regex JsonRegex = new Regex("(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"); + + /// + /// Check if the given MIME is a JSON MIME. + /// JSON MIME examples: + /// application/json + /// application/json; charset=UTF8 + /// APPLICATION/JSON + /// application/vnd.company+json + /// + /// MIME + /// Returns True if MIME type is json. + public static bool IsJsonMime(string mime) + { + if (string.IsNullOrWhiteSpace(mime)) return false; + + return JsonRegex.IsMatch(mime) || mime.Equals("application/json-patch+json"); + } + + /// + /// Get the discriminator + /// + /// + /// + /// + /// + public static string? GetDiscriminator(Utf8JsonReader utf8JsonReader, string discriminator) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + if (localVarJsonPropertyName != null && localVarJsonPropertyName.Equals(discriminator)) + return utf8JsonReader.GetString(); + } + } + + throw new JsonException("The specified discriminator was not found."); + } + + /// + /// The base path of the API + /// + public const string BASE_ADDRESS = "http://localhost"; + + /// + /// The scheme of the API + /// + public const string SCHEME = "http"; + + /// + /// The context path of the API + /// + public const string CONTEXT_PATH = ""; + + /// + /// The host of the API + /// + public const string HOST = "localhost"; + + /// + /// The format to use for DateTime serialization + /// + public const string ISO8601_DATETIME_FORMAT = "o"; + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs new file mode 100644 index 000000000000..85093b0c1fee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/CookieContainer.cs @@ -0,0 +1,20 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A class containing a CookieContainer + /// + public sealed class CookieContainer + { + /// + /// The collection of tokens + /// + public System.Net.CookieContainer Value { get; } = new System.Net.CookieContainer(); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs new file mode 100644 index 000000000000..1ebd1220b622 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/DateTimeJsonConverter.cs @@ -0,0 +1,77 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' and 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyy'-'MM'-'dd", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + "yyyyMMdd" + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + throw new NotSupportedException(); + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + throw new NotSupportedException(); + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime dateTimeValue, JsonSerializerOptions options) => + writer.WriteStringValue(dateTimeValue.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs new file mode 100644 index 000000000000..e92db186bb60 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/DateTimeNullableJsonConverter.cs @@ -0,0 +1,82 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Globalization; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Org.OpenAPITools.Client +{ + /// + /// Formatter for 'date' and 'date-time' openapi formats ss defined by full-date - RFC3339 + /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types + /// + public class DateTimeNullableJsonConverter : JsonConverter + { + /// + /// The formats used to deserialize the date + /// + public static string[] Formats { get; } = { + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ffK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fK", + "yyyy'-'MM'-'dd'T'HH':'mm':'ssK", + "yyyy'-'MM'-'dd", + "yyyyMMddTHHmmss.fffffffK", + "yyyyMMddTHHmmss.ffffffK", + "yyyyMMddTHHmmss.fffffK", + "yyyyMMddTHHmmss.ffffK", + "yyyyMMddTHHmmss.fffK", + "yyyyMMddTHHmmss.ffK", + "yyyyMMddTHHmmss.fK", + "yyyyMMddTHHmmssK", + "yyyyMMdd" + + }; + + /// + /// Returns a DateTime from the Json object + /// + /// + /// + /// + /// + public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { + if (reader.TokenType == JsonTokenType.Null) + return null; + + string value = reader.GetString()!; + + foreach(string format in Formats) + if (DateTime.TryParseExact(value, format, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime result)) + return result; + + return null; + } + + /// + /// Writes the DateTime to the json writer + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, DateTime? dateTimeValue, JsonSerializerOptions options) + { + if (dateTimeValue == null) + writer.WriteNullValue(); + else + writer.WriteStringValue(dateTimeValue.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK", CultureInfo.InvariantCulture)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs new file mode 100644 index 000000000000..f711f9f3c7ee --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -0,0 +1,24 @@ +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// Useful for tracking server health + /// + public class ExceptionEventArgs : EventArgs + { + /// + /// The ApiResponse + /// + public Exception Exception { get; } + + /// + /// The ExceptionEventArgs + /// + /// + public ExceptionEventArgs(Exception exception) + { + Exception = exception; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs new file mode 100644 index 000000000000..90dd61c2c492 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -0,0 +1,131 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides hosting configuration for Org.OpenAPITools + /// + public class HostConfiguration + { + private readonly IServiceCollection _services; + private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions(); + + internal bool HttpClientsAdded { get; private set; } + + /// + /// Instantiates the class + /// + /// + public HostConfiguration(IServiceCollection services) + { + _services = services; + _jsonOptions.Converters.Add(new JsonStringEnumConverter()); + _jsonOptions.Converters.Add(new DateTimeJsonConverter()); + _jsonOptions.Converters.Add(new DateTimeNullableJsonConverter()); + _jsonOptions.Converters.Add(new NowGet200ResponseJsonConverter()); + JsonSerializerOptionsProvider jsonSerializerOptionsProvider = new(_jsonOptions); + _services.AddSingleton(jsonSerializerOptionsProvider); + _services.AddSingleton(); + _services.AddSingleton(); + _services.AddTransient(); + } + + /// + /// Configures the HttpClients. + /// + /// + /// + /// + public HostConfiguration AddApiHttpClients + ( + Action? client = null, Action? builder = null) + { + if (client == null) + client = c => c.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS); + + List builders = new List(); + + builders.Add(_services.AddHttpClient(client)); + + if (builder != null) + foreach (IHttpClientBuilder instance in builders) + builder(instance); + + HttpClientsAdded = true; + + return this; + } + + /// + /// Configures the JsonSerializerSettings + /// + /// + /// + public HostConfiguration ConfigureJsonOptions(Action options) + { + options(_jsonOptions); + + return this; + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(TTokenBase token) where TTokenBase : TokenBase + { + return AddTokens(new TTokenBase[]{ token }); + } + + /// + /// Adds tokens to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration AddTokens(IEnumerable tokens) where TTokenBase : TokenBase + { + TokenContainer container = new TokenContainer(tokens); + _services.AddSingleton(services => container); + + return this; + } + + /// + /// Adds a token provider to your IServiceCollection + /// + /// + /// + /// + public HostConfiguration UseProvider() + where TTokenProvider : TokenProvider + where TTokenBase : TokenBase + { + _services.AddSingleton(); + _services.AddSingleton>(services => services.GetRequiredService()); + + return this; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs new file mode 100644 index 000000000000..0184d9ad9446 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/JsonSerializerOptionsProvider.cs @@ -0,0 +1,27 @@ +// + +#nullable enable + +using System.Text.Json; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides the JsonSerializerOptions + /// + public class JsonSerializerOptionsProvider + { + /// + /// the JsonSerializerOptions + /// + public JsonSerializerOptions Options { get; } + + /// + /// Instantiates a JsonSerializerOptionsProvider + /// + public JsonSerializerOptionsProvider(JsonSerializerOptions options) + { + Options = options; + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/Option.cs new file mode 100644 index 000000000000..1c1677e3e3cb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/Option.cs @@ -0,0 +1,53 @@ +// +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + + +namespace Org.OpenAPITools.Client +{ + /// + /// A wrapper for operation parameters which are not required + /// + public struct Option + { + /// + /// The value to send to the server + /// + public TType Value { get; } + + /// + /// When true the value will be sent to the server + /// + internal bool IsSet { get; } + + /// + /// A wrapper for operation parameters which are not required + /// + /// + public Option(TType value) + { + IsSet = true; + Value = value; + } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs new file mode 100644 index 000000000000..30ef47033199 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/RateLimitProvider`1.cs @@ -0,0 +1,57 @@ +// +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Channels; + +namespace Org.OpenAPITools.Client +{ + /// + /// Provides a token to the api clients. Tokens will be rate limited based on the provided TimeSpan. + /// + /// + public class RateLimitProvider : TokenProvider where TTokenBase : TokenBase + { + internal Dictionary> AvailableTokens { get; } = new(); + + /// + /// Instantiates a ThrottledTokenProvider. Your tokens will be rate limited based on the token's timeout. + /// + /// + public RateLimitProvider(TokenContainer container) : base(container.Tokens) + { + foreach(TTokenBase token in _tokens) + token.StartTimer(token.Timeout ?? TimeSpan.FromMilliseconds(40)); + + BoundedChannelOptions options = new BoundedChannelOptions(_tokens.Length) + { + FullMode = BoundedChannelFullMode.DropWrite + }; + + AvailableTokens.Add(string.Empty, Channel.CreateBounded(options)); + + foreach(Channel tokens in AvailableTokens.Values) + for (int i = 0; i < _tokens.Length; i++) + _tokens[i].TokenBecameAvailable += ((sender) => tokens.Writer.TryWrite((TTokenBase) sender)); + } + + internal override async System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default) + { + if (!AvailableTokens.TryGetValue(header, out Channel? tokens)) + throw new KeyNotFoundException($"Could not locate a token for header '{header}'."); + + return await tokens.Reader.ReadAsync(cancellation).ConfigureAwait(false); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs new file mode 100644 index 000000000000..3f713a2ef4bb --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenBase.cs @@ -0,0 +1,71 @@ +// + +#nullable enable + +using System; + +namespace Org.OpenAPITools.Client +{ + /// + /// The base for all tokens. + /// + public abstract class TokenBase + { + private DateTime _nextAvailable = DateTime.UtcNow; + private object _nextAvailableLock = new object(); + private readonly System.Timers.Timer _timer = new System.Timers.Timer(); + + + internal TimeSpan? Timeout { get; set; } + internal delegate void TokenBecameAvailableEventHandler(object sender); + internal event TokenBecameAvailableEventHandler? TokenBecameAvailable; + + + /// + /// Initialize a TokenBase object. + /// + /// + internal TokenBase(TimeSpan? timeout = null) + { + Timeout = timeout; + + if (Timeout != null) + StartTimer(Timeout.Value); + } + + + /// + /// Starts the token's timer + /// + /// + internal void StartTimer(TimeSpan timeout) + { + Timeout = timeout; + _timer.Interval = Timeout.Value.TotalMilliseconds; + _timer.Elapsed += OnTimer; + _timer.AutoReset = true; + _timer.Start(); + } + + /// + /// Returns true while the token is rate limited. + /// + public bool IsRateLimited => _nextAvailable > DateTime.UtcNow; + + /// + /// Triggered when the server returns status code TooManyRequests + /// Once triggered the local timeout will be extended an arbitrary length of time. + /// + public void BeginRateLimit() + { + lock(_nextAvailableLock) + _nextAvailable = DateTime.UtcNow.AddSeconds(5); + } + + private void OnTimer(object? sender, System.Timers.ElapsedEventArgs e) + { + if (TokenBecameAvailable != null && !IsRateLimited) + TokenBecameAvailable.Invoke(this); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs new file mode 100644 index 000000000000..7b0f23d28a4e --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenContainer`1.cs @@ -0,0 +1,37 @@ +// + +#nullable enable + +using System.Linq; +using System.Collections.Generic; + +namespace Org.OpenAPITools.Client +{ + /// + /// A container for a collection of tokens. + /// + /// + public sealed class TokenContainer where TTokenBase : TokenBase + { + /// + /// The collection of tokens + /// + public List Tokens { get; } = new List(); + + /// + /// Instantiates a TokenContainer + /// + public TokenContainer() + { + } + + /// + /// Instantiates a TokenContainer + /// + /// + public TokenContainer(global::System.Collections.Generic.IEnumerable tokens) + { + Tokens = tokens.ToList(); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs new file mode 100644 index 000000000000..d9c84d5cc775 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Client/TokenProvider`1.cs @@ -0,0 +1,44 @@ +// +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using System.Collections.Generic; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools +{ + /// + /// A class which will provide tokens. + /// + public abstract class TokenProvider where TTokenBase : TokenBase + { + /// + /// The array of tokens. + /// + protected TTokenBase[] _tokens; + + internal abstract System.Threading.Tasks.ValueTask GetAsync(string header = "", System.Threading.CancellationToken cancellation = default); + + /// + /// Instantiates a TokenProvider. + /// + /// + public TokenProvider(IEnumerable tokens) + { + _tokens = tokens.ToArray(); + + if (_tokens.Length == 0) + throw new ArgumentException("You did not provide any tokens."); + } + } +} \ No newline at end of file diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs new file mode 100644 index 000000000000..2c150d1f66e4 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Extensions/IHostBuilderExtensions.cs @@ -0,0 +1,59 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHostBuilder + /// + public static class IHostBuilderExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static IHostBuilder ConfigureApi(this IHostBuilder builder, Action options) + { + builder.ConfigureServices((context, services) => + { + HostConfiguration config = new HostConfiguration(services); + + options(context, services, config); + + IServiceCollectionExtensions.AddApi(services, config); + }); + + return builder; + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs new file mode 100644 index 000000000000..549b6e473333 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Extensions/IHttpClientBuilderExtensions.cs @@ -0,0 +1,79 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Net.Http; +using Microsoft.Extensions.DependencyInjection; +using Polly.Timeout; +using Polly.Extensions.Http; +using Polly; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IHttpClientBuilder + /// + public static class IHttpClientBuilderExtensions + { + /// + /// Adds a Polly retry policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddRetryPolicy(this IHttpClientBuilder client, int retries) + { + client.AddPolicyHandler(RetryPolicy(retries)); + + return client; + } + + /// + /// Adds a Polly timeout policy to your clients. + /// + /// + /// + /// + public static IHttpClientBuilder AddTimeoutPolicy(this IHttpClientBuilder client, TimeSpan timeout) + { + client.AddPolicyHandler(TimeoutPolicy(timeout)); + + return client; + } + + /// + /// Adds a Polly circuit breaker to your clients. + /// + /// + /// + /// + /// + public static IHttpClientBuilder AddCircuitBreakerPolicy(this IHttpClientBuilder client, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + { + client.AddTransientHttpErrorPolicy(builder => CircuitBreakerPolicy(builder, handledEventsAllowedBeforeBreaking, durationOfBreak)); + + return client; + } + + private static Polly.Retry.AsyncRetryPolicy RetryPolicy(int retries) + => HttpPolicyExtensions + .HandleTransientHttpError() + .Or() + .RetryAsync(retries); + + private static AsyncTimeoutPolicy TimeoutPolicy(TimeSpan timeout) + => Policy.TimeoutAsync(timeout); + + private static Polly.CircuitBreaker.AsyncCircuitBreakerPolicy CircuitBreakerPolicy( + PolicyBuilder builder, int handledEventsAllowedBeforeBreaking, TimeSpan durationOfBreak) + => builder.CircuitBreakerAsync(handledEventsAllowedBeforeBreaking, durationOfBreak); + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs new file mode 100644 index 000000000000..8b7c34900c07 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Extensions/IServiceCollectionExtensions.cs @@ -0,0 +1,73 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Linq; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Extensions +{ + /// + /// Extension methods for IServiceCollection + /// + public static class IServiceCollectionExtensions + { + /// + /// Add the api to your host builder. + /// + /// + public static void AddApi(this IServiceCollection services) + { + HostConfiguration config = new(services); + AddApi(services, config); + } + + /// + /// Add the api to your host builder. + /// + /// + /// + public static void AddApi(this IServiceCollection services, Action options) + { + HostConfiguration config = new(services); + options(config); + AddApi(services, config); + } + + internal static void AddApi(IServiceCollection services, HostConfiguration host) + { + if (!host.HttpClientsAdded) + host.AddApiHttpClients(); + + services.AddSingleton(); + + // ensure that a token provider was provided for this token type + // if not, default to RateLimitProvider + var containerServices = services.Where(s => s.ServiceType.IsGenericType && + s.ServiceType.GetGenericTypeDefinition().IsAssignableFrom(typeof(TokenContainer<>))).ToArray(); + + foreach(var containerService in containerServices) + { + var tokenType = containerService.ServiceType.GenericTypeArguments[0]; + + var provider = services.FirstOrDefault(s => s.ServiceType.IsAssignableFrom(typeof(TokenProvider<>).MakeGenericType(tokenType))); + + if (provider == null) + { + services.AddSingleton(typeof(RateLimitProvider<>).MakeGenericType(tokenType)); + services.AddSingleton(typeof(TokenProvider<>).MakeGenericType(tokenType), + s => s.GetRequiredService(typeof(RateLimitProvider<>).MakeGenericType(tokenType))); + } + } + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs new file mode 100644 index 000000000000..d07559ec5275 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs @@ -0,0 +1,203 @@ +// +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// NowGet200Response + /// + public partial class NowGet200Response : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// now + /// today + [JsonConstructor] + public NowGet200Response(Option now = default, Option today = default) + { + NowOption = now; + TodayOption = today; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Used to track the state of Now + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option NowOption { get; private set; } + + /// + /// Gets or Sets Now + /// + [JsonPropertyName("now")] + public DateTime? Now { get { return this.NowOption; } set { this.NowOption = new(value); } } + + /// + /// Used to track the state of Today + /// + [JsonIgnore] + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public Option TodayOption { get; private set; } + + /// + /// Gets or Sets Today + /// + [JsonPropertyName("today")] + public DateTime? Today { get { return this.TodayOption; } set { this.TodayOption = new(value); } } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class NowGet200Response {\n"); + sb.Append(" Now: ").Append(Now).Append("\n"); + sb.Append(" Today: ").Append(Today).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class NowGet200ResponseJsonConverter : JsonConverter + { + /// + /// The format to use to serialize Now + /// + public static string NowFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize Today + /// + public static string TodayFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override NowGet200Response Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option now = default; + Option today = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "now": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + now = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "today": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + today = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + default: + break; + } + } + } + + if (now.IsSet && now.Value == null) + throw new ArgumentNullException(nameof(now), "Property is not nullable for class NowGet200Response."); + + if (today.IsSet && today.Value == null) + throw new ArgumentNullException(nameof(today), "Property is not nullable for class NowGet200Response."); + + return new NowGet200Response(now, today); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, NowGet200Response nowGet200Response, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(writer, nowGet200Response, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(Utf8JsonWriter writer, NowGet200Response nowGet200Response, JsonSerializerOptions jsonSerializerOptions) + { + if (nowGet200Response.NowOption.IsSet) + writer.WriteString("now", nowGet200Response.NowOption.Value!.Value.ToString(NowFormat)); + + if (nowGet200Response.TodayOption.IsSet) + writer.WriteString("today", nowGet200Response.TodayOption.Value!.Value.ToString(TodayFormat)); + } + } +} diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..5e475211af94 --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,31 @@ + + + + true + net9.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + enable + false + + + + + + + + + + diff --git a/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/README.md b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/README.md new file mode 100644 index 000000000000..c889bb4cbd3d --- /dev/null +++ b/samples/client/petstore/csharp/generichost/net9/UseDateTimeForDate/src/Org.OpenAPITools/README.md @@ -0,0 +1,176 @@ +# Created with Openapi Generator + + +## Run the following powershell command to generate the library + +```ps1 +$properties = @( + 'apiName=Api', + 'targetFramework=net9.0', + 'validatable=true', + 'nullableReferenceTypes=true', + 'hideGenerationTimestamp=true', + 'packageVersion=1.0.0', + 'packageAuthors=OpenAPI', + 'packageCompany=OpenAPI', + 'packageCopyright=No Copyright', + 'packageDescription=A library generated from a OpenAPI doc', + 'packageName=Org.OpenAPITools', + 'packageTags=', + 'packageTitle=OpenAPI Library' +) -join "," + +$global = @( + 'apiDocs=true', + 'modelDocs=true', + 'apiTests=true', + 'modelTests=true' +) -join "," + +java -jar "/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar" generate ` + -g csharp-netcore ` + -i .yaml ` + -o ` + --library generichost ` + --additional-properties $properties ` + --global-property $global ` + --git-host "github.com" ` + --git-repo-id "GIT_REPO_ID" ` + --git-user-id "GIT_USER_ID" ` + --release-note "Minor update" + # -t templates +``` + + +## Using the library in your project + +```cs +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace YourProject +{ + public class Program + { + public static async Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + var api = host.Services.GetRequiredService(); + NowGetApiResponse apiResponse = await api.NowGetAsync("todo"); + NowGet200Response model = apiResponse.Ok(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .ConfigureApi((context, options) => + { + options.ConfigureJsonOptions((jsonOptions) => + { + // your custom converters if any + }); + + options.AddApiHttpClients(builder: builder => builder + .AddRetryPolicy(2) + .AddTimeoutPolicy(TimeSpan.FromSeconds(5)) + .AddCircuitBreakerPolicy(10, TimeSpan.FromSeconds(30)) + // add whatever middleware you prefer + ); + }); + } +} +``` + +## Questions + +- What about HttpRequest failures and retries? + If supportsRetry is enabled, you can configure Polly in the ConfigureClients method. +- How are tokens used? + Tokens are provided by a TokenProvider class. The default is RateLimitProvider which will perform client side rate limiting. + Other providers can be used with the UseProvider method. +- Does an HttpRequest throw an error when the server response is not Ok? + It depends how you made the request. If the return type is ApiResponse no error will be thrown, though the Content property will be null. + StatusCode and ReasonPhrase will contain information about the error. + If the return type is T, then it will throw. If the return type is TOrDefault, it will return null. +- How do I validate requests and process responses? + Use the provided On and After methods in the Api class from the namespace Org.OpenAPITools.Rest.DefaultApi. + Or provide your own class by using the generic ConfigureApi method. + + +## Dependencies + +- [Microsoft.Extensions.Hosting](https://www.nuget.org/packages/Microsoft.Extensions.Hosting/) - 5.0.0 or later +- [Microsoft.Extensions.Http](https://www.nuget.org/packages/Microsoft.Extensions.Http/) - 5.0.0 or later +- [Microsoft.Extensions.Http.Polly](https://www.nuget.org/packages/Microsoft.Extensions.Http.Polly/) - 5.0.1 or later +- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later + + +## Documentation for Authorization + +Endpoints do not require authorization. + + +## Build +- SDK version: 1.0.0 +- Generator version: 7.11.0-SNAPSHOT +- Build package: org.openapitools.codegen.languages.CSharpClientCodegen + +## Api Information +- appName: OpenAPI Dates +- appVersion: 1.0.0 +- appDescription: Thic spec contains endpoints with dates in different formats + +## [OpenApi Global properties](https://openapi-generator.tech/docs/globals) +- generateAliasAsModel: +- supportingFiles: +- models: omitted for brevity +- apis: omitted for brevity +- apiDocs: true +- modelDocs: true +- apiTests: true +- modelTests: true + +## [OpenApi Generator Parameters](https://openapi-generator.tech/docs/generators/csharp-netcore) +- allowUnicodeIdentifiers: +- apiName: Api +- caseInsensitiveResponseHeaders: +- conditionalSerialization: false +- disallowAdditionalPropertiesIfNotPresent: +- gitHost: github.com +- gitRepoId: GIT_REPO_ID +- gitUserId: GIT_USER_ID +- hideGenerationTimestamp: true +- interfacePrefix: I +- library: generichost +- licenseId: +- modelPropertyNaming: +- netCoreProjectFile: false +- nonPublicApi: false +- nullableReferenceTypes: true +- optionalAssemblyInfo: +- optionalEmitDefaultValues: false +- optionalMethodArgument: true +- optionalProjectFile: +- packageAuthors: OpenAPI +- packageCompany: OpenAPI +- packageCopyright: No Copyright +- packageDescription: A library generated from a OpenAPI doc +- packageGuid: {2E60EF87-DB0B-4D01-A36E-F5E90F7EC757} +- packageName: Org.OpenAPITools +- packageTags: +- packageTitle: OpenAPI Library +- packageVersion: 1.0.0 +- releaseNote: Minor update +- returnICollection: false +- sortParamsByRequiredFlag: +- sourceFolder: src +- targetFramework: net9.0 +- useCollection: false +- useDateTimeOffset: false +- useOneOfDiscriminatorLookup: false +- validatable: true + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project. diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs index dcfab6678233..f711f9f3c7ee 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/ExceptionEventArgs.cs @@ -13,7 +13,7 @@ public class ExceptionEventArgs : EventArgs public Exception Exception { get; } /// - /// The ExcepetionEventArgs + /// The ExceptionEventArgs /// /// public ExceptionEventArgs(Exception exception) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index 5c4159491eec..497ab8cafe48 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -69,7 +69,7 @@ public HttpSigningConfiguration(string keyId, string keyFilePath, SecureString k public string SigningAlgorithm { get; set; } /// - /// Gets the Signature validaty period in seconds + /// Gets the Signature validity period in seconds /// public int SignatureValidityPeriod { get; set; } diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..c370847420c1 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -356,7 +356,7 @@ private string GetECDSASignature(byte[] dataToSign) } /// - /// Convert ANS1 format to DER format. Not recommended to use because it generate inavlid signature occationally. + /// Convert ANS1 format to DER format. Not recommended to use because it generate invalid signature occasionally. /// /// /// diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/PetApi.cs index a268ca3af4d6..3498fe14e994 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/PetApi.cs @@ -591,6 +591,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, int }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -764,6 +765,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, int }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -943,6 +945,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpIn }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1123,6 +1126,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1297,6 +1301,7 @@ public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1449,6 +1454,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1625,6 +1631,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1813,6 +1820,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/StoreApi.cs index 27d50bc9bdc8..7b9692839390 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/StoreApi.cs @@ -378,6 +378,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -512,6 +513,7 @@ public Org.OpenAPITools.Client.ApiResponse> GetInventory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -651,6 +653,7 @@ public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -792,6 +795,7 @@ public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order o }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/UserApi.cs index 3f99b38d1ed1..5cf6eaa52918 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Api/UserApi.cs @@ -567,6 +567,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User u }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -719,6 +720,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWith }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -871,6 +873,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1022,6 +1025,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1175,6 +1179,7 @@ public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1329,6 +1334,7 @@ public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1474,6 +1480,7 @@ public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo(int op }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1623,6 +1630,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs index 38ba17f24b23..6fa812fa08ce 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs @@ -385,6 +385,14 @@ private RestRequest NewRequest( } } + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + return request; } diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 6e2e462b8a72..ef4192ba81be 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 9ccd159a44f9..1060a9cbc232 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -244,6 +244,7 @@ public Org.OpenAPITools.Client.ApiResponse Call123TestSpecialTagsWi }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index 54f3d2e41a93..ddcafaaeb043 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -399,6 +399,7 @@ public Org.OpenAPITools.Client.ApiResponse FooGetWithHttp }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -532,6 +533,7 @@ public Org.OpenAPITools.Client.ApiResponse GetCountryWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -667,6 +669,7 @@ public Org.OpenAPITools.Client.ApiResponse> HelloWithHttpInfo(int ope }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -793,6 +796,7 @@ public Org.OpenAPITools.Client.ApiResponse>> RolesRe }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -919,6 +923,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1374,6 +1375,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1508,6 +1510,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1642,6 +1645,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1778,6 +1782,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1913,6 +1918,7 @@ public Org.OpenAPITools.Client.ApiResponse> GetArrayOfEnumsWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2039,6 +2045,7 @@ public Org.OpenAPITools.Client.ApiResponse GetMixedAnyOfWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2165,6 +2172,7 @@ public Org.OpenAPITools.Client.ApiResponse GetMixedOneOfWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2298,6 +2306,7 @@ public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesRefer }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2440,6 +2449,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyWithFileSchemaWithHtt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2590,6 +2600,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyWithQueryParamsWithHt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2744,6 +2755,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2920,6 +2932,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3200,6 +3213,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3237,7 +3251,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI } if (enumFormStringArray != null) { - localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter + localVarRequestOptions.FormParameters.Add("enum_form_string_array", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter } if (enumFormString != null) { @@ -3415,6 +3429,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3600,6 +3615,7 @@ public Org.OpenAPITools.Client.ApiResponse TestInlineAdditionalPropertie }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3742,6 +3758,7 @@ public Org.OpenAPITools.Client.ApiResponse TestInlineFreeformAdditionalP }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3892,6 +3909,7 @@ public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo( }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -4095,6 +4113,7 @@ public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo( }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -4316,6 +4335,7 @@ public Org.OpenAPITools.Client.ApiResponse TestStringMapReferenceWithHtt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index b0e5066eef8f..07c4ad398c66 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -244,6 +244,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClassnameWithHttpInf }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 8db5fd36849d..7e74501d82f4 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -641,6 +641,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -843,6 +844,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1022,6 +1024,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpIn }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1234,6 +1237,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1440,6 +1444,7 @@ public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1599,6 +1604,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1804,6 +1810,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1992,6 +1999,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2189,6 +2197,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index e8882b0fc2e4..af79df6916fe 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -378,6 +378,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -512,6 +513,7 @@ public Org.OpenAPITools.Client.ApiResponse> GetInventory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -651,6 +653,7 @@ public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -792,6 +795,7 @@ public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order o }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 174d0572e677..700610558ef8 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -567,6 +567,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User u }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -709,6 +710,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWith }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -851,6 +853,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -992,6 +995,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1135,6 +1139,7 @@ public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1289,6 +1294,7 @@ public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1434,6 +1440,7 @@ public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo(int op }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1573,6 +1580,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index a0a43ea74aeb..30158fdf49b7 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -385,6 +385,14 @@ private RestRequest NewRequest( } } + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + return request; } diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..c370847420c1 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -356,7 +356,7 @@ private string GetECDSASignature(byte[] dataToSign) } /// - /// Convert ANS1 format to DER format. Not recommended to use because it generate inavlid signature occationally. + /// Convert ANS1 format to DER format. Not recommended to use because it generate invalid signature occasionally. /// /// /// diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index a136411ab795..69917ecc99b1 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 9ccd159a44f9..1060a9cbc232 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -244,6 +244,7 @@ public Org.OpenAPITools.Client.ApiResponse Call123TestSpecialTagsWi }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index 54f3d2e41a93..ddcafaaeb043 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -399,6 +399,7 @@ public Org.OpenAPITools.Client.ApiResponse FooGetWithHttp }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -532,6 +533,7 @@ public Org.OpenAPITools.Client.ApiResponse GetCountryWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -667,6 +669,7 @@ public Org.OpenAPITools.Client.ApiResponse> HelloWithHttpInfo(int ope }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -793,6 +796,7 @@ public Org.OpenAPITools.Client.ApiResponse>> RolesRe }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -919,6 +923,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1374,6 +1375,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1508,6 +1510,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1642,6 +1645,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1778,6 +1782,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1913,6 +1918,7 @@ public Org.OpenAPITools.Client.ApiResponse> GetArrayOfEnumsWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2039,6 +2045,7 @@ public Org.OpenAPITools.Client.ApiResponse GetMixedAnyOfWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2165,6 +2172,7 @@ public Org.OpenAPITools.Client.ApiResponse GetMixedOneOfWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2298,6 +2306,7 @@ public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesRefer }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2440,6 +2449,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyWithFileSchemaWithHtt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2590,6 +2600,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyWithQueryParamsWithHt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2744,6 +2755,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2920,6 +2932,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3200,6 +3213,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3237,7 +3251,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI } if (enumFormStringArray != null) { - localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter + localVarRequestOptions.FormParameters.Add("enum_form_string_array", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter } if (enumFormString != null) { @@ -3415,6 +3429,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3600,6 +3615,7 @@ public Org.OpenAPITools.Client.ApiResponse TestInlineAdditionalPropertie }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3742,6 +3758,7 @@ public Org.OpenAPITools.Client.ApiResponse TestInlineFreeformAdditionalP }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3892,6 +3909,7 @@ public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo( }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -4095,6 +4113,7 @@ public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo( }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -4316,6 +4335,7 @@ public Org.OpenAPITools.Client.ApiResponse TestStringMapReferenceWithHtt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index b0e5066eef8f..07c4ad398c66 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -244,6 +244,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClassnameWithHttpInf }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 8db5fd36849d..7e74501d82f4 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -641,6 +641,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -843,6 +844,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1022,6 +1024,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpIn }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1234,6 +1237,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1440,6 +1444,7 @@ public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1599,6 +1604,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1804,6 +1810,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1992,6 +1999,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2189,6 +2197,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index e8882b0fc2e4..af79df6916fe 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -378,6 +378,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -512,6 +513,7 @@ public Org.OpenAPITools.Client.ApiResponse> GetInventory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -651,6 +653,7 @@ public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -792,6 +795,7 @@ public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order o }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 174d0572e677..700610558ef8 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -567,6 +567,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User u }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -709,6 +710,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWith }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -851,6 +853,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -992,6 +995,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1135,6 +1139,7 @@ public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1289,6 +1294,7 @@ public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1434,6 +1440,7 @@ public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo(int op }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1573,6 +1580,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index a0a43ea74aeb..30158fdf49b7 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -385,6 +385,14 @@ private RestRequest NewRequest( } } + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + return request; } diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..c370847420c1 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -356,7 +356,7 @@ private string GetECDSASignature(byte[] dataToSign) } /// - /// Convert ANS1 format to DER format. Not recommended to use because it generate inavlid signature occationally. + /// Convert ANS1 format to DER format. Not recommended to use because it generate invalid signature occasionally. /// /// /// diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj deleted file mode 100644 index a381e6a2f3cf..000000000000 --- a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - Org.OpenAPITools.Test - Org.OpenAPITools.Test - net6.0 - false - annotations - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Api/FakeApi.cs deleted file mode 100644 index 38d8dec2a297..000000000000 --- a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Api/FakeApi.cs +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Dummy - * - * To test name, parameter mapping options - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// parameter name mapping test - /// - /// Thrown when fails to make API call - /// _type - /// type - /// type_ - /// http debug option (to test parameter naming option) - /// Index associated with the operation. - /// Env - Env GetParameterNameMapping(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0); - - /// - /// parameter name mapping test - /// - /// - /// - /// - /// Thrown when fails to make API call - /// _type - /// type - /// type_ - /// http debug option (to test parameter naming option) - /// Index associated with the operation. - /// ApiResponse of Env - ApiResponse GetParameterNameMappingWithHttpInfo(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// parameter name mapping test - /// - /// - /// - /// - /// Thrown when fails to make API call - /// _type - /// type - /// type_ - /// http debug option (to test parameter naming option) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Env - System.Threading.Tasks.Task GetParameterNameMappingAsync(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// parameter name mapping test - /// - /// - /// - /// - /// Thrown when fails to make API call - /// _type - /// type - /// type_ - /// http debug option (to test parameter naming option) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Env) - System.Threading.Tasks.Task> GetParameterNameMappingWithHttpInfoAsync(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApi : IFakeApiSync, IFakeApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class FakeApi : IFakeApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public FakeApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public FakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// parameter name mapping test - /// - /// Thrown when fails to make API call - /// _type - /// type - /// type_ - /// http debug option (to test parameter naming option) - /// Index associated with the operation. - /// Env - public Env GetParameterNameMapping(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetParameterNameMappingWithHttpInfo(UnderscoreType, type, TypeWithUnderscore, httpDebugOption); - return localVarResponse.Data; - } - - /// - /// parameter name mapping test - /// - /// Thrown when fails to make API call - /// _type - /// type - /// type_ - /// http debug option (to test parameter naming option) - /// Index associated with the operation. - /// ApiResponse of Env - public Org.OpenAPITools.Client.ApiResponse GetParameterNameMappingWithHttpInfo(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0) - { - // verify the required parameter 'type' is set - if (type == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'type' when calling FakeApi->GetParameterNameMapping"); - } - - // verify the required parameter 'TypeWithUnderscore' is set - if (TypeWithUnderscore == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'TypeWithUnderscore' when calling FakeApi->GetParameterNameMapping"); - } - - // verify the required parameter 'httpDebugOption' is set - if (httpDebugOption == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'httpDebugOption' when calling FakeApi->GetParameterNameMapping"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "type", type)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "http_debug_option", httpDebugOption)); - localVarRequestOptions.HeaderParameters.Add("_type", Org.OpenAPITools.Client.ClientUtils.ParameterToString(UnderscoreType)); // header parameter - localVarRequestOptions.HeaderParameters.Add("type_", Org.OpenAPITools.Client.ClientUtils.ParameterToString(TypeWithUnderscore)); // header parameter - - localVarRequestOptions.Operation = "FakeApi.GetParameterNameMapping"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake/parameter-name-mapping", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetParameterNameMapping", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// parameter name mapping test - /// - /// Thrown when fails to make API call - /// _type - /// type - /// type_ - /// http debug option (to test parameter naming option) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Env - public async System.Threading.Tasks.Task GetParameterNameMappingAsync(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetParameterNameMappingWithHttpInfoAsync(UnderscoreType, type, TypeWithUnderscore, httpDebugOption, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// parameter name mapping test - /// - /// Thrown when fails to make API call - /// _type - /// type - /// type_ - /// http debug option (to test parameter naming option) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Env) - public async System.Threading.Tasks.Task> GetParameterNameMappingWithHttpInfoAsync(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'type' is set - if (type == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'type' when calling FakeApi->GetParameterNameMapping"); - } - - // verify the required parameter 'TypeWithUnderscore' is set - if (TypeWithUnderscore == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'TypeWithUnderscore' when calling FakeApi->GetParameterNameMapping"); - } - - // verify the required parameter 'httpDebugOption' is set - if (httpDebugOption == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'httpDebugOption' when calling FakeApi->GetParameterNameMapping"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "type", type)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "http_debug_option", httpDebugOption)); - localVarRequestOptions.HeaderParameters.Add("_type", Org.OpenAPITools.Client.ClientUtils.ParameterToString(UnderscoreType)); // header parameter - localVarRequestOptions.HeaderParameters.Add("type_", Org.OpenAPITools.Client.ClientUtils.ParameterToString(TypeWithUnderscore)); // header parameter - - localVarRequestOptions.Operation = "FakeApi.GetParameterNameMapping"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/parameter-name-mapping", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetParameterNameMapping", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs deleted file mode 100644 index 841ef8cadece..000000000000 --- a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs +++ /dev/null @@ -1,814 +0,0 @@ -/* - * Dummy - * - * To test name, parameter mapping options - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters; -using System.Text; -using System.Threading; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using RestSharp; -using RestSharp.Serializers; -using RestSharpMethod = RestSharp.Method; -using FileIO = System.IO.File; -using Polly; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Client -{ - /// - /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. - /// - internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer - { - private readonly IReadableConfiguration _configuration; - private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - public CustomJsonCodec(IReadableConfiguration configuration) - { - _configuration = configuration; - } - - public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) - { - _serializerSettings = serializerSettings; - _configuration = configuration; - } - - /// - /// Serialize the object into a JSON string. - /// - /// Object to be serialized. - /// A JSON string. - public string Serialize(object obj) - { - if (obj != null && obj is AbstractOpenAPISchema) - { - // the object to be serialized is an oneOf/anyOf schema - return ((AbstractOpenAPISchema)obj).ToJson(); - } - else - { - return JsonConvert.SerializeObject(obj, _serializerSettings); - } - } - - public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); - - public T Deserialize(RestResponse response) - { - var result = (T)Deserialize(response, typeof(T)); - return result; - } - - /// - /// Deserialize the JSON string into a proper object. - /// - /// The HTTP response. - /// Object type. - /// Object representation of the JSON string. - internal object Deserialize(RestResponse response, Type type) - { - if (type == typeof(byte[])) // return byte array - { - return response.RawBytes; - } - - // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) - if (type == typeof(Stream)) - { - var bytes = response.RawBytes; - if (response.Headers != null) - { - var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) - ? global::System.IO.Path.GetTempPath() - : _configuration.TempFolderPath; - var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); - foreach (var header in response.Headers) - { - var match = regex.Match(header.ToString()); - if (match.Success) - { - string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); - FileIO.WriteAllBytes(fileName, bytes); - return new FileStream(fileName, FileMode.Open); - } - } - } - var stream = new MemoryStream(bytes); - return stream; - } - - if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object - { - return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); - } - - if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type - { - return Convert.ChangeType(response.Content, type); - } - - // at this point, it must be a model (json) - try - { - return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); - } - catch (Exception e) - { - throw new ApiException(500, e.Message); - } - } - - public ISerializer Serializer => this; - public IDeserializer Deserializer => this; - - public string[] AcceptedContentTypes => ContentType.JsonAccept; - - public SupportsContentType SupportsContentType => contentType => - contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || - contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); - - public ContentType ContentType { get; set; } = ContentType.Json; - - public DataFormat DataFormat => DataFormat.Json; - } - /// - /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), - /// encapsulating general REST accessor use cases. - /// - public partial class ApiClient : ISynchronousClient, IAsynchronousClient - { - private readonly string _baseUrl; - - /// - /// Specifies the settings on a object. - /// These settings can be adjusted to accommodate custom serialization rules. - /// - public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - /// - /// Allows for extending request processing for generated code. - /// - /// The RestSharp request object - partial void InterceptRequest(RestRequest request); - - /// - /// Allows for extending response processing for generated code. - /// - /// The RestSharp request object - /// The RestSharp response object - partial void InterceptResponse(RestRequest request, RestResponse response); - - /// - /// Initializes a new instance of the , defaulting to the global configurations' base url. - /// - public ApiClient() - { - _baseUrl = GlobalConfiguration.Instance.BasePath; - } - - /// - /// Initializes a new instance of the - /// - /// The target service's base path in URL format. - /// - public ApiClient(string basePath) - { - if (string.IsNullOrEmpty(basePath)) - throw new ArgumentException("basePath cannot be empty"); - - _baseUrl = basePath; - } - - /// - /// Constructs the RestSharp version of an http method - /// - /// Swagger Client Custom HttpMethod - /// RestSharp's HttpMethod instance. - /// - private RestSharpMethod Method(HttpMethod method) - { - RestSharpMethod other; - switch (method) - { - case HttpMethod.Get: - other = RestSharpMethod.Get; - break; - case HttpMethod.Post: - other = RestSharpMethod.Post; - break; - case HttpMethod.Put: - other = RestSharpMethod.Put; - break; - case HttpMethod.Delete: - other = RestSharpMethod.Delete; - break; - case HttpMethod.Head: - other = RestSharpMethod.Head; - break; - case HttpMethod.Options: - other = RestSharpMethod.Options; - break; - case HttpMethod.Patch: - other = RestSharpMethod.Patch; - break; - default: - throw new ArgumentOutOfRangeException("method", method, null); - } - - return other; - } - - /// - /// Provides all logic for constructing a new RestSharp . - /// At this point, all information for querying the service is known. - /// Here, it is simply mapped into the RestSharp request. - /// - /// The http verb. - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// [private] A new RestRequest instance. - /// - private RestRequest NewRequest( - HttpMethod method, - string path, - RequestOptions options, - IReadableConfiguration configuration) - { - if (path == null) throw new ArgumentNullException("path"); - if (options == null) throw new ArgumentNullException("options"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - RestRequest request = new RestRequest(path, Method(method)); - - if (options.PathParameters != null) - { - foreach (var pathParam in options.PathParameters) - { - request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); - } - } - - if (options.QueryParameters != null) - { - foreach (var queryParam in options.QueryParameters) - { - foreach (var value in queryParam.Value) - { - request.AddQueryParameter(queryParam.Key, value); - } - } - } - - if (configuration.DefaultHeaders != null) - { - foreach (var headerParam in configuration.DefaultHeaders) - { - request.AddHeader(headerParam.Key, headerParam.Value); - } - } - - if (options.HeaderParameters != null) - { - foreach (var headerParam in options.HeaderParameters) - { - foreach (var value in headerParam.Value) - { - request.AddHeader(headerParam.Key, value); - } - } - } - - if (options.FormParameters != null) - { - foreach (var formParam in options.FormParameters) - { - request.AddParameter(formParam.Key, formParam.Value); - } - } - - if (options.Data != null) - { - if (options.Data is Stream stream) - { - var contentType = "application/octet-stream"; - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - contentType = contentTypes[0]; - } - - var bytes = ClientUtils.ReadAsBytes(stream); - request.AddParameter(contentType, bytes, ParameterType.RequestBody); - } - else - { - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) - { - request.RequestFormat = DataFormat.Json; - } - else - { - // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. - } - } - else - { - // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. - request.RequestFormat = DataFormat.Json; - } - - request.AddJsonBody(options.Data); - } - } - - if (options.FileParameters != null) - { - foreach (var fileParam in options.FileParameters) - { - foreach (var file in fileParam.Value) - { - var bytes = ClientUtils.ReadAsBytes(file); - var fileStream = file as FileStream; - if (fileStream != null) - request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); - else - request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); - } - } - } - - return request; - } - - /// - /// Transforms a RestResponse instance into a new ApiResponse instance. - /// At this point, we have a concrete http response from the service. - /// Here, it is simply mapped into the [public] ApiResponse object. - /// - /// The RestSharp response object - /// A new ApiResponse instance. - private ApiResponse ToApiResponse(RestResponse response) - { - T result = response.Data; - string rawContent = response.Content; - - var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) - { - ErrorText = response.ErrorMessage, - Cookies = new List() - }; - - if (response.Headers != null) - { - foreach (var responseHeader in response.Headers) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.ContentHeaders != null) - { - foreach (var responseHeader in response.ContentHeaders) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.Cookies != null) - { - foreach (var responseCookies in response.Cookies.Cast()) - { - transformed.Cookies.Add( - new Cookie( - responseCookies.Name, - responseCookies.Value, - responseCookies.Path, - responseCookies.Domain) - ); - } - } - - return transformed; - } - - /// - /// Executes the HTTP request for the current service. - /// Based on functions received it can be async or sync. - /// - /// Local function that executes http request and returns http response. - /// Local function to specify options for the service. - /// The RestSharp request object - /// The RestSharp options object - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// A new ApiResponse instance. - private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; - var clientOptions = new RestClientOptions(baseUrl) - { - ClientCertificates = configuration.ClientCertificates, - Timeout = configuration.Timeout, - Proxy = configuration.Proxy, - UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials, - RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback - }; - setOptions(clientOptions); - - using (RestClient client = new RestClient(clientOptions, - configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) - { - InterceptRequest(request); - - RestResponse response = await getResponse(client); - - // if the response type is oneOf/anyOf, call FromJSON to deserialize the data - if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) - { - try - { - response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); - } - catch (Exception ex) - { - throw ex.InnerException != null ? ex.InnerException : ex; - } - } - else if (typeof(T).Name == "Stream") // for binary response - { - response.Data = (T)(object)new MemoryStream(response.RawBytes); - } - else if (typeof(T).Name == "Byte[]") // for byte response - { - response.Data = (T)(object)response.RawBytes; - } - else if (typeof(T).Name == "String") // for string response - { - response.Data = (T)(object)response.Content; - } - - InterceptResponse(request, response); - - var result = ToApiResponse(response); - if (response.ErrorMessage != null) - { - result.ErrorText = response.ErrorMessage; - } - - if (response.Cookies != null && response.Cookies.Count > 0) - { - if (result.Cookies == null) result.Cookies = new List(); - foreach (var restResponseCookie in response.Cookies.Cast()) - { - var cookie = new Cookie( - restResponseCookie.Name, - restResponseCookie.Value, - restResponseCookie.Path, - restResponseCookie.Domain - ) - { - Comment = restResponseCookie.Comment, - CommentUri = restResponseCookie.CommentUri, - Discard = restResponseCookie.Discard, - Expired = restResponseCookie.Expired, - Expires = restResponseCookie.Expires, - HttpOnly = restResponseCookie.HttpOnly, - Port = restResponseCookie.Port, - Secure = restResponseCookie.Secure, - Version = restResponseCookie.Version - }; - - result.Cookies.Add(cookie); - } - } - return result; - } - } - - private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) - { - if (policyResult.Outcome == OutcomeType.Successful) - { - return await client.Deserialize(policyResult.Result, cancellationToken); - } - else - { - return new RestResponse(request) - { - ErrorException = policyResult.FinalException - }; - } - } - - private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - Action setOptions = (clientOptions) => - { - var cookies = new CookieContainer(); - - if (options.Cookies != null && options.Cookies.Count > 0) - { - foreach (var cookie in options.Cookies) - { - cookies.Add(new Cookie(cookie.Name, cookie.Value)); - } - } - clientOptions.CookieContainer = cookies; - }; - - Func>> getResponse = (client) => - { - if (RetryConfiguration.RetryPolicy != null) - { - var policy = RetryConfiguration.RetryPolicy; - var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); - return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); - } - else - { - return Task.FromResult(client.Execute(request)); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); - } - - private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) - { - Action setOptions = (clientOptions) => - { - //no extra options - }; - - Func>> getResponse = async (client) => - { - if (RetryConfiguration.AsyncRetryPolicy != null) - { - var policy = RetryConfiguration.AsyncRetryPolicy; - var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); - return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); - } - else - { - return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration); - } - - #region IAsynchronousClient - /// - /// Make a HTTP GET request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP POST request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PUT request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP DELETE request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP HEAD request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP OPTION request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PATCH request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); - } - #endregion IAsynchronousClient - - #region ISynchronousClient - /// - /// Make a HTTP GET request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); - } - - /// - /// Make a HTTP POST request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); - } - - /// - /// Make a HTTP PUT request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); - } - - /// - /// Make a HTTP DELETE request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); - } - - /// - /// Make a HTTP HEAD request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); - } - - /// - /// Make a HTTP OPTION request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); - } - - /// - /// Make a HTTP PATCH request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); - } - #endregion ISynchronousClient - } -} diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj deleted file mode 100644 index a5a6bf6200b9..000000000000 --- a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - false - net6.0 - Org.OpenAPITools - Org.OpenAPITools - Library - OpenAPI - OpenAPI - OpenAPI Library - A library generated from a OpenAPI doc - No Copyright - Org.OpenAPITools - 1.0.0 - bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml - https://github.com/GIT_USER_ID/GIT_REPO_ID.git - git - Minor update - annotations - false - - - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/CatAllOf.md b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/CatAllOf.md deleted file mode 100644 index 6cbaaa14e814..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/CatAllOf.md +++ /dev/null @@ -1,10 +0,0 @@ -# Org.OpenAPITools.Model.CatAllOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Declawed** | **bool** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ChildCatAllOf.md b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ChildCatAllOf.md deleted file mode 100644 index 864d33e80e7a..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ChildCatAllOf.md +++ /dev/null @@ -1,11 +0,0 @@ -# Org.OpenAPITools.Model.ChildCatAllOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Name** | **string** | | [optional] -**PetType** | **string** | | [optional] [default to PetTypeEnum.ChildCat] - -[[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/csharp/restsharp/net7/EnumMappings/docs/DogAllOf.md b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DogAllOf.md deleted file mode 100644 index c1096f2c3105..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DogAllOf.md +++ /dev/null @@ -1,10 +0,0 @@ -# Org.OpenAPITools.Model.DogAllOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Breed** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedEnumType.md b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedEnumType.md deleted file mode 100644 index 24385b3ae84f..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedEnumType.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.MixedEnumType - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/csharp/restsharp/net7/EnumMappings/docs/MixedNullableEnumType.md b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedNullableEnumType.md deleted file mode 100644 index a38369d002d1..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedNullableEnumType.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.MixedNullableEnumType - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/csharp/restsharp/net7/EnumMappings/docs/PetStatusFilter.md b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/PetStatusFilter.md deleted file mode 100644 index ce995e71d575..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/PetStatusFilter.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.PetStatusFilter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/csharp/restsharp/net7/EnumMappings/docs/UpdatePet200Response.md b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/UpdatePet200Response.md deleted file mode 100644 index d1625d266647..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/UpdatePet200Response.md +++ /dev/null @@ -1,10 +0,0 @@ -# Org.OpenAPITools.Model.UpdatePet200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**VarString** | [**Pet**](Pet.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/CatAllOfTests.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/CatAllOfTests.cs deleted file mode 100644 index fb51c28489cb..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/CatAllOfTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing CatAllOf - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class CatAllOfTests : IDisposable - { - // TODO uncomment below to declare an instance variable for CatAllOf - //private CatAllOf instance; - - public CatAllOfTests() - { - // TODO uncomment below to create an instance of CatAllOf - //instance = new CatAllOf(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of CatAllOf - /// - [Fact] - public void CatAllOfInstanceTest() - { - // TODO uncomment below to test "IsType" CatAllOf - //Assert.IsType(instance); - } - - - /// - /// Test the property 'Declawed' - /// - [Fact] - public void DeclawedTest() - { - // TODO unit test for the property 'Declawed' - } - - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ChildCatAllOfTests.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ChildCatAllOfTests.cs deleted file mode 100644 index 49a539324904..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ChildCatAllOfTests.cs +++ /dev/null @@ -1,78 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing ChildCatAllOf - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class ChildCatAllOfTests : IDisposable - { - // TODO uncomment below to declare an instance variable for ChildCatAllOf - //private ChildCatAllOf instance; - - public ChildCatAllOfTests() - { - // TODO uncomment below to create an instance of ChildCatAllOf - //instance = new ChildCatAllOf(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of ChildCatAllOf - /// - [Fact] - public void ChildCatAllOfInstanceTest() - { - // TODO uncomment below to test "IsType" ChildCatAllOf - //Assert.IsType(instance); - } - - - /// - /// Test the property 'Name' - /// - [Fact] - public void NameTest() - { - // TODO unit test for the property 'Name' - } - /// - /// Test the property 'PetType' - /// - [Fact] - public void PetTypeTest() - { - // TODO unit test for the property 'PetType' - } - - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DogAllOfTests.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DogAllOfTests.cs deleted file mode 100644 index b22a44420963..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DogAllOfTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing DogAllOf - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class DogAllOfTests : IDisposable - { - // TODO uncomment below to declare an instance variable for DogAllOf - //private DogAllOf instance; - - public DogAllOfTests() - { - // TODO uncomment below to create an instance of DogAllOf - //instance = new DogAllOf(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of DogAllOf - /// - [Fact] - public void DogAllOfInstanceTest() - { - // TODO uncomment below to test "IsType" DogAllOf - //Assert.IsType(instance); - } - - - /// - /// Test the property 'Breed' - /// - [Fact] - public void BreedTest() - { - // TODO unit test for the property 'Breed' - } - - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedEnumTypeTests.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedEnumTypeTests.cs deleted file mode 100644 index 5fb0741f597b..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedEnumTypeTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing MixedEnumType - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class MixedEnumTypeTests : IDisposable - { - // TODO uncomment below to declare an instance variable for MixedEnumType - //private MixedEnumType instance; - - public MixedEnumTypeTests() - { - // TODO uncomment below to create an instance of MixedEnumType - //instance = new MixedEnumType(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of MixedEnumType - /// - [Fact] - public void MixedEnumTypeInstanceTest() - { - // TODO uncomment below to test "IsType" MixedEnumType - //Assert.IsType(instance); - } - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedNullableEnumTypeTests.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedNullableEnumTypeTests.cs deleted file mode 100644 index c13101dc08f5..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedNullableEnumTypeTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing MixedNullableEnumType - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class MixedNullableEnumTypeTests : IDisposable - { - // TODO uncomment below to declare an instance variable for MixedNullableEnumType - //private MixedNullableEnumType instance; - - public MixedNullableEnumTypeTests() - { - // TODO uncomment below to create an instance of MixedNullableEnumType - //instance = new MixedNullableEnumType(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of MixedNullableEnumType - /// - [Fact] - public void MixedNullableEnumTypeInstanceTest() - { - // TODO uncomment below to test "IsType" MixedNullableEnumType - //Assert.IsType(instance); - } - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/PetStatusFilterTests.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/PetStatusFilterTests.cs deleted file mode 100644 index 2a26d8deff71..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/PetStatusFilterTests.cs +++ /dev/null @@ -1,62 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing PetStatusFilter - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class PetStatusFilterTests : IDisposable - { - // TODO uncomment below to declare an instance variable for PetStatusFilter - //private PetStatusFilter instance; - - public PetStatusFilterTests() - { - // TODO uncomment below to create an instance of PetStatusFilter - //instance = new PetStatusFilter(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of PetStatusFilter - /// - [Fact] - public void PetStatusFilterInstanceTest() - { - // TODO uncomment below to test "IsType" PetStatusFilter - //Assert.IsType(instance); - } - - - - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/UpdatePet200ResponseTests.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/UpdatePet200ResponseTests.cs deleted file mode 100644 index 8cb066737bc4..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/UpdatePet200ResponseTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing UpdatePet200Response - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class UpdatePet200ResponseTests : IDisposable - { - // TODO uncomment below to declare an instance variable for UpdatePet200Response - //private UpdatePet200Response instance; - - public UpdatePet200ResponseTests() - { - // TODO uncomment below to create an instance of UpdatePet200Response - //instance = new UpdatePet200Response(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of UpdatePet200Response - /// - [Fact] - public void UpdatePet200ResponseInstanceTest() - { - // TODO uncomment below to test "IsType" UpdatePet200Response - //Assert.IsType(instance); - } - - /// - /// Test the property 'VarString' - /// - [Fact] - public void VarStringTest() - { - // TODO unit test for the property 'VarString' - } - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj deleted file mode 100644 index 2bd81bb6826e..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - Org.OpenAPITools.Test - Org.OpenAPITools.Test - net7.0 - false - annotations - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/AnotherFakeApi.cs deleted file mode 100644 index 9ccd159a44f9..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ /dev/null @@ -1,354 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IAnotherFakeApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// To test special tags - /// - /// - /// To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - ModelClient Call123TestSpecialTags(ModelClient modelClient, int operationIndex = 0); - - /// - /// To test special tags - /// - /// - /// To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - ApiResponse Call123TestSpecialTagsWithHttpInfo(ModelClient modelClient, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IAnotherFakeApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// To test special tags - /// - /// - /// To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - System.Threading.Tasks.Task Call123TestSpecialTagsAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// To test special tags - /// - /// - /// To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IAnotherFakeApi : IAnotherFakeApiSync, IAnotherFakeApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class AnotherFakeApi : IAnotherFakeApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public AnotherFakeApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public AnotherFakeApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public AnotherFakeApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public AnotherFakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// To test special tags To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - public ModelClient Call123TestSpecialTags(ModelClient modelClient, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); - return localVarResponse.Data; - } - - /// - /// To test special tags To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - public Org.OpenAPITools.Client.ApiResponse Call123TestSpecialTagsWithHttpInfo(ModelClient modelClient, int operationIndex = 0) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "AnotherFakeApi.Call123TestSpecialTags"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Patch("/another-fake/dummy", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test special tags To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - public async System.Threading.Tasks.Task Call123TestSpecialTagsAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await Call123TestSpecialTagsWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// To test special tags To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "AnotherFakeApi.Call123TestSpecialTags"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PatchAsync("/another-fake/dummy", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/DefaultApi.cs deleted file mode 100644 index 54f3d2e41a93..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/DefaultApi.cs +++ /dev/null @@ -1,1018 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IDefaultApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// FooGetDefaultResponse - FooGetDefaultResponse FooGet(int operationIndex = 0); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of FooGetDefaultResponse - ApiResponse FooGetWithHttpInfo(int operationIndex = 0); - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// - void GetCountry(string country, int operationIndex = 0); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse GetCountryWithHttpInfo(string country, int operationIndex = 0); - /// - /// Hello - /// - /// - /// Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<Guid> - List Hello(int operationIndex = 0); - - /// - /// Hello - /// - /// - /// Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<Guid> - ApiResponse> HelloWithHttpInfo(int operationIndex = 0); - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<List<RolesReportsHash>> - List> RolesReportGet(int operationIndex = 0); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<List<RolesReportsHash>> - ApiResponse>> RolesReportGetWithHttpInfo(int operationIndex = 0); - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// NotificationtestGetElementsV1ResponseMPayload - NotificationtestGetElementsV1ResponseMPayload Test(int operationIndex = 0); - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of NotificationtestGetElementsV1ResponseMPayload - ApiResponse TestWithHttpInfo(int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IDefaultApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of FooGetDefaultResponse - System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (FooGetDefaultResponse) - System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task GetCountryAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> GetCountryWithHttpInfoAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Hello - /// - /// - /// Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Guid> - System.Threading.Tasks.Task> HelloAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Hello - /// - /// - /// Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Guid>) - System.Threading.Tasks.Task>> HelloWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<List<RolesReportsHash>> - System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<List<RolesReportsHash>>) - System.Threading.Tasks.Task>>> RolesReportGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of NotificationtestGetElementsV1ResponseMPayload - System.Threading.Tasks.Task TestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (NotificationtestGetElementsV1ResponseMPayload) - System.Threading.Tasks.Task> TestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IDefaultApi : IDefaultApiSync, IDefaultApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class DefaultApi : IDefaultApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public DefaultApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public DefaultApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public DefaultApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public DefaultApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// FooGetDefaultResponse - public FooGetDefaultResponse FooGet(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of FooGetDefaultResponse - public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.FooGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of FooGetDefaultResponse - public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (FooGetDefaultResponse) - public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.FooGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// - public void GetCountry(string country, int operationIndex = 0) - { - GetCountryWithHttpInfo(country); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse GetCountryWithHttpInfo(string country, int operationIndex = 0) - { - // verify the required parameter 'country' is set - if (country == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'country' when calling DefaultApi->GetCountry"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.FormParameters.Add("country", Org.OpenAPITools.Client.ClientUtils.ParameterToString(country)); // form parameter - - localVarRequestOptions.Operation = "DefaultApi.GetCountry"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/country", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetCountry", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task GetCountryAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await GetCountryWithHttpInfoAsync(country, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> GetCountryWithHttpInfoAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'country' is set - if (country == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'country' when calling DefaultApi->GetCountry"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.FormParameters.Add("country", Org.OpenAPITools.Client.ClientUtils.ParameterToString(country)); // form parameter - - localVarRequestOptions.Operation = "DefaultApi.GetCountry"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/country", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetCountry", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Hello Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<Guid> - public List Hello(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = HelloWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Hello Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<Guid> - public Org.OpenAPITools.Client.ApiResponse> HelloWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.Hello"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get>("/hello", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Hello", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Hello Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Guid> - public async System.Threading.Tasks.Task> HelloAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await HelloWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Hello Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Guid>) - public async System.Threading.Tasks.Task>> HelloWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.Hello"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/hello", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Hello", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<List<RolesReportsHash>> - public List> RolesReportGet(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse>> localVarResponse = RolesReportGetWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<List<RolesReportsHash>> - public Org.OpenAPITools.Client.ApiResponse>> RolesReportGetWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.RolesReportGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get>>("/roles/report", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("RolesReportGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<List<RolesReportsHash>> - public async System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse>> localVarResponse = await RolesReportGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<List<RolesReportsHash>>) - public async System.Threading.Tasks.Task>>> RolesReportGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.RolesReportGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>>("/roles/report", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("RolesReportGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// NotificationtestGetElementsV1ResponseMPayload - public NotificationtestGetElementsV1ResponseMPayload Test(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = TestWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of NotificationtestGetElementsV1ResponseMPayload - public Org.OpenAPITools.Client.ApiResponse TestWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.Test"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/test", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Test", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of NotificationtestGetElementsV1ResponseMPayload - public async System.Threading.Tasks.Task TestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (NotificationtestGetElementsV1ResponseMPayload) - public async System.Threading.Tasks.Task> TestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.Test"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/test", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Test", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/FakeApi.cs deleted file mode 100644 index 8fc96497aa05..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/FakeApi.cs +++ /dev/null @@ -1,4424 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// HealthCheckResult - HealthCheckResult FakeHealthGet(int operationIndex = 0); - - /// - /// Health check endpoint - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of HealthCheckResult - ApiResponse FakeHealthGetWithHttpInfo(int operationIndex = 0); - /// - /// - /// - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// bool - bool FakeOuterBooleanSerialize(bool? body = default(bool?), int operationIndex = 0); - - /// - /// - /// - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// ApiResponse of bool - ApiResponse FakeOuterBooleanSerializeWithHttpInfo(bool? body = default(bool?), int operationIndex = 0); - /// - /// - /// - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// OuterComposite - OuterComposite FakeOuterCompositeSerialize(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0); - - /// - /// - /// - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// ApiResponse of OuterComposite - ApiResponse FakeOuterCompositeSerializeWithHttpInfo(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0); - /// - /// - /// - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// decimal - decimal FakeOuterNumberSerialize(decimal? body = default(decimal?), int operationIndex = 0); - - /// - /// - /// - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// ApiResponse of decimal - ApiResponse FakeOuterNumberSerializeWithHttpInfo(decimal? body = default(decimal?), int operationIndex = 0); - /// - /// - /// - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// string - string FakeOuterStringSerialize(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0); - - /// - /// - /// - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// ApiResponse of string - ApiResponse FakeOuterStringSerializeWithHttpInfo(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0); - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<OuterEnum> - List GetArrayOfEnums(int operationIndex = 0); - - /// - /// Array of Enums - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<OuterEnum> - ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// MixedAnyOf - MixedAnyOf GetMixedAnyOf(int operationIndex = 0); - - /// - /// Test mixed type anyOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of MixedAnyOf - ApiResponse GetMixedAnyOfWithHttpInfo(int operationIndex = 0); - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// MixedOneOf - MixedOneOf GetMixedOneOf(int operationIndex = 0); - - /// - /// Test mixed type oneOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of MixedOneOf - ApiResponse GetMixedOneOfWithHttpInfo(int operationIndex = 0); - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); - - /// - /// test referenced additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); - /// - /// - /// - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// - void TestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0); - - /// - /// - /// - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0); - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// - void TestBodyWithQueryParams(string query, User user, int operationIndex = 0); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestBodyWithQueryParamsWithHttpInfo(string query, User user, int operationIndex = 0); - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - ModelClient TestClientModel(ModelClient modelClient, int operationIndex = 0); - - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - ApiResponse TestClientModelWithHttpInfo(ModelClient modelClient, int operationIndex = 0); - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// - void TestEndpointParameters(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0); - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestEndpointParametersWithHttpInfo(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0); - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// - void TestEnumParameters(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0); - - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestEnumParametersWithHttpInfo(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0); - /// - /// Fake endpoint to test group parameters (optional) - /// - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// - void TestGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0); - - /// - /// Fake endpoint to test group parameters (optional) - /// - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0); - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - void TestInlineAdditionalProperties(Dictionary requestBody, int operationIndex = 0); - - /// - /// test inline additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestInlineAdditionalPropertiesWithHttpInfo(Dictionary requestBody, int operationIndex = 0); - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0); - - /// - /// test inline free-form additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0); - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// - void TestJsonFormData(string param, string param2, int operationIndex = 0); - - /// - /// test json serialization of form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestJsonFormDataWithHttpInfo(string param, string param2, int operationIndex = 0); - /// - /// - /// - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); - - /// - /// - /// - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - void TestStringMapReference(Dictionary requestBody, int operationIndex = 0); - - /// - /// test referenced string map - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestStringMapReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// Health check endpoint - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of HealthCheckResult - System.Threading.Tasks.Task FakeHealthGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Health check endpoint - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (HealthCheckResult) - System.Threading.Tasks.Task> FakeHealthGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of bool - System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (bool) - System.Threading.Tasks.Task> FakeOuterBooleanSerializeWithHttpInfoAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of OuterComposite - System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (OuterComposite) - System.Threading.Tasks.Task> FakeOuterCompositeSerializeWithHttpInfoAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of decimal - System.Threading.Tasks.Task FakeOuterNumberSerializeAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (decimal) - System.Threading.Tasks.Task> FakeOuterNumberSerializeWithHttpInfoAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of string - System.Threading.Tasks.Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (string) - System.Threading.Tasks.Task> FakeOuterStringSerializeWithHttpInfoAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Array of Enums - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<OuterEnum> - System.Threading.Tasks.Task> GetArrayOfEnumsAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Array of Enums - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<OuterEnum>) - System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Test mixed type anyOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of MixedAnyOf - System.Threading.Tasks.Task GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Test mixed type anyOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (MixedAnyOf) - System.Threading.Tasks.Task> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Test mixed type oneOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of MixedOneOf - System.Threading.Tasks.Task GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Test mixed type oneOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (MixedOneOf) - System.Threading.Tasks.Task> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test referenced additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test referenced additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestBodyWithFileSchemaWithHttpInfoAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestBodyWithQueryParamsAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestBodyWithQueryParamsWithHttpInfoAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - System.Threading.Tasks.Task TestClientModelAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestClientModelWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestEndpointParametersAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestEndpointParametersWithHttpInfoAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestEnumParametersAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestEnumParametersWithHttpInfoAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Fake endpoint to test group parameters (optional) - /// - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestGroupParametersAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Fake endpoint to test group parameters (optional) - /// - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestGroupParametersWithHttpInfoAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test inline additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test inline additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestInlineAdditionalPropertiesWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test inline free-form additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test inline free-form additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test json serialization of form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestJsonFormDataAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test json serialization of form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestJsonFormDataWithHttpInfoAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test referenced string map - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestStringMapReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test referenced string map - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestStringMapReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApi : IFakeApiSync, IFakeApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class FakeApi : IFakeApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public FakeApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public FakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// HealthCheckResult - public HealthCheckResult FakeHealthGet(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeHealthGetWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of HealthCheckResult - public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.FakeHealthGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake/health", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeHealthGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of HealthCheckResult - public async System.Threading.Tasks.Task FakeHealthGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeHealthGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (HealthCheckResult) - public async System.Threading.Tasks.Task> FakeHealthGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.FakeHealthGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/health", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeHealthGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// bool - public bool FakeOuterBooleanSerialize(bool? body = default(bool?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// ApiResponse of bool - public Org.OpenAPITools.Client.ApiResponse FakeOuterBooleanSerializeWithHttpInfo(bool? body = default(bool?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterBooleanSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/outer/boolean", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of bool - public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterBooleanSerializeWithHttpInfoAsync(body, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (bool) - public async System.Threading.Tasks.Task> FakeOuterBooleanSerializeWithHttpInfoAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterBooleanSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/boolean", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// OuterComposite - public OuterComposite FakeOuterCompositeSerialize(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterCompositeSerializeWithHttpInfo(outerComposite); - return localVarResponse.Data; - } - - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// ApiResponse of OuterComposite - public Org.OpenAPITools.Client.ApiResponse FakeOuterCompositeSerializeWithHttpInfo(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = outerComposite; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterCompositeSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/outer/composite", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of OuterComposite - public async System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterCompositeSerializeWithHttpInfoAsync(outerComposite, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (OuterComposite) - public async System.Threading.Tasks.Task> FakeOuterCompositeSerializeWithHttpInfoAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = outerComposite; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterCompositeSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/composite", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// decimal - public decimal FakeOuterNumberSerialize(decimal? body = default(decimal?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// ApiResponse of decimal - public Org.OpenAPITools.Client.ApiResponse FakeOuterNumberSerializeWithHttpInfo(decimal? body = default(decimal?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterNumberSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/outer/number", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of decimal - public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterNumberSerializeWithHttpInfoAsync(body, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (decimal) - public async System.Threading.Tasks.Task> FakeOuterNumberSerializeWithHttpInfoAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterNumberSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/number", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// string - public string FakeOuterStringSerialize(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterStringSerializeWithHttpInfo(requiredStringUuid, body); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// ApiResponse of string - public Org.OpenAPITools.Client.ApiResponse FakeOuterStringSerializeWithHttpInfo(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_uuid", requiredStringUuid)); - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterStringSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/outer/string", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterStringSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of string - public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterStringSerializeWithHttpInfoAsync(requiredStringUuid, body, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (string) - public async System.Threading.Tasks.Task> FakeOuterStringSerializeWithHttpInfoAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_uuid", requiredStringUuid)); - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterStringSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/string", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterStringSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<OuterEnum> - public List GetArrayOfEnums(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetArrayOfEnumsWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<OuterEnum> - public Org.OpenAPITools.Client.ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetArrayOfEnums"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get>("/fake/array-of-enums", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetArrayOfEnums", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<OuterEnum> - public async System.Threading.Tasks.Task> GetArrayOfEnumsAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetArrayOfEnumsWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<OuterEnum>) - public async System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetArrayOfEnums"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/fake/array-of-enums", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetArrayOfEnums", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// MixedAnyOf - public MixedAnyOf GetMixedAnyOf(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetMixedAnyOfWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of MixedAnyOf - public Org.OpenAPITools.Client.ApiResponse GetMixedAnyOfWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of MixedAnyOf - public async System.Threading.Tasks.Task GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetMixedAnyOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (MixedAnyOf) - public async System.Threading.Tasks.Task> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// MixedOneOf - public MixedOneOf GetMixedOneOf(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetMixedOneOfWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of MixedOneOf - public Org.OpenAPITools.Client.ApiResponse GetMixedOneOfWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of MixedOneOf - public async System.Threading.Tasks.Task GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetMixedOneOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (MixedOneOf) - public async System.Threading.Tasks.Task> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) - { - TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); - } - - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// - public void TestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0) - { - TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); - } - - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0) - { - // verify the required parameter 'fileSchemaTestClass' is set - if (fileSchemaTestClass == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = fileSchemaTestClass; - - localVarRequestOptions.Operation = "FakeApi.TestBodyWithFileSchema"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Put("/fake/body-with-file-schema", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestBodyWithFileSchema", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestBodyWithFileSchemaWithHttpInfoAsync(fileSchemaTestClass, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestBodyWithFileSchemaWithHttpInfoAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'fileSchemaTestClass' is set - if (fileSchemaTestClass == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = fileSchemaTestClass; - - localVarRequestOptions.Operation = "FakeApi.TestBodyWithFileSchema"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/body-with-file-schema", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestBodyWithFileSchema", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// - public void TestBodyWithQueryParams(string query, User user, int operationIndex = 0) - { - TestBodyWithQueryParamsWithHttpInfo(query, user); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestBodyWithQueryParamsWithHttpInfo(string query, User user, int operationIndex = 0) - { - // verify the required parameter 'query' is set - if (query == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); - } - - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling FakeApi->TestBodyWithQueryParams"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "FakeApi.TestBodyWithQueryParams"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Put("/fake/body-with-query-params", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestBodyWithQueryParams", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestBodyWithQueryParamsAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestBodyWithQueryParamsWithHttpInfoAsync(query, user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestBodyWithQueryParamsWithHttpInfoAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'query' is set - if (query == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); - } - - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling FakeApi->TestBodyWithQueryParams"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "FakeApi.TestBodyWithQueryParams"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/body-with-query-params", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestBodyWithQueryParams", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - public ModelClient TestClientModel(ModelClient modelClient, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClientModelWithHttpInfo(modelClient); - return localVarResponse.Data; - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpInfo(ModelClient modelClient, int operationIndex = 0) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeApi->TestClientModel"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "FakeApi.TestClientModel"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Patch("/fake", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestClientModel", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - public async System.Threading.Tasks.Task TestClientModelAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClientModelWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestClientModelWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeApi->TestClientModel"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "FakeApi.TestClientModel"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PatchAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestClientModel", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// - public void TestEndpointParameters(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0) - { - TestEndpointParametersWithHttpInfo(number, varDouble, patternWithoutDelimiter, varByte, integer, int32, int64, varFloat, varString, binary, date, dateTime, password, callback); - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestEndpointParametersWithHttpInfo(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0) - { - // verify the required parameter 'patternWithoutDelimiter' is set - if (patternWithoutDelimiter == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); - } - - // verify the required parameter 'varByte' is set - if (varByte == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'varByte' when calling FakeApi->TestEndpointParameters"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - if (integer != null) - { - localVarRequestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter - } - if (int32 != null) - { - localVarRequestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter - } - if (int64 != null) - { - localVarRequestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter - } - localVarRequestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter - if (varFloat != null) - { - localVarRequestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varFloat)); // form parameter - } - localVarRequestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varDouble)); // form parameter - if (varString != null) - { - localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varString)); // form parameter - } - localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter - localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varByte)); // form parameter - if (binary != null) - { - localVarRequestOptions.FileParameters.Add("binary", binary); - } - if (date != null) - { - localVarRequestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter - } - if (dateTime != null) - { - localVarRequestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter - } - if (password != null) - { - localVarRequestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter - } - if (callback != null) - { - localVarRequestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestEndpointParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (http_basic_test) required - // http basic authentication required - if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestEndpointParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestEndpointParametersAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestEndpointParametersWithHttpInfoAsync(number, varDouble, patternWithoutDelimiter, varByte, integer, int32, int64, varFloat, varString, binary, date, dateTime, password, callback, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestEndpointParametersWithHttpInfoAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'patternWithoutDelimiter' is set - if (patternWithoutDelimiter == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); - } - - // verify the required parameter 'varByte' is set - if (varByte == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'varByte' when calling FakeApi->TestEndpointParameters"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - if (integer != null) - { - localVarRequestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter - } - if (int32 != null) - { - localVarRequestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter - } - if (int64 != null) - { - localVarRequestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter - } - localVarRequestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter - if (varFloat != null) - { - localVarRequestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varFloat)); // form parameter - } - localVarRequestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varDouble)); // form parameter - if (varString != null) - { - localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varString)); // form parameter - } - localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter - localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varByte)); // form parameter - if (binary != null) - { - localVarRequestOptions.FileParameters.Add("binary", binary); - } - if (date != null) - { - localVarRequestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter - } - if (dateTime != null) - { - localVarRequestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter - } - if (password != null) - { - localVarRequestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter - } - if (callback != null) - { - localVarRequestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestEndpointParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (http_basic_test) required - // http basic authentication required - if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestEndpointParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// - public void TestEnumParameters(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0) - { - TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestEnumParametersWithHttpInfo(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - if (enumQueryStringArray != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "enum_query_string_array", enumQueryStringArray)); - } - if (enumQueryString != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)); - } - if (enumQueryInteger != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)); - } - if (enumQueryDouble != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); - } - if (enumHeaderStringArray != null) - { - localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter - } - if (enumHeaderString != null) - { - localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter - } - if (enumFormStringArray != null) - { - localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter - } - if (enumFormString != null) - { - localVarRequestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestEnumParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestEnumParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestEnumParametersAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestEnumParametersWithHttpInfoAsync(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestEnumParametersWithHttpInfoAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - if (enumQueryStringArray != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "enum_query_string_array", enumQueryStringArray)); - } - if (enumQueryString != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)); - } - if (enumQueryInteger != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)); - } - if (enumQueryDouble != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); - } - if (enumHeaderStringArray != null) - { - localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter - } - if (enumHeaderString != null) - { - localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter - } - if (enumFormStringArray != null) - { - localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter - } - if (enumFormString != null) - { - localVarRequestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestEnumParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestEnumParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// - public void TestGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0) - { - TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); - } - - /// - /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)); - if (stringGroup != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)); - } - if (int64Group != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)); - } - localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter - if (booleanGroup != null) - { - localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestGroupParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (bearer_test) required - // bearer authentication required - if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - - // make the HTTP request - var localVarResponse = this.Client.Delete("/fake", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestGroupParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestGroupParametersAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestGroupParametersWithHttpInfoAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestGroupParametersWithHttpInfoAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)); - if (stringGroup != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)); - } - if (int64Group != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)); - } - localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter - if (booleanGroup != null) - { - localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestGroupParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (bearer_test) required - // bearer authentication required - if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.DeleteAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestGroupParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - public void TestInlineAdditionalProperties(Dictionary requestBody, int operationIndex = 0) - { - TestInlineAdditionalPropertiesWithHttpInfo(requestBody); - } - - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestInlineAdditionalPropertiesWithHttpInfo(Dictionary requestBody, int operationIndex = 0) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestInlineAdditionalProperties"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestInlineAdditionalProperties"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/inline-additionalProperties", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestInlineAdditionalPropertiesWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestInlineAdditionalPropertiesWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestInlineAdditionalProperties"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestInlineAdditionalProperties"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/inline-additionalProperties", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - public void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0) - { - TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); - } - - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0) - { - // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set - if (testInlineFreeformAdditionalPropertiesRequest == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest; - - localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(testInlineFreeformAdditionalPropertiesRequest, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set - if (testInlineFreeformAdditionalPropertiesRequest == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest; - - localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// - public void TestJsonFormData(string param, string param2, int operationIndex = 0) - { - TestJsonFormDataWithHttpInfo(param, param2); - } - - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo(string param, string param2, int operationIndex = 0) - { - // verify the required parameter 'param' is set - if (param == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); - } - - // verify the required parameter 'param2' is set - if (param2 == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter - localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter - - localVarRequestOptions.Operation = "FakeApi.TestJsonFormData"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake/jsonFormData", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestJsonFormData", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestJsonFormDataAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestJsonFormDataWithHttpInfoAsync(param, param2, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestJsonFormDataWithHttpInfoAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'param' is set - if (param == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); - } - - // verify the required parameter 'param2' is set - if (param2 == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter - localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter - - localVarRequestOptions.Operation = "FakeApi.TestJsonFormData"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/jsonFormData", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestJsonFormData", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) - { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); - } - - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) - { - // verify the required parameter 'pipe' is set - if (pipe == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'ioutil' is set - if (ioutil == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'http' is set - if (http == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'url' is set - if (url == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'context' is set - if (context == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'requiredNotNullable' is set - if (requiredNotNullable == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'requiredNullable' is set - if (requiredNullable == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "pipe", pipe)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); - if (notRequiredNotNullable != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); - } - if (notRequiredNullable != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); - } - - localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Put("/fake/test-query-parameters", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'pipe' is set - if (pipe == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'ioutil' is set - if (ioutil == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'http' is set - if (http == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'url' is set - if (url == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'context' is set - if (context == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'requiredNotNullable' is set - if (requiredNotNullable == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'requiredNullable' is set - if (requiredNullable == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "pipe", pipe)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); - if (notRequiredNotNullable != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); - } - if (notRequiredNullable != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); - } - - localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/test-query-parameters", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - public void TestStringMapReference(Dictionary requestBody, int operationIndex = 0) - { - TestStringMapReferenceWithHttpInfo(requestBody); - } - - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestStringMapReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestStringMapReference"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestStringMapReference"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/stringMap-reference", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestStringMapReference", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestStringMapReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestStringMapReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestStringMapReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestStringMapReference"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestStringMapReference"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/stringMap-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestStringMapReference", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs deleted file mode 100644 index b0e5066eef8f..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ /dev/null @@ -1,364 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeClassnameTags123ApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// To test class name in snake case - /// - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - ModelClient TestClassname(ModelClient modelClient, int operationIndex = 0); - - /// - /// To test class name in snake case - /// - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - ApiResponse TestClassnameWithHttpInfo(ModelClient modelClient, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeClassnameTags123ApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// To test class name in snake case - /// - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - System.Threading.Tasks.Task TestClassnameAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// To test class name in snake case - /// - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestClassnameWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeClassnameTags123Api : IFakeClassnameTags123ApiSync, IFakeClassnameTags123ApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeClassnameTags123Api() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeClassnameTags123Api(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public FakeClassnameTags123Api(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public FakeClassnameTags123Api(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// To test class name in snake case To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - public ModelClient TestClassname(ModelClient modelClient, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClassnameWithHttpInfo(modelClient); - return localVarResponse.Data; - } - - /// - /// To test class name in snake case To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - public Org.OpenAPITools.Client.ApiResponse TestClassnameWithHttpInfo(ModelClient modelClient, int operationIndex = 0) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "FakeClassnameTags123Api.TestClassname"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key_query) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - var localVarResponse = this.Client.Patch("/fake_classname_test", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test class name in snake case To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - public async System.Threading.Tasks.Task TestClassnameAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClassnameWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// To test class name in snake case To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestClassnameWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "FakeClassnameTags123Api.TestClassname"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key_query) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PatchAsync("/fake_classname_test", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/PetApi.cs deleted file mode 100644 index 848cd61975b4..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/PetApi.cs +++ /dev/null @@ -1,2346 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IPetApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// - void AddPet(Pet pet, int operationIndex = 0); - - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse AddPetWithHttpInfo(Pet pet, int operationIndex = 0); - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// - void DeletePet(long petId, string? apiKey = default(string?), int operationIndex = 0); - - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse DeletePetWithHttpInfo(long petId, string? apiKey = default(string?), int operationIndex = 0); - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// List<Pet> - List FindPetsByStatus(List status, int operationIndex = 0); - - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// ApiResponse of List<Pet> - ApiResponse> FindPetsByStatusWithHttpInfo(List status, int operationIndex = 0); - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// List<Pet> - [Obsolete] - List FindPetsByTags(List tags, int operationIndex = 0); - - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// ApiResponse of List<Pet> - [Obsolete] - ApiResponse> FindPetsByTagsWithHttpInfo(List tags, int operationIndex = 0); - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Pet - Pet GetPetById(long petId, int operationIndex = 0); - - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// ApiResponse of Pet - ApiResponse GetPetByIdWithHttpInfo(long petId, int operationIndex = 0); - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// - void UpdatePet(Pet pet, int operationIndex = 0); - - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse UpdatePetWithHttpInfo(Pet pet, int operationIndex = 0); - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// - void UpdatePetWithForm(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0); - - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0); - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// ApiResponse - ApiResponse UploadFile(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0); - - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// ApiResponse of ApiResponse - ApiResponse UploadFileWithHttpInfo(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0); - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// ApiResponse - ApiResponse UploadFileWithRequiredFile(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0); - - /// - /// uploads an image (required) - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// ApiResponse of ApiResponse - ApiResponse UploadFileWithRequiredFileWithHttpInfo(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IPetApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task DeletePetAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Pet> - System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Pet>) - System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Pet> - [Obsolete] - System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Pet>) - [Obsolete] - System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Pet - System.Threading.Tasks.Task GetPetByIdAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Pet) - System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task UpdatePetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task UploadFileAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ApiResponse) - System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// uploads an image (required) - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// uploads an image (required) - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ApiResponse) - System.Threading.Tasks.Task> UploadFileWithRequiredFileWithHttpInfoAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IPetApi : IPetApiSync, IPetApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class PetApi : IPetApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public PetApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public PetApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public PetApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public PetApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// - public void AddPet(Pet pet, int operationIndex = 0) - { - AddPetWithHttpInfo(pet); - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, int operationIndex = 0) - { - // verify the required parameter 'pet' is set - if (pet == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json", - "application/xml" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = pet; - - localVarRequestOptions.Operation = "PetApi.AddPet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "POST", "/pet", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/pet", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await AddPetWithHttpInfoAsync(pet, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'pet' is set - if (pet == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json", - "application/xml" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = pet; - - localVarRequestOptions.Operation = "PetApi.AddPet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "POST", "/pet", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// - public void DeletePet(long petId, string? apiKey = default(string?), int operationIndex = 0) - { - DeletePetWithHttpInfo(petId, apiKey); - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse DeletePetWithHttpInfo(long petId, string? apiKey = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (apiKey != null) - { - localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter - } - - localVarRequestOptions.Operation = "PetApi.DeletePet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = this.Client.Delete("/pet/{petId}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task DeletePetAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await DeletePetWithHttpInfoAsync(petId, apiKey, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (apiKey != null) - { - localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter - } - - localVarRequestOptions.Operation = "PetApi.DeletePet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.DeleteAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// List<Pet> - public List FindPetsByStatus(List status, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByStatusWithHttpInfo(status); - return localVarResponse.Data; - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// ApiResponse of List<Pet> - public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpInfo(List status, int operationIndex = 0) - { - // verify the required parameter 'status' is set - if (status == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); - - localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByStatus", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = this.Client.Get>("/pet/findByStatus", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Pet> - public async System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByStatusWithHttpInfoAsync(status, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Pet>) - public async System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'status' is set - if (status == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); - - localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByStatus", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByStatus", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// List<Pet> - [Obsolete] - public List FindPetsByTags(List tags, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByTagsWithHttpInfo(tags); - return localVarResponse.Data; - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// ApiResponse of List<Pet> - [Obsolete] - public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo(List tags, int operationIndex = 0) - { - // verify the required parameter 'tags' is set - if (tags == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); - - localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByTags", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = this.Client.Get>("/pet/findByTags", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Pet> - [Obsolete] - public async System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByTagsWithHttpInfoAsync(tags, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Pet>) - [Obsolete] - public async System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'tags' is set - if (tags == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); - - localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByTags", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByTags", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Pet - public Pet GetPetById(long petId, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetPetByIdWithHttpInfo(petId); - return localVarResponse.Data; - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// ApiResponse of Pet - public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petId, int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - - localVarRequestOptions.Operation = "PetApi.GetPetById"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); - } - // authentication (api_key_query) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - var localVarResponse = this.Client.Get("/pet/{petId}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Pet - public async System.Threading.Tasks.Task GetPetByIdAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetPetByIdWithHttpInfoAsync(petId, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Pet) - public async System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - - localVarRequestOptions.Operation = "PetApi.GetPetById"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); - } - // authentication (api_key_query) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// - public void UpdatePet(Pet pet, int operationIndex = 0) - { - UpdatePetWithHttpInfo(pet); - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet, int operationIndex = 0) - { - // verify the required parameter 'pet' is set - if (pet == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json", - "application/xml" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = pet; - - localVarRequestOptions.Operation = "PetApi.UpdatePet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "PUT", "/pet", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = this.Client.Put("/pet", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task UpdatePetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await UpdatePetWithHttpInfoAsync(pet, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'pet' is set - if (pet == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json", - "application/xml" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = pet; - - localVarRequestOptions.Operation = "PetApi.UpdatePet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "PUT", "/pet", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// - public void UpdatePetWithForm(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0) - { - UpdatePetWithFormWithHttpInfo(petId, name, status); - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (name != null) - { - localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter - } - if (status != null) - { - localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter - } - - localVarRequestOptions.Operation = "PetApi.UpdatePetWithForm"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/pet/{petId}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await UpdatePetWithFormWithHttpInfoAsync(petId, name, status, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (name != null) - { - localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter - } - if (status != null) - { - localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter - } - - localVarRequestOptions.Operation = "PetApi.UpdatePetWithForm"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// ApiResponse - public ApiResponse UploadFile(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithHttpInfo(petId, additionalMetadata, file); - return localVarResponse.Data; - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// ApiResponse of ApiResponse - public Org.OpenAPITools.Client.ApiResponse UploadFileWithHttpInfo(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "multipart/form-data" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) - { - localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter - } - if (file != null) - { - localVarRequestOptions.FileParameters.Add("file", file); - } - - localVarRequestOptions.Operation = "PetApi.UploadFile"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task UploadFileAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileWithHttpInfoAsync(petId, additionalMetadata, file, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ApiResponse) - public async System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "multipart/form-data" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) - { - localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter - } - if (file != null) - { - localVarRequestOptions.FileParameters.Add("file", file); - } - - localVarRequestOptions.Operation = "PetApi.UploadFile"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// ApiResponse - public ApiResponse UploadFileWithRequiredFile(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); - return localVarResponse.Data; - } - - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// ApiResponse of ApiResponse - public Org.OpenAPITools.Client.ApiResponse UploadFileWithRequiredFileWithHttpInfo(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0) - { - // verify the required parameter 'requiredFile' is set - if (requiredFile == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "multipart/form-data" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) - { - localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter - } - localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); - - localVarRequestOptions.Operation = "PetApi.UploadFileWithRequiredFile"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/{petId}/uploadImageWithRequiredFile", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileWithRequiredFileWithHttpInfoAsync(petId, requiredFile, additionalMetadata, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ApiResponse) - public async System.Threading.Tasks.Task> UploadFileWithRequiredFileWithHttpInfoAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'requiredFile' is set - if (requiredFile == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "multipart/form-data" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) - { - localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter - } - localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); - - localVarRequestOptions.Operation = "PetApi.UploadFileWithRequiredFile"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/{petId}/uploadImageWithRequiredFile", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/StoreApi.cs deleted file mode 100644 index e8882b0fc2e4..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/StoreApi.cs +++ /dev/null @@ -1,903 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IStoreApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// - void DeleteOrder(string orderId, int operationIndex = 0); - - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse DeleteOrderWithHttpInfo(string orderId, int operationIndex = 0); - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Dictionary<string, int> - Dictionary GetInventory(int operationIndex = 0); - - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of Dictionary<string, int> - ApiResponse> GetInventoryWithHttpInfo(int operationIndex = 0); - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Order - Order GetOrderById(long orderId, int operationIndex = 0); - - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// ApiResponse of Order - ApiResponse GetOrderByIdWithHttpInfo(long orderId, int operationIndex = 0); - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Order - Order PlaceOrder(Order order, int operationIndex = 0); - - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// ApiResponse of Order - ApiResponse PlaceOrderWithHttpInfo(Order order, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IStoreApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task DeleteOrderAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Dictionary<string, int> - System.Threading.Tasks.Task> GetInventoryAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Dictionary<string, int>) - System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Order - System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Order) - System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Order - System.Threading.Tasks.Task PlaceOrderAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Order) - System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IStoreApi : IStoreApiSync, IStoreApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class StoreApi : IStoreApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public StoreApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public StoreApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public StoreApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public StoreApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// - public void DeleteOrder(string orderId, int operationIndex = 0) - { - 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 - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(string orderId, int operationIndex = 0) - { - // verify the required parameter 'orderId' is set - if (orderId == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter - - localVarRequestOptions.Operation = "StoreApi.DeleteOrder"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Delete("/store/order/{order_id}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task DeleteOrderAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await DeleteOrderWithHttpInfoAsync(orderId, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'orderId' is set - if (orderId == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter - - localVarRequestOptions.Operation = "StoreApi.DeleteOrder"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.DeleteAsync("/store/order/{order_id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Dictionary<string, int> - public Dictionary GetInventory(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetInventoryWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of Dictionary<string, int> - public Org.OpenAPITools.Client.ApiResponse> GetInventoryWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "StoreApi.GetInventory"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); - } - - // make the HTTP request - var localVarResponse = this.Client.Get>("/store/inventory", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Dictionary<string, int> - public async System.Threading.Tasks.Task> GetInventoryAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetInventoryWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Dictionary<string, int>) - public async System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "StoreApi.GetInventory"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/store/inventory", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Order - public Order GetOrderById(long orderId, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetOrderByIdWithHttpInfo(orderId); - return localVarResponse.Data; - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// ApiResponse of Order - public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long orderId, int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter - - localVarRequestOptions.Operation = "StoreApi.GetOrderById"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/store/order/{order_id}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Order - public async System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetOrderByIdWithHttpInfoAsync(orderId, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Order) - public async System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter - - localVarRequestOptions.Operation = "StoreApi.GetOrderById"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/store/order/{order_id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Order - public Order PlaceOrder(Order order, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = PlaceOrderWithHttpInfo(order); - return localVarResponse.Data; - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// ApiResponse of Order - public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order order, int operationIndex = 0) - { - // verify the required parameter 'order' is set - if (order == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = order; - - localVarRequestOptions.Operation = "StoreApi.PlaceOrder"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/store/order", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Order - public async System.Threading.Tasks.Task PlaceOrderAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await PlaceOrderWithHttpInfoAsync(order, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Order) - public async System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'order' is set - if (order == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = order; - - localVarRequestOptions.Operation = "StoreApi.PlaceOrder"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/store/order", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/UserApi.cs deleted file mode 100644 index 174d0572e677..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Api/UserApi.cs +++ /dev/null @@ -1,1691 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IUserApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// - void CreateUser(User user, int operationIndex = 0); - - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse CreateUserWithHttpInfo(User user, int operationIndex = 0); - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// - void CreateUsersWithArrayInput(List user, int operationIndex = 0); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user, int operationIndex = 0); - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// - void CreateUsersWithListInput(List user, int operationIndex = 0); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse CreateUsersWithListInputWithHttpInfo(List user, int operationIndex = 0); - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// - void DeleteUser(string username, int operationIndex = 0); - - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse DeleteUserWithHttpInfo(string username, int operationIndex = 0); - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// User - User GetUserByName(string username, int operationIndex = 0); - - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// ApiResponse of User - ApiResponse GetUserByNameWithHttpInfo(string username, int operationIndex = 0); - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// string - string LoginUser(string username, string password, int operationIndex = 0); - - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// ApiResponse of string - ApiResponse LoginUserWithHttpInfo(string username, string password, int operationIndex = 0); - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// - void LogoutUser(int operationIndex = 0); - - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse LogoutUserWithHttpInfo(int operationIndex = 0); - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// - void UpdateUser(string username, User user, int operationIndex = 0); - - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse UpdateUserWithHttpInfo(string username, User user, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IUserApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task CreateUserAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task DeleteUserAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of User - System.Threading.Tasks.Task GetUserByNameAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (User) - System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of string - System.Threading.Tasks.Task LoginUserAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (string) - System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task LogoutUserAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task UpdateUserAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IUserApi : IUserApiSync, IUserApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class UserApi : IUserApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public UserApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public UserApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public UserApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public UserApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// - public void CreateUser(User user, int operationIndex = 0) - { - CreateUserWithHttpInfo(user); - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User user, int operationIndex = 0) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/user", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task CreateUserAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await CreateUserWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/user", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// - public void CreateUsersWithArrayInput(List user, int operationIndex = 0) - { - CreateUsersWithArrayInputWithHttpInfo(user); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user, int operationIndex = 0) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUsersWithArrayInput"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/user/createWithArray", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await CreateUsersWithArrayInputWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUsersWithArrayInput"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithArray", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// - public void CreateUsersWithListInput(List user, int operationIndex = 0) - { - CreateUsersWithListInputWithHttpInfo(user); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithHttpInfo(List user, int operationIndex = 0) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUsersWithListInput"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/user/createWithList", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await CreateUsersWithListInputWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUsersWithListInput"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithList", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// - public void DeleteUser(string username, int operationIndex = 0) - { - DeleteUserWithHttpInfo(username); - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string username, int operationIndex = 0) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - - localVarRequestOptions.Operation = "UserApi.DeleteUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Delete("/user/{username}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task DeleteUserAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await DeleteUserWithHttpInfoAsync(username, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - - localVarRequestOptions.Operation = "UserApi.DeleteUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.DeleteAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// User - public User GetUserByName(string username, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetUserByNameWithHttpInfo(username); - return localVarResponse.Data; - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// ApiResponse of User - public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(string username, int operationIndex = 0) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - - localVarRequestOptions.Operation = "UserApi.GetUserByName"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/user/{username}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of User - public async System.Threading.Tasks.Task GetUserByNameAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetUserByNameWithHttpInfoAsync(username, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (User) - public async System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - - localVarRequestOptions.Operation = "UserApi.GetUserByName"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// string - public string LoginUser(string username, string password, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = LoginUserWithHttpInfo(username, password); - return localVarResponse.Data; - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// ApiResponse of string - public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string username, string password, int operationIndex = 0) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); - } - - // verify the required parameter 'password' is set - if (password == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); - - localVarRequestOptions.Operation = "UserApi.LoginUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/user/login", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of string - public async System.Threading.Tasks.Task LoginUserAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await LoginUserWithHttpInfoAsync(username, password, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (string) - public async System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); - } - - // verify the required parameter 'password' is set - if (password == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); - - localVarRequestOptions.Operation = "UserApi.LoginUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/user/login", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// - public void LogoutUser(int operationIndex = 0) - { - LogoutUserWithHttpInfo(); - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "UserApi.LogoutUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/user/logout", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task LogoutUserAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await LogoutUserWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "UserApi.LogoutUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/user/logout", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// - public void UpdateUser(string username, User user, int operationIndex = 0) - { - UpdateUserWithHttpInfo(username, user); - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string username, User user, int operationIndex = 0) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); - } - - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.UpdateUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Put("/user/{username}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task UpdateUserAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await UpdateUserWithHttpInfoAsync(username, user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); - } - - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.UpdateUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs deleted file mode 100644 index 8431e531175d..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs +++ /dev/null @@ -1,830 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters; -using System.Text; -using System.Threading; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using RestSharp; -using RestSharp.Serializers; -using RestSharpMethod = RestSharp.Method; -using FileIO = System.IO.File; -using Polly; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Client -{ - /// - /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. - /// - internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer - { - private readonly IReadableConfiguration _configuration; - private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - public CustomJsonCodec(IReadableConfiguration configuration) - { - _configuration = configuration; - } - - public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) - { - _serializerSettings = serializerSettings; - _configuration = configuration; - } - - /// - /// Serialize the object into a JSON string. - /// - /// Object to be serialized. - /// A JSON string. - public string Serialize(object obj) - { - if (obj != null && obj is AbstractOpenAPISchema) - { - // the object to be serialized is an oneOf/anyOf schema - return ((AbstractOpenAPISchema)obj).ToJson(); - } - else - { - return JsonConvert.SerializeObject(obj, _serializerSettings); - } - } - - public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); - - public T Deserialize(RestResponse response) - { - var result = (T)Deserialize(response, typeof(T)); - return result; - } - - /// - /// Deserialize the JSON string into a proper object. - /// - /// The HTTP response. - /// Object type. - /// Object representation of the JSON string. - internal object Deserialize(RestResponse response, Type type) - { - if (type == typeof(byte[])) // return byte array - { - return response.RawBytes; - } - - // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) - if (type == typeof(Stream)) - { - var bytes = response.RawBytes; - if (response.Headers != null) - { - var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) - ? global::System.IO.Path.GetTempPath() - : _configuration.TempFolderPath; - var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); - foreach (var header in response.Headers) - { - var match = regex.Match(header.ToString()); - if (match.Success) - { - string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); - FileIO.WriteAllBytes(fileName, bytes); - return new FileStream(fileName, FileMode.Open); - } - } - } - var stream = new MemoryStream(bytes); - return stream; - } - - if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object - { - return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); - } - - if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type - { - return Convert.ChangeType(response.Content, type); - } - - // at this point, it must be a model (json) - try - { - return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); - } - catch (Exception e) - { - throw new ApiException(500, e.Message); - } - } - - public ISerializer Serializer => this; - public IDeserializer Deserializer => this; - - public string[] AcceptedContentTypes => ContentType.JsonAccept; - - public SupportsContentType SupportsContentType => contentType => - contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || - contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); - - public ContentType ContentType { get; set; } = ContentType.Json; - - public DataFormat DataFormat => DataFormat.Json; - } - /// - /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), - /// encapsulating general REST accessor use cases. - /// - public partial class ApiClient : ISynchronousClient, IAsynchronousClient - { - private readonly string _baseUrl; - - /// - /// Specifies the settings on a object. - /// These settings can be adjusted to accommodate custom serialization rules. - /// - public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - /// - /// Allows for extending request processing for generated code. - /// - /// The RestSharp request object - partial void InterceptRequest(RestRequest request); - - /// - /// Allows for extending response processing for generated code. - /// - /// The RestSharp request object - /// The RestSharp response object - partial void InterceptResponse(RestRequest request, RestResponse response); - - /// - /// Initializes a new instance of the , defaulting to the global configurations' base url. - /// - public ApiClient() - { - _baseUrl = GlobalConfiguration.Instance.BasePath; - } - - /// - /// Initializes a new instance of the - /// - /// The target service's base path in URL format. - /// - public ApiClient(string basePath) - { - if (string.IsNullOrEmpty(basePath)) - throw new ArgumentException("basePath cannot be empty"); - - _baseUrl = basePath; - } - - /// - /// Constructs the RestSharp version of an http method - /// - /// Swagger Client Custom HttpMethod - /// RestSharp's HttpMethod instance. - /// - private RestSharpMethod Method(HttpMethod method) - { - RestSharpMethod other; - switch (method) - { - case HttpMethod.Get: - other = RestSharpMethod.Get; - break; - case HttpMethod.Post: - other = RestSharpMethod.Post; - break; - case HttpMethod.Put: - other = RestSharpMethod.Put; - break; - case HttpMethod.Delete: - other = RestSharpMethod.Delete; - break; - case HttpMethod.Head: - other = RestSharpMethod.Head; - break; - case HttpMethod.Options: - other = RestSharpMethod.Options; - break; - case HttpMethod.Patch: - other = RestSharpMethod.Patch; - break; - default: - throw new ArgumentOutOfRangeException("method", method, null); - } - - return other; - } - - /// - /// Provides all logic for constructing a new RestSharp . - /// At this point, all information for querying the service is known. - /// Here, it is simply mapped into the RestSharp request. - /// - /// The http verb. - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// [private] A new RestRequest instance. - /// - private RestRequest NewRequest( - HttpMethod method, - string path, - RequestOptions options, - IReadableConfiguration configuration) - { - if (path == null) throw new ArgumentNullException("path"); - if (options == null) throw new ArgumentNullException("options"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - RestRequest request = new RestRequest(path, Method(method)); - - if (options.PathParameters != null) - { - foreach (var pathParam in options.PathParameters) - { - request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); - } - } - - if (options.QueryParameters != null) - { - foreach (var queryParam in options.QueryParameters) - { - foreach (var value in queryParam.Value) - { - request.AddQueryParameter(queryParam.Key, value); - } - } - } - - if (configuration.DefaultHeaders != null) - { - foreach (var headerParam in configuration.DefaultHeaders) - { - request.AddHeader(headerParam.Key, headerParam.Value); - } - } - - if (options.HeaderParameters != null) - { - foreach (var headerParam in options.HeaderParameters) - { - foreach (var value in headerParam.Value) - { - request.AddHeader(headerParam.Key, value); - } - } - } - - if (options.FormParameters != null) - { - foreach (var formParam in options.FormParameters) - { - request.AddParameter(formParam.Key, formParam.Value); - } - } - - if (options.Data != null) - { - if (options.Data is Stream stream) - { - var contentType = "application/octet-stream"; - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - contentType = contentTypes[0]; - } - - var bytes = ClientUtils.ReadAsBytes(stream); - request.AddParameter(contentType, bytes, ParameterType.RequestBody); - } - else - { - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) - { - request.RequestFormat = DataFormat.Json; - } - else - { - // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. - } - } - else - { - // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. - request.RequestFormat = DataFormat.Json; - } - - request.AddJsonBody(options.Data); - } - } - - if (options.FileParameters != null) - { - foreach (var fileParam in options.FileParameters) - { - foreach (var file in fileParam.Value) - { - var bytes = ClientUtils.ReadAsBytes(file); - var fileStream = file as FileStream; - if (fileStream != null) - request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); - else - request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); - } - } - } - - return request; - } - - /// - /// Transforms a RestResponse instance into a new ApiResponse instance. - /// At this point, we have a concrete http response from the service. - /// Here, it is simply mapped into the [public] ApiResponse object. - /// - /// The RestSharp response object - /// A new ApiResponse instance. - private ApiResponse ToApiResponse(RestResponse response) - { - T result = response.Data; - string rawContent = response.Content; - - var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) - { - ErrorText = response.ErrorMessage, - Cookies = new List() - }; - - if (response.Headers != null) - { - foreach (var responseHeader in response.Headers) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.ContentHeaders != null) - { - foreach (var responseHeader in response.ContentHeaders) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.Cookies != null) - { - foreach (var responseCookies in response.Cookies.Cast()) - { - transformed.Cookies.Add( - new Cookie( - responseCookies.Name, - responseCookies.Value, - responseCookies.Path, - responseCookies.Domain) - ); - } - } - - return transformed; - } - - /// - /// Executes the HTTP request for the current service. - /// Based on functions received it can be async or sync. - /// - /// Local function that executes http request and returns http response. - /// Local function to specify options for the service. - /// The RestSharp request object - /// The RestSharp options object - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// A new ApiResponse instance. - private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; - var clientOptions = new RestClientOptions(baseUrl) - { - ClientCertificates = configuration.ClientCertificates, - Timeout = configuration.Timeout, - Proxy = configuration.Proxy, - UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials, - RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback - }; - setOptions(clientOptions); - - if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(configuration.OAuthClientId) && - !string.IsNullOrEmpty(configuration.OAuthClientSecret) && - configuration.OAuthFlow != null) - { - clientOptions.Authenticator = new OAuthAuthenticator( - configuration.OAuthTokenUrl, - configuration.OAuthClientId, - configuration.OAuthClientSecret, - configuration.OAuthScope, - configuration.OAuthFlow, - SerializerSettings, - configuration); - } - - using (RestClient client = new RestClient(clientOptions, - configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) - { - InterceptRequest(request); - - RestResponse response = await getResponse(client); - - // if the response type is oneOf/anyOf, call FromJSON to deserialize the data - if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) - { - try - { - response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); - } - catch (Exception ex) - { - throw ex.InnerException != null ? ex.InnerException : ex; - } - } - else if (typeof(T).Name == "Stream") // for binary response - { - response.Data = (T)(object)new MemoryStream(response.RawBytes); - } - else if (typeof(T).Name == "Byte[]") // for byte response - { - response.Data = (T)(object)response.RawBytes; - } - else if (typeof(T).Name == "String") // for string response - { - response.Data = (T)(object)response.Content; - } - - InterceptResponse(request, response); - - var result = ToApiResponse(response); - if (response.ErrorMessage != null) - { - result.ErrorText = response.ErrorMessage; - } - - if (response.Cookies != null && response.Cookies.Count > 0) - { - if (result.Cookies == null) result.Cookies = new List(); - foreach (var restResponseCookie in response.Cookies.Cast()) - { - var cookie = new Cookie( - restResponseCookie.Name, - restResponseCookie.Value, - restResponseCookie.Path, - restResponseCookie.Domain - ) - { - Comment = restResponseCookie.Comment, - CommentUri = restResponseCookie.CommentUri, - Discard = restResponseCookie.Discard, - Expired = restResponseCookie.Expired, - Expires = restResponseCookie.Expires, - HttpOnly = restResponseCookie.HttpOnly, - Port = restResponseCookie.Port, - Secure = restResponseCookie.Secure, - Version = restResponseCookie.Version - }; - - result.Cookies.Add(cookie); - } - } - return result; - } - } - - private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) - { - if (policyResult.Outcome == OutcomeType.Successful) - { - return await client.Deserialize(policyResult.Result, cancellationToken); - } - else - { - return new RestResponse(request) - { - ErrorException = policyResult.FinalException - }; - } - } - - private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - Action setOptions = (clientOptions) => - { - var cookies = new CookieContainer(); - - if (options.Cookies != null && options.Cookies.Count > 0) - { - foreach (var cookie in options.Cookies) - { - cookies.Add(new Cookie(cookie.Name, cookie.Value)); - } - } - clientOptions.CookieContainer = cookies; - }; - - Func>> getResponse = (client) => - { - if (RetryConfiguration.RetryPolicy != null) - { - var policy = RetryConfiguration.RetryPolicy; - var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); - return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); - } - else - { - return Task.FromResult(client.Execute(request)); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); - } - - private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) - { - Action setOptions = (clientOptions) => - { - //no extra options - }; - - Func>> getResponse = async (client) => - { - if (RetryConfiguration.AsyncRetryPolicy != null) - { - var policy = RetryConfiguration.AsyncRetryPolicy; - var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); - return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); - } - else - { - return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration); - } - - #region IAsynchronousClient - /// - /// Make a HTTP GET request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP POST request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PUT request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP DELETE request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP HEAD request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP OPTION request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PATCH request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); - } - #endregion IAsynchronousClient - - #region ISynchronousClient - /// - /// Make a HTTP GET request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); - } - - /// - /// Make a HTTP POST request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); - } - - /// - /// Make a HTTP PUT request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); - } - - /// - /// Make a HTTP DELETE request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); - } - - /// - /// Make a HTTP HEAD request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); - } - - /// - /// Make a HTTP OPTION request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); - } - - /// - /// Make a HTTP PATCH request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); - } - #endregion ISynchronousClient - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs deleted file mode 100644 index fcf584d1fd25..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ /dev/null @@ -1,806 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.InteropServices; -using System.Security; -using System.Security.Cryptography; -using System.Text; -using System.Web; - -namespace Org.OpenAPITools.Client -{ - /// - /// Class for HttpSigning auth related parameter and methods - /// - public class HttpSigningConfiguration - { - /// - /// Initialize the HashAlgorithm and SigningAlgorithm to default value - /// - public HttpSigningConfiguration() - { - HashAlgorithm = HashAlgorithmName.SHA256; - SigningAlgorithm = "PKCS1-v15"; - } - - /// - ///Gets the Api keyId - /// - public string KeyId { get; set; } - - /// - /// Gets the Key file path - /// - public string KeyFilePath { get; set; } - - /// - /// Specify the API key in the form of a string, either configure the KeyString property or configure the KeyFilePath property. - /// - public string KeyString { get; set; } - - /// - /// Gets the key pass phrase for password protected key - /// - public SecureString KeyPassPhrase { get; set; } - - /// - /// Gets the HTTP signing header - /// - public List HttpSigningHeader { get; set; } - - /// - /// Gets the hash algorithm sha256 or sha512 - /// - public HashAlgorithmName HashAlgorithm { get; set; } - - /// - /// Gets the signing algorithm - /// - public string SigningAlgorithm { get; set; } - - /// - /// Gets the Signature validity period in seconds - /// - public int SignatureValidityPeriod { get; set; } - - private enum PrivateKeyType - { - None = 0, - RSA = 1, - ECDSA = 2, - } - - /// - /// Gets the Headers for HttpSigning - /// - /// Base path - /// HTTP method - /// Path - /// Request options - /// Http signed headers - public Dictionary GetHttpSignedHeader(string basePath,string method, string path, RequestOptions requestOptions) - { - const string HEADER_REQUEST_TARGET = "(request-target)"; - //The time when the HTTP signature expires. The API server should reject HTTP requests - //that have expired. - const string HEADER_EXPIRES = "(expires)"; - //The 'Date' header. - const string HEADER_DATE = "Date"; - //The 'Host' header. - const string HEADER_HOST = "Host"; - //The time when the HTTP signature was generated. - const string HEADER_CREATED = "(created)"; - //When the 'Digest' header is included in the HTTP signature, the client automatically - //computes the digest of the HTTP request body, per RFC 3230. - const string HEADER_DIGEST = "Digest"; - //The 'Authorization' header is automatically generated by the client. It includes - //the list of signed headers and a base64-encoded signature. - const string HEADER_AUTHORIZATION = "Authorization"; - - //Read the api key from the file - if(File.Exists(KeyFilePath)) - { - this.KeyString = ReadApiKeyFromFile(KeyFilePath); - } - else if(string.IsNullOrEmpty(KeyString)) - { - throw new Exception("No API key has been provided. Supply it using either KeyFilePath or KeyString"); - } - - //Hash table to store singed headers - var HttpSignedRequestHeader = new Dictionary(); - var HttpSignatureHeader = new Dictionary(); - - if (HttpSigningHeader.Count == 0) - { - HttpSigningHeader.Add("(created)"); - } - - if (requestOptions.PathParameters != null) - { - foreach (var pathParam in requestOptions.PathParameters) - { - var tempPath = path.Replace(pathParam.Key, "0"); - path = string.Format(tempPath, pathParam.Value); - } - } - - var httpValues = HttpUtility.ParseQueryString(string.Empty); - foreach (var parameter in requestOptions.QueryParameters) - { -#if (NETCOREAPP) - if (parameter.Value.Count > 1) - { // array - foreach (var value in parameter.Value) - { - httpValues.Add(HttpUtility.UrlEncode(parameter.Key) + "[]", value); - } - } - else - { - httpValues.Add(HttpUtility.UrlEncode(parameter.Key), parameter.Value[0]); - } -#else - if (parameter.Value.Count > 1) - { // array - foreach (var value in parameter.Value) - { - httpValues.Add(parameter.Key + "[]", value); - } - } - else - { - httpValues.Add(parameter.Key, parameter.Value[0]); - } -#endif - } - var uriBuilder = new UriBuilder(string.Concat(basePath, path)); - uriBuilder.Query = httpValues.ToString().Replace("+", "%20"); - - var dateTime = DateTime.Now; - string Digest = string.Empty; - - //get the body - string requestBody = string.Empty; - if (requestOptions.Data != null) - { - var serializerSettings = new JsonSerializerSettings(); - requestBody = JsonConvert.SerializeObject(requestOptions.Data, serializerSettings); - } - - if (HashAlgorithm == HashAlgorithmName.SHA256) - { - var bodyDigest = GetStringHash(HashAlgorithm, requestBody); - Digest = string.Format("SHA-256={0}", Convert.ToBase64String(bodyDigest)); - } - else if (HashAlgorithm == HashAlgorithmName.SHA512) - { - var bodyDigest = GetStringHash(HashAlgorithm, requestBody); - Digest = string.Format("SHA-512={0}", Convert.ToBase64String(bodyDigest)); - } - else - { - throw new Exception(string.Format("{0} not supported", HashAlgorithm)); - } - - foreach (var header in HttpSigningHeader) - { - if (header.Equals(HEADER_REQUEST_TARGET)) - { - var targetUrl = string.Format("{0} {1}{2}", method.ToLower(), uriBuilder.Path, uriBuilder.Query); - HttpSignatureHeader.Add(header.ToLower(), targetUrl); - } - else if (header.Equals(HEADER_EXPIRES)) - { - var expireDateTime = dateTime.AddSeconds(SignatureValidityPeriod); - HttpSignatureHeader.Add(header.ToLower(), GetUnixTime(expireDateTime).ToString()); - } - else if (header.Equals(HEADER_DATE)) - { - var utcDateTime = dateTime.ToUniversalTime().ToString("r"); - HttpSignatureHeader.Add(header.ToLower(), utcDateTime); - HttpSignedRequestHeader.Add(HEADER_DATE, utcDateTime); - } - else if (header.Equals(HEADER_HOST)) - { - HttpSignatureHeader.Add(header.ToLower(), uriBuilder.Host); - HttpSignedRequestHeader.Add(HEADER_HOST, uriBuilder.Host); - } - else if (header.Equals(HEADER_CREATED)) - { - HttpSignatureHeader.Add(header.ToLower(), GetUnixTime(dateTime).ToString()); - } - else if (header.Equals(HEADER_DIGEST)) - { - HttpSignedRequestHeader.Add(HEADER_DIGEST, Digest); - HttpSignatureHeader.Add(header.ToLower(), Digest); - } - else - { - bool isHeaderFound = false; - foreach (var item in requestOptions.HeaderParameters) - { - if (string.Equals(item.Key, header, StringComparison.OrdinalIgnoreCase)) - { - HttpSignatureHeader.Add(header.ToLower(), item.Value.ToString()); - isHeaderFound = true; - break; - } - } - if (!isHeaderFound) - { - throw new Exception(string.Format("Cannot sign HTTP request.Request does not contain the {0} header.",header)); - } - } - - } - var headersKeysString = string.Join(" ", HttpSignatureHeader.Keys); - var headerValuesList = new List(); - - foreach (var keyVal in HttpSignatureHeader) - { - headerValuesList.Add(string.Format("{0}: {1}", keyVal.Key, keyVal.Value)); - } - //Concatenate headers value separated by new line - var headerValuesString = string.Join("\n", headerValuesList); - var signatureStringHash = GetStringHash(HashAlgorithm, headerValuesString); - string headerSignatureStr = null; - var keyType = GetKeyType(KeyString); - - if (keyType == PrivateKeyType.RSA) - { - headerSignatureStr = GetRSASignature(signatureStringHash); - } - else if (keyType == PrivateKeyType.ECDSA) - { - headerSignatureStr = GetECDSASignature(signatureStringHash); - } - else - { - throw new Exception(string.Format("Private key type {0} not supported", keyType)); - } - const string cryptographicScheme = "hs2019"; - var authorizationHeaderValue = string.Format("Signature keyId=\"{0}\",algorithm=\"{1}\"", - KeyId, cryptographicScheme); - - if (HttpSignatureHeader.ContainsKey(HEADER_CREATED)) - { - authorizationHeaderValue += string.Format(",created={0}", HttpSignatureHeader[HEADER_CREATED]); - } - - if (HttpSignatureHeader.ContainsKey(HEADER_EXPIRES)) - { - authorizationHeaderValue += string.Format(",expires={0}", HttpSignatureHeader[HEADER_EXPIRES]); - } - - authorizationHeaderValue += string.Format(",headers=\"{0}\",signature=\"{1}\"", - headersKeysString, headerSignatureStr); - HttpSignedRequestHeader.Add(HEADER_AUTHORIZATION, authorizationHeaderValue); - return HttpSignedRequestHeader; - } - - private byte[] GetStringHash(HashAlgorithmName hashAlgorithmName, string stringToBeHashed) - { - HashAlgorithm? hashAlgorithm = null; - - if (hashAlgorithmName == HashAlgorithmName.SHA1) - hashAlgorithm = SHA1.Create(); - - if (hashAlgorithmName == HashAlgorithmName.SHA256) - hashAlgorithm = SHA256.Create(); - - if (hashAlgorithmName == HashAlgorithmName.SHA512) - hashAlgorithm = SHA512.Create(); - - if (hashAlgorithmName == HashAlgorithmName.MD5) - hashAlgorithm = MD5.Create(); - - if (hashAlgorithm == null) - throw new NullReferenceException($"{ nameof(hashAlgorithm) } was null."); - - byte[] bytes = Encoding.UTF8.GetBytes(stringToBeHashed); - byte[] stringHash = hashAlgorithm.ComputeHash(bytes); - return stringHash; - } - - private int GetUnixTime(DateTime date2) - { - DateTime date1 = new DateTime(1970, 01, 01); - TimeSpan timeSpan = date2 - date1; - return (int)timeSpan.TotalSeconds; - } - - private string GetRSASignature(byte[] stringToSign) - { - if (string.IsNullOrEmpty(KeyString)) - { - throw new Exception("No API key has been provided."); - } - RSA rsa = GetRSAProviderFromPemFile(KeyString, KeyPassPhrase); - if (SigningAlgorithm == "RSASSA-PSS") - { - var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pss); - return Convert.ToBase64String(signedbytes); - } - else if (SigningAlgorithm == "PKCS1-v15") - { - var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pkcs1); - return Convert.ToBase64String(signedbytes); - } - else - { - return string.Empty; - } - } - - /// - /// Gets the ECDSA signature - /// - /// - /// ECDSA signature - private string GetECDSASignature(byte[] dataToSign) - { - if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) - { - throw new Exception("No API key has been provided."); - } - - var keyStr = KeyString; - const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; - const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; - var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); - var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); - var ecdsa = ECDsa.Create(); - - var byteCount = 0; - if (KeyPassPhrase != null) - { - IntPtr unmanagedString = IntPtr.Zero; - try - { - // convert secure string to byte array - unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); - ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); - } - finally - { - if (unmanagedString != IntPtr.Zero) - { - Marshal.ZeroFreeBSTR(unmanagedString); - } - } - } - else - ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); - - var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); - var signedString = System.Convert.ToBase64String(derBytes); - - return signedString; - } - - /// - /// Convert ANS1 format to DER format. Not recommended to use because it generate inavlid signature occationally. - /// - /// - /// - private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) - { - var derBytes = new List(); - byte derLength = 68; //default length for ECDSA code signing bit 0x44 - byte rbytesLength = 32; //R length 0x20 - byte sbytesLength = 32; //S length 0x20 - var rBytes = new List(); - var sBytes = new List(); - for (int i = 0; i < 32; i++) - { - rBytes.Add(signedBytes[i]); - } - for (int i = 32; i < 64; i++) - { - sBytes.Add(signedBytes[i]); - } - - if (rBytes[0] > 0x7F) - { - derLength++; - rbytesLength++; - var tempBytes = new List(); - tempBytes.AddRange(rBytes); - rBytes.Clear(); - rBytes.Add(0x00); - rBytes.AddRange(tempBytes); - } - - if (sBytes[0] > 0x7F) - { - derLength++; - sbytesLength++; - var tempBytes = new List(); - tempBytes.AddRange(sBytes); - sBytes.Clear(); - sBytes.Add(0x00); - sBytes.AddRange(tempBytes); - - } - - derBytes.Add(48); //start of the sequence 0x30 - derBytes.Add(derLength); //total length r length, type and r bytes - - derBytes.Add(2); //tag for integer - derBytes.Add(rbytesLength); //length of r - derBytes.AddRange(rBytes); - - derBytes.Add(2); //tag for integer - derBytes.Add(sbytesLength); //length of s - derBytes.AddRange(sBytes); - return derBytes.ToArray(); - } - - private RSACryptoServiceProvider GetRSAProviderFromPemFile(string keyString, SecureString keyPassPhrase = null) - { - if (string.IsNullOrEmpty(KeyString)) - { - throw new Exception("No API key has been provided."); - } - - const string pempubheader = "-----BEGIN PUBLIC KEY-----"; - const string pempubfooter = "-----END PUBLIC KEY-----"; - bool isPrivateKeyFile = true; - byte[] pemkey = null; - string pemstr = keyString; - - if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) - { - isPrivateKeyFile = false; - } - - if (isPrivateKeyFile) - { - pemkey = ConvertPrivateKeyToBytes(pemstr, keyPassPhrase); - if (pemkey == null) - { - return null; - } - return DecodeRSAPrivateKey(pemkey); - } - return null; - } - - private byte[] ConvertPrivateKeyToBytes(string instr, SecureString keyPassPhrase = null) - { - const string pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; - const string pemprivfooter = "-----END RSA PRIVATE KEY-----"; - string pemstr = instr.Trim(); - byte[] binkey; - - if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) - { - return null; - } - - StringBuilder sb = new StringBuilder(pemstr); - sb.Replace(pemprivheader, ""); - sb.Replace(pemprivfooter, ""); - string pvkstr = sb.ToString().Trim(); - - try - { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key - binkey = Convert.FromBase64String(pvkstr); - return binkey; - } - catch (global::System.FormatException) - { - StringReader str = new StringReader(pvkstr); - - //-------- read PEM encryption info. lines and extract salt ----- - if (!str.ReadLine().StartsWith("Proc-Type: 4,ENCRYPTED")) - { - return null; - } - string saltline = str.ReadLine(); - if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) - { - return null; - } - string saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); - byte[] salt = new byte[saltstr.Length / 2]; - for (int i = 0; i < salt.Length; i++) - salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); - if (str.ReadLine() != "") - { - return null; - } - - //------ remaining b64 data is encrypted RSA key ---- - string encryptedstr = str.ReadToEnd(); - - try - { //should have b64 encrypted RSA key now - binkey = Convert.FromBase64String(encryptedstr); - } - catch (global::System.FormatException) - { //data is not in base64 format - return null; - } - - byte[] deskey = GetEncryptedKey(salt, keyPassPhrase, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes - if (deskey == null) - { - return null; - } - - //------ Decrypt the encrypted 3des-encrypted RSA private key ------ - byte[] rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV - return rsakey; - } - } - - private RSACryptoServiceProvider DecodeRSAPrivateKey(byte[] privkey) - { - byte[] bytesModulus, bytesE, bytesD, bytesP, bytesQ, bytesDP, bytesDQ, bytesIQ; - - // --------- Set up stream to decode the asn.1 encoded RSA private key ------ - MemoryStream mem = new MemoryStream(privkey); - BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading - byte bt = 0; - ushort twobytes = 0; - int elems = 0; - try - { - twobytes = binr.ReadUInt16(); - if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) - { - binr.ReadByte(); //advance 1 byte - } - else if (twobytes == 0x8230) - { - binr.ReadInt16(); //advance 2 bytes - } - else - { - return null; - } - - twobytes = binr.ReadUInt16(); - if (twobytes != 0x0102) //version number - { - return null; - } - bt = binr.ReadByte(); - if (bt != 0x00) - { - return null; - } - - //------ all private key components are Integer sequences ---- - elems = GetIntegerSize(binr); - bytesModulus = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesE = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesD = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesP = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesQ = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesDP = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesDQ = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesIQ = binr.ReadBytes(elems); - - // ------- create RSACryptoServiceProvider instance and initialize with public key ----- - RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); - RSAParameters RSAparams = new RSAParameters(); - RSAparams.Modulus = bytesModulus; - RSAparams.Exponent = bytesE; - RSAparams.D = bytesD; - RSAparams.P = bytesP; - RSAparams.Q = bytesQ; - RSAparams.DP = bytesDP; - RSAparams.DQ = bytesDQ; - RSAparams.InverseQ = bytesIQ; - RSA.ImportParameters(RSAparams); - return RSA; - } - catch (Exception) - { - return null; - } - finally - { - binr.Close(); - } - } - - private int GetIntegerSize(BinaryReader binr) - { - byte bt = 0; - byte lowbyte = 0x00; - byte highbyte = 0x00; - int count = 0; - bt = binr.ReadByte(); - if (bt != 0x02) //expect integer - { - return 0; - } - bt = binr.ReadByte(); - - if (bt == 0x81) - { - count = binr.ReadByte(); // data size in next byte - } - else if (bt == 0x82) - { - highbyte = binr.ReadByte(); // data size in next 2 bytes - lowbyte = binr.ReadByte(); - byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; - count = BitConverter.ToInt32(modint, 0); - } - else - { - count = bt; // we already have the data size - } - while (binr.ReadByte() == 0x00) - { - //remove high order zeros in data - count -= 1; - } - binr.BaseStream.Seek(-1, SeekOrigin.Current); - //last ReadByte wasn't a removed zero, so back up a byte - return count; - } - - private byte[] GetEncryptedKey(byte[] salt, SecureString secpswd, int count, int miter) - { - IntPtr unmanagedPswd = IntPtr.Zero; - const int HASHLENGTH = 16; //MD5 bytes - byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store concatenated Mi hashed results - - byte[] psbytes = new byte[secpswd.Length]; - unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); - Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); - Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); - - // --- concatenate salt and pswd bytes into fixed data array --- - byte[] data00 = new byte[psbytes.Length + salt.Length]; - Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes - Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes - - // ---- do multi-hashing and concatenate results D1, D2 ... into keymaterial bytes ---- - MD5 md5 = MD5.Create(); - byte[] result = null; - byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget - - for (int j = 0; j < miter; j++) - { - // ---- Now hash consecutively for count times ------ - if (j == 0) - { - result = data00; //initialize - } - else - { - Array.Copy(result, hashtarget, result.Length); - Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); - result = hashtarget; - } - - for (int i = 0; i < count; i++) - { - result = md5.ComputeHash(result); - } - Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //concatenate to keymaterial - } - byte[] deskey = new byte[24]; - Array.Copy(keymaterial, deskey, deskey.Length); - - Array.Clear(psbytes, 0, psbytes.Length); - Array.Clear(data00, 0, data00.Length); - Array.Clear(result, 0, result.Length); - Array.Clear(hashtarget, 0, hashtarget.Length); - Array.Clear(keymaterial, 0, keymaterial.Length); - return deskey; - } - - private byte[] DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) - { - MemoryStream memst = new MemoryStream(); - TripleDES alg = TripleDES.Create(); - alg.Key = desKey; - alg.IV = IV; - try - { - CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); - cs.Write(cipherData, 0, cipherData.Length); - cs.Close(); - } - catch (Exception) - { - return null; - } - byte[] decryptedData = memst.ToArray(); - return decryptedData; - } - - /// - /// Detect the key type from the pem file. - /// - /// api key in string format - /// Private Key Type - private PrivateKeyType GetKeyType(string keyString) - { - string[] key = null; - - if (string.IsNullOrEmpty(keyString)) - { - throw new Exception("No API key has been provided."); - } - - const string ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY"; - const string ecPrivateKeyFooter = "END EC PRIVATE KEY"; - const string rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY"; - const string rsaPrivateFooter = "END RSA PRIVATE KEY"; - //var pkcs8Header = "BEGIN PRIVATE KEY"; - //var pkcs8Footer = "END PRIVATE KEY"; - PrivateKeyType keyType; - key = KeyString.TrimEnd().Split('\n'); - - if (key[0].Contains(rsaPrivateKeyHeader) && - key[key.Length - 1].ToString().Contains(rsaPrivateFooter)) - { - keyType = PrivateKeyType.RSA; - } - else if (key[0].Contains(ecPrivateKeyHeader) && - key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) - { - keyType = PrivateKeyType.ECDSA; - } - else - { - throw new Exception("The key file path does not exist or key is invalid or key is not supported"); - } - return keyType; - } - - /// - /// Read the api key form the api key file path and stored it in KeyString property. - /// - /// api key file path - private string ReadApiKeyFromFile(string apiKeyFilePath) - { - string apiKeyString = null; - - if(File.Exists(apiKeyFilePath)) - { - apiKeyString = File.ReadAllText(apiKeyFilePath); - } - else - { - throw new Exception("Provided API key file path does not exists."); - } - return apiKeyString; - } - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/CatAllOf.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/CatAllOf.cs deleted file mode 100644 index 8fcdcaf5342d..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/CatAllOf.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// CatAllOf - /// - [DataContract(Name = "Cat_allOf")] - public partial class CatAllOf : IEquatable, IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// declawed. - public CatAllOf(bool declawed = default(bool)) - { - this.Declawed = declawed; - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets Declawed - /// - [DataMember(Name = "declawed", EmitDefaultValue = true)] - public bool Declawed { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class CatAllOf {\n"); - sb.Append(" Declawed: ").Append(Declawed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as CatAllOf).AreEqual; - } - - /// - /// Returns true if CatAllOf instances are equal - /// - /// Instance of CatAllOf to be compared - /// Boolean - public bool Equals(CatAllOf input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - hashCode = (hashCode * 59) + this.Declawed.GetHashCode(); - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ChildCatAllOf.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ChildCatAllOf.cs deleted file mode 100644 index 89aa703afd3f..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ChildCatAllOf.cs +++ /dev/null @@ -1,155 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// ChildCatAllOf - /// - [DataContract(Name = "ChildCat_allOf")] - public partial class ChildCatAllOf : IEquatable, IValidatableObject - { - /// - /// Defines PetType - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum PetTypeEnum - { - /// - /// Enum ChildCat for value: ChildCat - /// - [EnumMember(Value = "ChildCat")] - ChildCat = 1 - } - - - /// - /// Gets or Sets PetType - /// - [DataMember(Name = "pet_type", EmitDefaultValue = false)] - public PetTypeEnum? PetType { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// name. - /// petType (default to PetTypeEnum.ChildCat). - public ChildCatAllOf(string name = default(string), PetTypeEnum? petType = PetTypeEnum.ChildCat) - { - this.Name = name; - this.PetType = petType; - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets Name - /// - [DataMember(Name = "name", EmitDefaultValue = false)] - public string Name { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class ChildCatAllOf {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PetType: ").Append(PetType).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as ChildCatAllOf).AreEqual; - } - - /// - /// Returns true if ChildCatAllOf instances are equal - /// - /// Instance of ChildCatAllOf to be compared - /// Boolean - public bool Equals(ChildCatAllOf input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.Name != null) - { - hashCode = (hashCode * 59) + this.Name.GetHashCode(); - } - hashCode = (hashCode * 59) + this.PetType.GetHashCode(); - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/DogAllOf.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/DogAllOf.cs deleted file mode 100644 index e82743a71511..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/DogAllOf.cs +++ /dev/null @@ -1,132 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// DogAllOf - /// - [DataContract(Name = "Dog_allOf")] - public partial class DogAllOf : IEquatable, IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// breed. - public DogAllOf(string breed = default(string)) - { - this.Breed = breed; - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets Breed - /// - [DataMember(Name = "breed", EmitDefaultValue = false)] - public string Breed { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class DogAllOf {\n"); - sb.Append(" Breed: ").Append(Breed).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as DogAllOf).AreEqual; - } - - /// - /// Returns true if DogAllOf instances are equal - /// - /// Instance of DogAllOf to be compared - /// Boolean - public bool Equals(DogAllOf input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.Breed != null) - { - hashCode = (hashCode * 59) + this.Breed.GetHashCode(); - } - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedEnumType.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedEnumType.cs deleted file mode 100644 index 95b561a9f076..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedEnumType.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// Defines MixedEnumType - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum MixedEnumType - { - /// - /// Enum SOMETHING for value: SOMETHING - /// - [EnumMember(Value = "SOMETHING")] - SOMETHING = 1, - - /// - /// Enum OTHER for value: OTHER - /// - [EnumMember(Value = "OTHER")] - OTHER = 2 - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedNullableEnumType.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedNullableEnumType.cs deleted file mode 100644 index 166feb8ea602..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedNullableEnumType.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// Defines MixedNullableEnumType - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum MixedNullableEnumType - { - /// - /// Enum SOMETHINGNULL for value: SOMETHING_NULL - /// - [EnumMember(Value = "SOMETHING_NULL")] - SOMETHINGNULL = 1, - - /// - /// Enum SOMETHINGNEWED for value: SOMETHING_NEWED - /// - [EnumMember(Value = "SOMETHING_NEWED")] - SOMETHINGNEWED = 2, - - /// - /// Enum Null for value: null - /// - [EnumMember(Value = "null")] - Null = 3 - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/PetStatusFilter.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/PetStatusFilter.cs deleted file mode 100644 index ff5525b83ca0..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/PetStatusFilter.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// Defines PetStatusFilter - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum PetStatusFilter - { - /// - /// Enum Available for value: available - /// - [EnumMember(Value = "available")] - Available = 1, - - /// - /// Enum Pending for value: pending - /// - [EnumMember(Value = "pending")] - Pending = 2, - - /// - /// Enum Sold for value: sold - /// - [EnumMember(Value = "sold")] - Sold = 3 - - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/UpdatePet200Response.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/UpdatePet200Response.cs deleted file mode 100644 index 1d79b6a37773..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/UpdatePet200Response.cs +++ /dev/null @@ -1,132 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// UpdatePet200Response - /// - [DataContract(Name = "updatePet_200_response")] - public partial class UpdatePet200Response : IEquatable, IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// varString. - public UpdatePet200Response(Pet varString = default(Pet)) - { - this.VarString = varString; - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets VarString - /// - [DataMember(Name = "string", EmitDefaultValue = false)] - public Pet VarString { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class UpdatePet200Response {\n"); - sb.Append(" VarString: ").Append(VarString).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as UpdatePet200Response).AreEqual; - } - - /// - /// Returns true if UpdatePet200Response instances are equal - /// - /// Instance of UpdatePet200Response to be compared - /// Boolean - public bool Equals(UpdatePet200Response input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.VarString != null) - { - hashCode = (hashCode * 59) + this.VarString.GetHashCode(); - } - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj deleted file mode 100644 index dff6798bca8b..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - false - net7.0 - Org.OpenAPITools - Org.OpenAPITools - Library - OpenAPI - OpenAPI - OpenAPI Library - A library generated from a OpenAPI doc - No Copyright - Org.OpenAPITools - 1.0.0 - bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml - https://github.com/GIT_USER_ID/GIT_REPO_ID.git - git - Minor update - annotations - false - - - - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/.openapi-generator-ignore b/samples/client/petstore/csharp/restsharp/net7/Petstore/.openapi-generator-ignore deleted file mode 100644 index 9e4fc9202342..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/.openapi-generator-ignore +++ /dev/null @@ -1,4 +0,0 @@ -# OpenAPI Generator Ignore -# This project file holds config used in "live" testing -src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj - diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/.openapi-generator/FILES b/samples/client/petstore/csharp/restsharp/net7/Petstore/.openapi-generator/FILES deleted file mode 100644 index 1149d7663f8f..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/.openapi-generator/FILES +++ /dev/null @@ -1,234 +0,0 @@ -.gitignore -Org.OpenAPITools.sln -README.md -api/openapi.yaml -appveyor.yml -docs/Activity.md -docs/ActivityOutputElementRepresentation.md -docs/AdditionalPropertiesClass.md -docs/Animal.md -docs/AnotherFakeApi.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/Category.md -docs/ChildCat.md -docs/ClassModel.md -docs/ComplexQuadrilateral.md -docs/DanishPig.md -docs/DateOnlyClass.md -docs/DefaultApi.md -docs/DeprecatedObject.md -docs/Dog.md -docs/Drawing.md -docs/EnumArrays.md -docs/EnumClass.md -docs/EnumTest.md -docs/EquilateralTriangle.md -docs/FakeApi.md -docs/FakeClassnameTags123Api.md -docs/File.md -docs/FileSchemaTestClass.md -docs/Foo.md -docs/FooGetDefaultResponse.md -docs/FormatTest.md -docs/Fruit.md -docs/FruitReq.md -docs/GmFruit.md -docs/GrandparentAnimal.md -docs/HasOnlyReadOnly.md -docs/HealthCheckResult.md -docs/IsoscelesTriangle.md -docs/List.md -docs/LiteralStringClass.md -docs/Mammal.md -docs/MapTest.md -docs/MixLog.md -docs/MixedAnyOf.md -docs/MixedAnyOfContent.md -docs/MixedOneOf.md -docs/MixedOneOfContent.md -docs/MixedPropertiesAndAdditionalPropertiesClass.md -docs/MixedSubId.md -docs/Model200Response.md -docs/ModelClient.md -docs/Name.md -docs/NotificationtestGetElementsV1ResponseMPayload.md -docs/NullableClass.md -docs/NullableGuidClass.md -docs/NullableShape.md -docs/NumberOnly.md -docs/ObjectWithDeprecatedFields.md -docs/OneOfString.md -docs/Order.md -docs/OuterComposite.md -docs/OuterEnum.md -docs/OuterEnumDefaultValue.md -docs/OuterEnumInteger.md -docs/OuterEnumIntegerDefaultValue.md -docs/OuterEnumTest.md -docs/ParentPet.md -docs/Pet.md -docs/PetApi.md -docs/Pig.md -docs/PolymorphicProperty.md -docs/Quadrilateral.md -docs/QuadrilateralInterface.md -docs/ReadOnlyFirst.md -docs/RequiredClass.md -docs/Return.md -docs/RolesReportsHash.md -docs/RolesReportsHashRole.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/TestCollectionEndingWithWordList.md -docs/TestCollectionEndingWithWordListObject.md -docs/TestInlineFreeformAdditionalPropertiesRequest.md -docs/Triangle.md -docs/TriangleInterface.md -docs/User.md -docs/UserApi.md -docs/Whale.md -docs/Zebra.md -docs/ZeroBasedEnum.md -docs/ZeroBasedEnumClass.md -git_push.sh -src/Org.OpenAPITools/Api/AnotherFakeApi.cs -src/Org.OpenAPITools/Api/DefaultApi.cs -src/Org.OpenAPITools/Api/FakeApi.cs -src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs -src/Org.OpenAPITools/Api/PetApi.cs -src/Org.OpenAPITools/Api/StoreApi.cs -src/Org.OpenAPITools/Api/UserApi.cs -src/Org.OpenAPITools/Client/ApiClient.cs -src/Org.OpenAPITools/Client/ApiException.cs -src/Org.OpenAPITools/Client/ApiResponse.cs -src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs -src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs -src/Org.OpenAPITools/Client/Auth/TokenResponse.cs -src/Org.OpenAPITools/Client/ClientUtils.cs -src/Org.OpenAPITools/Client/Configuration.cs -src/Org.OpenAPITools/Client/ExceptionFactory.cs -src/Org.OpenAPITools/Client/GlobalConfiguration.cs -src/Org.OpenAPITools/Client/HttpMethod.cs -src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs -src/Org.OpenAPITools/Client/IApiAccessor.cs -src/Org.OpenAPITools/Client/IAsynchronousClient.cs -src/Org.OpenAPITools/Client/IReadableConfiguration.cs -src/Org.OpenAPITools/Client/ISynchronousClient.cs -src/Org.OpenAPITools/Client/Multimap.cs -src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs -src/Org.OpenAPITools/Client/RequestOptions.cs -src/Org.OpenAPITools/Client/RetryConfiguration.cs -src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs -src/Org.OpenAPITools/Model/Activity.cs -src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs -src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs -src/Org.OpenAPITools/Model/Animal.cs -src/Org.OpenAPITools/Model/ApiResponse.cs -src/Org.OpenAPITools/Model/Apple.cs -src/Org.OpenAPITools/Model/AppleReq.cs -src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs -src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs -src/Org.OpenAPITools/Model/ArrayTest.cs -src/Org.OpenAPITools/Model/Banana.cs -src/Org.OpenAPITools/Model/BananaReq.cs -src/Org.OpenAPITools/Model/BasquePig.cs -src/Org.OpenAPITools/Model/Capitalization.cs -src/Org.OpenAPITools/Model/Cat.cs -src/Org.OpenAPITools/Model/Category.cs -src/Org.OpenAPITools/Model/ChildCat.cs -src/Org.OpenAPITools/Model/ClassModel.cs -src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs -src/Org.OpenAPITools/Model/DanishPig.cs -src/Org.OpenAPITools/Model/DateOnlyClass.cs -src/Org.OpenAPITools/Model/DeprecatedObject.cs -src/Org.OpenAPITools/Model/Dog.cs -src/Org.OpenAPITools/Model/Drawing.cs -src/Org.OpenAPITools/Model/EnumArrays.cs -src/Org.OpenAPITools/Model/EnumClass.cs -src/Org.OpenAPITools/Model/EnumTest.cs -src/Org.OpenAPITools/Model/EquilateralTriangle.cs -src/Org.OpenAPITools/Model/File.cs -src/Org.OpenAPITools/Model/FileSchemaTestClass.cs -src/Org.OpenAPITools/Model/Foo.cs -src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs -src/Org.OpenAPITools/Model/FormatTest.cs -src/Org.OpenAPITools/Model/Fruit.cs -src/Org.OpenAPITools/Model/FruitReq.cs -src/Org.OpenAPITools/Model/GmFruit.cs -src/Org.OpenAPITools/Model/GrandparentAnimal.cs -src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs -src/Org.OpenAPITools/Model/HealthCheckResult.cs -src/Org.OpenAPITools/Model/IsoscelesTriangle.cs -src/Org.OpenAPITools/Model/List.cs -src/Org.OpenAPITools/Model/LiteralStringClass.cs -src/Org.OpenAPITools/Model/Mammal.cs -src/Org.OpenAPITools/Model/MapTest.cs -src/Org.OpenAPITools/Model/MixLog.cs -src/Org.OpenAPITools/Model/MixedAnyOf.cs -src/Org.OpenAPITools/Model/MixedAnyOfContent.cs -src/Org.OpenAPITools/Model/MixedOneOf.cs -src/Org.OpenAPITools/Model/MixedOneOfContent.cs -src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs -src/Org.OpenAPITools/Model/MixedSubId.cs -src/Org.OpenAPITools/Model/Model200Response.cs -src/Org.OpenAPITools/Model/ModelClient.cs -src/Org.OpenAPITools/Model/Name.cs -src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs -src/Org.OpenAPITools/Model/NullableClass.cs -src/Org.OpenAPITools/Model/NullableGuidClass.cs -src/Org.OpenAPITools/Model/NullableShape.cs -src/Org.OpenAPITools/Model/NumberOnly.cs -src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs -src/Org.OpenAPITools/Model/OneOfString.cs -src/Org.OpenAPITools/Model/Order.cs -src/Org.OpenAPITools/Model/OuterComposite.cs -src/Org.OpenAPITools/Model/OuterEnum.cs -src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs -src/Org.OpenAPITools/Model/OuterEnumInteger.cs -src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs -src/Org.OpenAPITools/Model/OuterEnumTest.cs -src/Org.OpenAPITools/Model/ParentPet.cs -src/Org.OpenAPITools/Model/Pet.cs -src/Org.OpenAPITools/Model/Pig.cs -src/Org.OpenAPITools/Model/PolymorphicProperty.cs -src/Org.OpenAPITools/Model/Quadrilateral.cs -src/Org.OpenAPITools/Model/QuadrilateralInterface.cs -src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs -src/Org.OpenAPITools/Model/Return.cs -src/Org.OpenAPITools/Model/RolesReportsHash.cs -src/Org.OpenAPITools/Model/RolesReportsHashRole.cs -src/Org.OpenAPITools/Model/ScaleneTriangle.cs -src/Org.OpenAPITools/Model/Shape.cs -src/Org.OpenAPITools/Model/ShapeInterface.cs -src/Org.OpenAPITools/Model/ShapeOrNull.cs -src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs -src/Org.OpenAPITools/Model/SpecialModelName.cs -src/Org.OpenAPITools/Model/Tag.cs -src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs -src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs -src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs -src/Org.OpenAPITools/Model/Triangle.cs -src/Org.OpenAPITools/Model/TriangleInterface.cs -src/Org.OpenAPITools/Model/User.cs -src/Org.OpenAPITools/Model/Whale.cs -src/Org.OpenAPITools/Model/Zebra.cs -src/Org.OpenAPITools/Model/ZeroBasedEnum.cs -src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs -src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/.travis.yml b/samples/client/petstore/csharp/restsharp/net7/Petstore/.travis.yml deleted file mode 100644 index e4965fc7e5c8..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -# -# Generated by: https://github.com/openapitools/openapi-generator.git -# -language: csharp -mono: - - latest -solution: Org.OpenAPITools.sln -script: - - /bin/sh ./mono_nunit_test.sh diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/build.bat b/samples/client/petstore/csharp/restsharp/net7/Petstore/build.bat deleted file mode 100644 index a5c1f4c57644..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/build.bat +++ /dev/null @@ -1,6 +0,0 @@ -:: Generated by: https://github.com/openapitools/openapi-generator.git -:: - -@echo off - -dotnet build diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/build.sh b/samples/client/petstore/csharp/restsharp/net7/Petstore/build.sh deleted file mode 100644 index 2d32c2c18f87..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/build.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash -# -# Generated by: https://github.com/openapitools/openapi-generator.git -# - -for cmd in {dotnet}; do - if ! command -v ${cmd} > /dev/null; then - >&2 echo "This script requires '${cmd}' to be installed." - exit 1 - fi -done - -dotnet build - -if [ $? -ne 0 ] -then - echo "[ERROR] Compilation failed with exit code $?" - exit 1 -else - echo "[INFO] dotnet build was successful." -fi diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/CatAllOf.md b/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/CatAllOf.md deleted file mode 100644 index 6cbaaa14e814..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/CatAllOf.md +++ /dev/null @@ -1,10 +0,0 @@ -# Org.OpenAPITools.Model.CatAllOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Declawed** | **bool** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ChildCatAllOf.md b/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ChildCatAllOf.md deleted file mode 100644 index 864d33e80e7a..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ChildCatAllOf.md +++ /dev/null @@ -1,11 +0,0 @@ -# Org.OpenAPITools.Model.ChildCatAllOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Name** | **string** | | [optional] -**PetType** | **string** | | [optional] [default to PetTypeEnum.ChildCat] - -[[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/csharp/restsharp/net7/Petstore/docs/DogAllOf.md b/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DogAllOf.md deleted file mode 100644 index c1096f2c3105..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DogAllOf.md +++ /dev/null @@ -1,10 +0,0 @@ -# Org.OpenAPITools.Model.DogAllOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Breed** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedEnumType.md b/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedEnumType.md deleted file mode 100644 index 24385b3ae84f..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedEnumType.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.MixedEnumType - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/csharp/restsharp/net7/Petstore/docs/MixedNullableEnumType.md b/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedNullableEnumType.md deleted file mode 100644 index a38369d002d1..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedNullableEnumType.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.MixedNullableEnumType - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[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/csharp/restsharp/net7/Petstore/docs/UpdatePet200Response.md b/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/UpdatePet200Response.md deleted file mode 100644 index d1625d266647..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/UpdatePet200Response.md +++ /dev/null @@ -1,10 +0,0 @@ -# Org.OpenAPITools.Model.UpdatePet200Response - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**VarString** | [**Pet**](Pet.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/mono_nunit_test.sh b/samples/client/petstore/csharp/restsharp/net7/Petstore/mono_nunit_test.sh deleted file mode 100644 index 039eba8ed42a..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/mono_nunit_test.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# -# Generated by: https://github.com/openapitools/openapi-generator.git -# - -wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -mozroots --import --sync - -echo "[INFO] remove bin/Debug/Org.OpenAPITools.Test.dll" -rm src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll 2> /dev/null - -echo "[INFO] install NUnit runners via NuGet" -wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -mozroots --import --sync -mono nuget.exe install src/Org.OpenAPITools.Test/packages.config -o packages - -echo "[INFO] Install NUnit runners via NuGet" -mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages - -echo "[INFO] Build the solution and run the unit test" -xbuild Org.OpenAPITools.sln && \ - mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/CatAllOfTests.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/CatAllOfTests.cs deleted file mode 100644 index fb51c28489cb..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/CatAllOfTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing CatAllOf - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class CatAllOfTests : IDisposable - { - // TODO uncomment below to declare an instance variable for CatAllOf - //private CatAllOf instance; - - public CatAllOfTests() - { - // TODO uncomment below to create an instance of CatAllOf - //instance = new CatAllOf(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of CatAllOf - /// - [Fact] - public void CatAllOfInstanceTest() - { - // TODO uncomment below to test "IsType" CatAllOf - //Assert.IsType(instance); - } - - - /// - /// Test the property 'Declawed' - /// - [Fact] - public void DeclawedTest() - { - // TODO unit test for the property 'Declawed' - } - - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatAllOfTests.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatAllOfTests.cs deleted file mode 100644 index 49a539324904..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatAllOfTests.cs +++ /dev/null @@ -1,78 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing ChildCatAllOf - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class ChildCatAllOfTests : IDisposable - { - // TODO uncomment below to declare an instance variable for ChildCatAllOf - //private ChildCatAllOf instance; - - public ChildCatAllOfTests() - { - // TODO uncomment below to create an instance of ChildCatAllOf - //instance = new ChildCatAllOf(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of ChildCatAllOf - /// - [Fact] - public void ChildCatAllOfInstanceTest() - { - // TODO uncomment below to test "IsType" ChildCatAllOf - //Assert.IsType(instance); - } - - - /// - /// Test the property 'Name' - /// - [Fact] - public void NameTest() - { - // TODO unit test for the property 'Name' - } - /// - /// Test the property 'PetType' - /// - [Fact] - public void PetTypeTest() - { - // TODO unit test for the property 'PetType' - } - - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DogAllOfTests.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DogAllOfTests.cs deleted file mode 100644 index b22a44420963..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DogAllOfTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing DogAllOf - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class DogAllOfTests : IDisposable - { - // TODO uncomment below to declare an instance variable for DogAllOf - //private DogAllOf instance; - - public DogAllOfTests() - { - // TODO uncomment below to create an instance of DogAllOf - //instance = new DogAllOf(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of DogAllOf - /// - [Fact] - public void DogAllOfInstanceTest() - { - // TODO uncomment below to test "IsType" DogAllOf - //Assert.IsType(instance); - } - - - /// - /// Test the property 'Breed' - /// - [Fact] - public void BreedTest() - { - // TODO unit test for the property 'Breed' - } - - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedEnumTypeTests.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedEnumTypeTests.cs deleted file mode 100644 index 5fb0741f597b..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedEnumTypeTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing MixedEnumType - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class MixedEnumTypeTests : IDisposable - { - // TODO uncomment below to declare an instance variable for MixedEnumType - //private MixedEnumType instance; - - public MixedEnumTypeTests() - { - // TODO uncomment below to create an instance of MixedEnumType - //instance = new MixedEnumType(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of MixedEnumType - /// - [Fact] - public void MixedEnumTypeInstanceTest() - { - // TODO uncomment below to test "IsType" MixedEnumType - //Assert.IsType(instance); - } - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedNullableEnumTypeTests.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedNullableEnumTypeTests.cs deleted file mode 100644 index c13101dc08f5..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedNullableEnumTypeTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing MixedNullableEnumType - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class MixedNullableEnumTypeTests : IDisposable - { - // TODO uncomment below to declare an instance variable for MixedNullableEnumType - //private MixedNullableEnumType instance; - - public MixedNullableEnumTypeTests() - { - // TODO uncomment below to create an instance of MixedNullableEnumType - //instance = new MixedNullableEnumType(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of MixedNullableEnumType - /// - [Fact] - public void MixedNullableEnumTypeInstanceTest() - { - // TODO uncomment below to test "IsType" MixedNullableEnumType - //Assert.IsType(instance); - } - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/UpdatePet200ResponseTests.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/UpdatePet200ResponseTests.cs deleted file mode 100644 index 8cb066737bc4..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/UpdatePet200ResponseTests.cs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing UpdatePet200Response - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class UpdatePet200ResponseTests : IDisposable - { - // TODO uncomment below to declare an instance variable for UpdatePet200Response - //private UpdatePet200Response instance; - - public UpdatePet200ResponseTests() - { - // TODO uncomment below to create an instance of UpdatePet200Response - //instance = new UpdatePet200Response(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of UpdatePet200Response - /// - [Fact] - public void UpdatePet200ResponseInstanceTest() - { - // TODO uncomment below to test "IsType" UpdatePet200Response - //Assert.IsType(instance); - } - - /// - /// Test the property 'VarString' - /// - [Fact] - public void VarStringTest() - { - // TODO unit test for the property 'VarString' - } - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj deleted file mode 100644 index ae23db5fac25..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - net7.0 - - false - - - - - Org.OpenAPITools - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/linux-logo.png b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/linux-logo.png deleted file mode 100644 index 8269538b1aca..000000000000 Binary files a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/linux-logo.png and /dev/null differ diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs deleted file mode 100644 index 9ccd159a44f9..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ /dev/null @@ -1,354 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IAnotherFakeApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// To test special tags - /// - /// - /// To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - ModelClient Call123TestSpecialTags(ModelClient modelClient, int operationIndex = 0); - - /// - /// To test special tags - /// - /// - /// To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - ApiResponse Call123TestSpecialTagsWithHttpInfo(ModelClient modelClient, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IAnotherFakeApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// To test special tags - /// - /// - /// To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - System.Threading.Tasks.Task Call123TestSpecialTagsAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// To test special tags - /// - /// - /// To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IAnotherFakeApi : IAnotherFakeApiSync, IAnotherFakeApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class AnotherFakeApi : IAnotherFakeApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public AnotherFakeApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public AnotherFakeApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public AnotherFakeApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public AnotherFakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// To test special tags To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - public ModelClient Call123TestSpecialTags(ModelClient modelClient, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); - return localVarResponse.Data; - } - - /// - /// To test special tags To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - public Org.OpenAPITools.Client.ApiResponse Call123TestSpecialTagsWithHttpInfo(ModelClient modelClient, int operationIndex = 0) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "AnotherFakeApi.Call123TestSpecialTags"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Patch("/another-fake/dummy", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test special tags To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - public async System.Threading.Tasks.Task Call123TestSpecialTagsAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await Call123TestSpecialTagsWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// To test special tags To test special tags and operation ID starting with number - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "AnotherFakeApi.Call123TestSpecialTags"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PatchAsync("/another-fake/dummy", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs deleted file mode 100644 index 54f3d2e41a93..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ /dev/null @@ -1,1018 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IDefaultApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// FooGetDefaultResponse - FooGetDefaultResponse FooGet(int operationIndex = 0); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of FooGetDefaultResponse - ApiResponse FooGetWithHttpInfo(int operationIndex = 0); - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// - void GetCountry(string country, int operationIndex = 0); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse GetCountryWithHttpInfo(string country, int operationIndex = 0); - /// - /// Hello - /// - /// - /// Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<Guid> - List Hello(int operationIndex = 0); - - /// - /// Hello - /// - /// - /// Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<Guid> - ApiResponse> HelloWithHttpInfo(int operationIndex = 0); - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<List<RolesReportsHash>> - List> RolesReportGet(int operationIndex = 0); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<List<RolesReportsHash>> - ApiResponse>> RolesReportGetWithHttpInfo(int operationIndex = 0); - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// NotificationtestGetElementsV1ResponseMPayload - NotificationtestGetElementsV1ResponseMPayload Test(int operationIndex = 0); - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of NotificationtestGetElementsV1ResponseMPayload - ApiResponse TestWithHttpInfo(int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IDefaultApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of FooGetDefaultResponse - System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (FooGetDefaultResponse) - System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task GetCountryAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> GetCountryWithHttpInfoAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Hello - /// - /// - /// Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Guid> - System.Threading.Tasks.Task> HelloAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Hello - /// - /// - /// Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Guid>) - System.Threading.Tasks.Task>> HelloWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<List<RolesReportsHash>> - System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<List<RolesReportsHash>>) - System.Threading.Tasks.Task>>> RolesReportGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of NotificationtestGetElementsV1ResponseMPayload - System.Threading.Tasks.Task TestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (NotificationtestGetElementsV1ResponseMPayload) - System.Threading.Tasks.Task> TestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IDefaultApi : IDefaultApiSync, IDefaultApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class DefaultApi : IDefaultApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public DefaultApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public DefaultApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public DefaultApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public DefaultApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// FooGetDefaultResponse - public FooGetDefaultResponse FooGet(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of FooGetDefaultResponse - public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.FooGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of FooGetDefaultResponse - public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (FooGetDefaultResponse) - public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.FooGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// - public void GetCountry(string country, int operationIndex = 0) - { - GetCountryWithHttpInfo(country); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse GetCountryWithHttpInfo(string country, int operationIndex = 0) - { - // verify the required parameter 'country' is set - if (country == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'country' when calling DefaultApi->GetCountry"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.FormParameters.Add("country", Org.OpenAPITools.Client.ClientUtils.ParameterToString(country)); // form parameter - - localVarRequestOptions.Operation = "DefaultApi.GetCountry"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/country", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetCountry", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task GetCountryAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await GetCountryWithHttpInfoAsync(country, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> GetCountryWithHttpInfoAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'country' is set - if (country == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'country' when calling DefaultApi->GetCountry"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.FormParameters.Add("country", Org.OpenAPITools.Client.ClientUtils.ParameterToString(country)); // form parameter - - localVarRequestOptions.Operation = "DefaultApi.GetCountry"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/country", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetCountry", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Hello Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<Guid> - public List Hello(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = HelloWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Hello Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<Guid> - public Org.OpenAPITools.Client.ApiResponse> HelloWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.Hello"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get>("/hello", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Hello", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Hello Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Guid> - public async System.Threading.Tasks.Task> HelloAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await HelloWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Hello Hello - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Guid>) - public async System.Threading.Tasks.Task>> HelloWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.Hello"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/hello", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Hello", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<List<RolesReportsHash>> - public List> RolesReportGet(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse>> localVarResponse = RolesReportGetWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<List<RolesReportsHash>> - public Org.OpenAPITools.Client.ApiResponse>> RolesReportGetWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.RolesReportGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get>>("/roles/report", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("RolesReportGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<List<RolesReportsHash>> - public async System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse>> localVarResponse = await RolesReportGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<List<RolesReportsHash>>) - public async System.Threading.Tasks.Task>>> RolesReportGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.RolesReportGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>>("/roles/report", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("RolesReportGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// NotificationtestGetElementsV1ResponseMPayload - public NotificationtestGetElementsV1ResponseMPayload Test(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = TestWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of NotificationtestGetElementsV1ResponseMPayload - public Org.OpenAPITools.Client.ApiResponse TestWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.Test"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/test", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Test", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of NotificationtestGetElementsV1ResponseMPayload - public async System.Threading.Tasks.Task TestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Retrieve an existing Notificationtest's Elements - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (NotificationtestGetElementsV1ResponseMPayload) - public async System.Threading.Tasks.Task> TestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.Test"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/test", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("Test", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs deleted file mode 100644 index 8fc96497aa05..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs +++ /dev/null @@ -1,4424 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// HealthCheckResult - HealthCheckResult FakeHealthGet(int operationIndex = 0); - - /// - /// Health check endpoint - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of HealthCheckResult - ApiResponse FakeHealthGetWithHttpInfo(int operationIndex = 0); - /// - /// - /// - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// bool - bool FakeOuterBooleanSerialize(bool? body = default(bool?), int operationIndex = 0); - - /// - /// - /// - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// ApiResponse of bool - ApiResponse FakeOuterBooleanSerializeWithHttpInfo(bool? body = default(bool?), int operationIndex = 0); - /// - /// - /// - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// OuterComposite - OuterComposite FakeOuterCompositeSerialize(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0); - - /// - /// - /// - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// ApiResponse of OuterComposite - ApiResponse FakeOuterCompositeSerializeWithHttpInfo(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0); - /// - /// - /// - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// decimal - decimal FakeOuterNumberSerialize(decimal? body = default(decimal?), int operationIndex = 0); - - /// - /// - /// - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// ApiResponse of decimal - ApiResponse FakeOuterNumberSerializeWithHttpInfo(decimal? body = default(decimal?), int operationIndex = 0); - /// - /// - /// - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// string - string FakeOuterStringSerialize(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0); - - /// - /// - /// - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// ApiResponse of string - ApiResponse FakeOuterStringSerializeWithHttpInfo(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0); - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<OuterEnum> - List GetArrayOfEnums(int operationIndex = 0); - - /// - /// Array of Enums - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<OuterEnum> - ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// MixedAnyOf - MixedAnyOf GetMixedAnyOf(int operationIndex = 0); - - /// - /// Test mixed type anyOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of MixedAnyOf - ApiResponse GetMixedAnyOfWithHttpInfo(int operationIndex = 0); - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// MixedOneOf - MixedOneOf GetMixedOneOf(int operationIndex = 0); - - /// - /// Test mixed type oneOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of MixedOneOf - ApiResponse GetMixedOneOfWithHttpInfo(int operationIndex = 0); - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); - - /// - /// test referenced additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); - /// - /// - /// - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// - void TestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0); - - /// - /// - /// - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0); - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// - void TestBodyWithQueryParams(string query, User user, int operationIndex = 0); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestBodyWithQueryParamsWithHttpInfo(string query, User user, int operationIndex = 0); - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - ModelClient TestClientModel(ModelClient modelClient, int operationIndex = 0); - - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - ApiResponse TestClientModelWithHttpInfo(ModelClient modelClient, int operationIndex = 0); - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// - void TestEndpointParameters(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0); - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestEndpointParametersWithHttpInfo(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0); - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// - void TestEnumParameters(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0); - - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestEnumParametersWithHttpInfo(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0); - /// - /// Fake endpoint to test group parameters (optional) - /// - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// - void TestGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0); - - /// - /// Fake endpoint to test group parameters (optional) - /// - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0); - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - void TestInlineAdditionalProperties(Dictionary requestBody, int operationIndex = 0); - - /// - /// test inline additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestInlineAdditionalPropertiesWithHttpInfo(Dictionary requestBody, int operationIndex = 0); - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0); - - /// - /// test inline free-form additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0); - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// - void TestJsonFormData(string param, string param2, int operationIndex = 0); - - /// - /// test json serialization of form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestJsonFormDataWithHttpInfo(string param, string param2, int operationIndex = 0); - /// - /// - /// - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// - void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); - - /// - /// - /// - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - void TestStringMapReference(Dictionary requestBody, int operationIndex = 0); - - /// - /// test referenced string map - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse TestStringMapReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// Health check endpoint - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of HealthCheckResult - System.Threading.Tasks.Task FakeHealthGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Health check endpoint - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (HealthCheckResult) - System.Threading.Tasks.Task> FakeHealthGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of bool - System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (bool) - System.Threading.Tasks.Task> FakeOuterBooleanSerializeWithHttpInfoAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of OuterComposite - System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (OuterComposite) - System.Threading.Tasks.Task> FakeOuterCompositeSerializeWithHttpInfoAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of decimal - System.Threading.Tasks.Task FakeOuterNumberSerializeAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (decimal) - System.Threading.Tasks.Task> FakeOuterNumberSerializeWithHttpInfoAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of string - System.Threading.Tasks.Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (string) - System.Threading.Tasks.Task> FakeOuterStringSerializeWithHttpInfoAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Array of Enums - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<OuterEnum> - System.Threading.Tasks.Task> GetArrayOfEnumsAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Array of Enums - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<OuterEnum>) - System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Test mixed type anyOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of MixedAnyOf - System.Threading.Tasks.Task GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Test mixed type anyOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (MixedAnyOf) - System.Threading.Tasks.Task> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Test mixed type oneOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of MixedOneOf - System.Threading.Tasks.Task GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Test mixed type oneOf deserialization - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (MixedOneOf) - System.Threading.Tasks.Task> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test referenced additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test referenced additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestBodyWithFileSchemaWithHttpInfoAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestBodyWithQueryParamsAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestBodyWithQueryParamsWithHttpInfoAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - System.Threading.Tasks.Task TestClientModelAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// To test \"client\" model - /// - /// - /// To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestClientModelWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestEndpointParametersAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestEndpointParametersWithHttpInfoAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestEnumParametersAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// To test enum parameters - /// - /// - /// To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestEnumParametersWithHttpInfoAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Fake endpoint to test group parameters (optional) - /// - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestGroupParametersAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Fake endpoint to test group parameters (optional) - /// - /// - /// Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestGroupParametersWithHttpInfoAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test inline additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test inline additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestInlineAdditionalPropertiesWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test inline free-form additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test inline free-form additionalProperties - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test json serialization of form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestJsonFormDataAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test json serialization of form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestJsonFormDataWithHttpInfoAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// - /// - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// test referenced string map - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task TestStringMapReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// test referenced string map - /// - /// - /// - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> TestStringMapReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeApi : IFakeApiSync, IFakeApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class FakeApi : IFakeApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public FakeApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public FakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// HealthCheckResult - public HealthCheckResult FakeHealthGet(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeHealthGetWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of HealthCheckResult - public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.FakeHealthGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake/health", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeHealthGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of HealthCheckResult - public async System.Threading.Tasks.Task FakeHealthGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeHealthGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Health check endpoint - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (HealthCheckResult) - public async System.Threading.Tasks.Task> FakeHealthGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.FakeHealthGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/health", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeHealthGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// bool - public bool FakeOuterBooleanSerialize(bool? body = default(bool?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// ApiResponse of bool - public Org.OpenAPITools.Client.ApiResponse FakeOuterBooleanSerializeWithHttpInfo(bool? body = default(bool?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterBooleanSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/outer/boolean", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of bool - public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterBooleanSerializeWithHttpInfoAsync(body, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer boolean types - /// - /// Thrown when fails to make API call - /// Input boolean as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (bool) - public async System.Threading.Tasks.Task> FakeOuterBooleanSerializeWithHttpInfoAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterBooleanSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/boolean", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// OuterComposite - public OuterComposite FakeOuterCompositeSerialize(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterCompositeSerializeWithHttpInfo(outerComposite); - return localVarResponse.Data; - } - - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// ApiResponse of OuterComposite - public Org.OpenAPITools.Client.ApiResponse FakeOuterCompositeSerializeWithHttpInfo(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = outerComposite; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterCompositeSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/outer/composite", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of OuterComposite - public async System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterCompositeSerializeWithHttpInfoAsync(outerComposite, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test serialization of object with outer number type - /// - /// Thrown when fails to make API call - /// Input composite as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (OuterComposite) - public async System.Threading.Tasks.Task> FakeOuterCompositeSerializeWithHttpInfoAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = outerComposite; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterCompositeSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/composite", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// decimal - public decimal FakeOuterNumberSerialize(decimal? body = default(decimal?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// ApiResponse of decimal - public Org.OpenAPITools.Client.ApiResponse FakeOuterNumberSerializeWithHttpInfo(decimal? body = default(decimal?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterNumberSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/outer/number", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of decimal - public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterNumberSerializeWithHttpInfoAsync(body, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer number types - /// - /// Thrown when fails to make API call - /// Input number as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (decimal) - public async System.Threading.Tasks.Task> FakeOuterNumberSerializeWithHttpInfoAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterNumberSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/number", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// string - public string FakeOuterStringSerialize(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterStringSerializeWithHttpInfo(requiredStringUuid, body); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// ApiResponse of string - public Org.OpenAPITools.Client.ApiResponse FakeOuterStringSerializeWithHttpInfo(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_uuid", requiredStringUuid)); - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterStringSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/outer/string", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterStringSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of string - public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterStringSerializeWithHttpInfoAsync(requiredStringUuid, body, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test serialization of outer string types - /// - /// Thrown when fails to make API call - /// Required UUID String - /// Input string as post body (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (string) - public async System.Threading.Tasks.Task> FakeOuterStringSerializeWithHttpInfoAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "*/*" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_uuid", requiredStringUuid)); - localVarRequestOptions.Data = body; - - localVarRequestOptions.Operation = "FakeApi.FakeOuterStringSerialize"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/string", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FakeOuterStringSerialize", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// List<OuterEnum> - public List GetArrayOfEnums(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetArrayOfEnumsWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of List<OuterEnum> - public Org.OpenAPITools.Client.ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetArrayOfEnums"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get>("/fake/array-of-enums", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetArrayOfEnums", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<OuterEnum> - public async System.Threading.Tasks.Task> GetArrayOfEnumsAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetArrayOfEnumsWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Array of Enums - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<OuterEnum>) - public async System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetArrayOfEnums"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/fake/array-of-enums", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetArrayOfEnums", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// MixedAnyOf - public MixedAnyOf GetMixedAnyOf(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetMixedAnyOfWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of MixedAnyOf - public Org.OpenAPITools.Client.ApiResponse GetMixedAnyOfWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of MixedAnyOf - public async System.Threading.Tasks.Task GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetMixedAnyOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test mixed type anyOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (MixedAnyOf) - public async System.Threading.Tasks.Task> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// MixedOneOf - public MixedOneOf GetMixedOneOf(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetMixedOneOfWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of MixedOneOf - public Org.OpenAPITools.Client.ApiResponse GetMixedOneOfWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of MixedOneOf - public async System.Threading.Tasks.Task GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetMixedOneOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Test mixed type oneOf deserialization - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (MixedOneOf) - public async System.Threading.Tasks.Task> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) - { - TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); - } - - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test referenced additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// - public void TestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0) - { - TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); - } - - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0) - { - // verify the required parameter 'fileSchemaTestClass' is set - if (fileSchemaTestClass == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = fileSchemaTestClass; - - localVarRequestOptions.Operation = "FakeApi.TestBodyWithFileSchema"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Put("/fake/body-with-file-schema", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestBodyWithFileSchema", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestBodyWithFileSchemaWithHttpInfoAsync(fileSchemaTestClass, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// For this test, the body for this request much reference a schema named `File`. - /// - /// Thrown when fails to make API call - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestBodyWithFileSchemaWithHttpInfoAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'fileSchemaTestClass' is set - if (fileSchemaTestClass == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = fileSchemaTestClass; - - localVarRequestOptions.Operation = "FakeApi.TestBodyWithFileSchema"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/body-with-file-schema", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestBodyWithFileSchema", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// - public void TestBodyWithQueryParams(string query, User user, int operationIndex = 0) - { - TestBodyWithQueryParamsWithHttpInfo(query, user); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestBodyWithQueryParamsWithHttpInfo(string query, User user, int operationIndex = 0) - { - // verify the required parameter 'query' is set - if (query == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); - } - - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling FakeApi->TestBodyWithQueryParams"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "FakeApi.TestBodyWithQueryParams"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Put("/fake/body-with-query-params", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestBodyWithQueryParams", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestBodyWithQueryParamsAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestBodyWithQueryParamsWithHttpInfoAsync(query, user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// - /// - /// Thrown when fails to make API call - /// - /// - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestBodyWithQueryParamsWithHttpInfoAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'query' is set - if (query == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); - } - - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling FakeApi->TestBodyWithQueryParams"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "FakeApi.TestBodyWithQueryParams"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/body-with-query-params", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestBodyWithQueryParams", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - public ModelClient TestClientModel(ModelClient modelClient, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClientModelWithHttpInfo(modelClient); - return localVarResponse.Data; - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpInfo(ModelClient modelClient, int operationIndex = 0) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeApi->TestClientModel"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "FakeApi.TestClientModel"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Patch("/fake", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestClientModel", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - public async System.Threading.Tasks.Task TestClientModelAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClientModelWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// To test \"client\" model To test \"client\" model - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestClientModelWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeApi->TestClientModel"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "FakeApi.TestClientModel"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PatchAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestClientModel", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// - public void TestEndpointParameters(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0) - { - TestEndpointParametersWithHttpInfo(number, varDouble, patternWithoutDelimiter, varByte, integer, int32, int64, varFloat, varString, binary, date, dateTime, password, callback); - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestEndpointParametersWithHttpInfo(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0) - { - // verify the required parameter 'patternWithoutDelimiter' is set - if (patternWithoutDelimiter == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); - } - - // verify the required parameter 'varByte' is set - if (varByte == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'varByte' when calling FakeApi->TestEndpointParameters"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - if (integer != null) - { - localVarRequestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter - } - if (int32 != null) - { - localVarRequestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter - } - if (int64 != null) - { - localVarRequestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter - } - localVarRequestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter - if (varFloat != null) - { - localVarRequestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varFloat)); // form parameter - } - localVarRequestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varDouble)); // form parameter - if (varString != null) - { - localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varString)); // form parameter - } - localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter - localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varByte)); // form parameter - if (binary != null) - { - localVarRequestOptions.FileParameters.Add("binary", binary); - } - if (date != null) - { - localVarRequestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter - } - if (dateTime != null) - { - localVarRequestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter - } - if (password != null) - { - localVarRequestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter - } - if (callback != null) - { - localVarRequestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestEndpointParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (http_basic_test) required - // http basic authentication required - if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestEndpointParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestEndpointParametersAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestEndpointParametersWithHttpInfoAsync(number, varDouble, patternWithoutDelimiter, varByte, integer, int32, int64, varFloat, varString, binary, date, dateTime, password, callback, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - /// - /// Thrown when fails to make API call - /// None - /// None - /// None - /// None - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional) - /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") - /// None (optional) - /// None (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestEndpointParametersWithHttpInfoAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'patternWithoutDelimiter' is set - if (patternWithoutDelimiter == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); - } - - // verify the required parameter 'varByte' is set - if (varByte == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'varByte' when calling FakeApi->TestEndpointParameters"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - if (integer != null) - { - localVarRequestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter - } - if (int32 != null) - { - localVarRequestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter - } - if (int64 != null) - { - localVarRequestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter - } - localVarRequestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter - if (varFloat != null) - { - localVarRequestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varFloat)); // form parameter - } - localVarRequestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varDouble)); // form parameter - if (varString != null) - { - localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varString)); // form parameter - } - localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter - localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varByte)); // form parameter - if (binary != null) - { - localVarRequestOptions.FileParameters.Add("binary", binary); - } - if (date != null) - { - localVarRequestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter - } - if (dateTime != null) - { - localVarRequestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter - } - if (password != null) - { - localVarRequestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter - } - if (callback != null) - { - localVarRequestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestEndpointParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (http_basic_test) required - // http basic authentication required - if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestEndpointParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// - public void TestEnumParameters(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0) - { - TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestEnumParametersWithHttpInfo(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - if (enumQueryStringArray != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "enum_query_string_array", enumQueryStringArray)); - } - if (enumQueryString != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)); - } - if (enumQueryInteger != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)); - } - if (enumQueryDouble != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); - } - if (enumHeaderStringArray != null) - { - localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter - } - if (enumHeaderString != null) - { - localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter - } - if (enumFormStringArray != null) - { - localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter - } - if (enumFormString != null) - { - localVarRequestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestEnumParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestEnumParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestEnumParametersAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestEnumParametersWithHttpInfoAsync(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// To test enum parameters To test enum parameters - /// - /// Thrown when fails to make API call - /// Header parameter enum test (string array) (optional) - /// Header parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (string array) (optional) - /// Query parameter enum test (string) (optional, default to -efg) - /// Query parameter enum test (double) (optional) - /// Query parameter enum test (double) (optional) - /// Form parameter enum test (string array) (optional, default to $) - /// Form parameter enum test (string) (optional, default to -efg) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestEnumParametersWithHttpInfoAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - if (enumQueryStringArray != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "enum_query_string_array", enumQueryStringArray)); - } - if (enumQueryString != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)); - } - if (enumQueryInteger != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)); - } - if (enumQueryDouble != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); - } - if (enumHeaderStringArray != null) - { - localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter - } - if (enumHeaderString != null) - { - localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter - } - if (enumFormStringArray != null) - { - localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter - } - if (enumFormString != null) - { - localVarRequestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestEnumParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestEnumParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// - public void TestGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0) - { - TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); - } - - /// - /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)); - if (stringGroup != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)); - } - if (int64Group != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)); - } - localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter - if (booleanGroup != null) - { - localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestGroupParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (bearer_test) required - // bearer authentication required - if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - - // make the HTTP request - var localVarResponse = this.Client.Delete("/fake", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestGroupParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestGroupParametersAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestGroupParametersWithHttpInfoAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) - /// - /// Thrown when fails to make API call - /// Required String in group parameters - /// Required Boolean in group parameters - /// Required Integer in group parameters - /// String in group parameters (optional) - /// Boolean in group parameters (optional) - /// Integer in group parameters (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestGroupParametersWithHttpInfoAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)); - if (stringGroup != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)); - } - if (int64Group != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)); - } - localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter - if (booleanGroup != null) - { - localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter - } - - localVarRequestOptions.Operation = "FakeApi.TestGroupParameters"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (bearer_test) required - // bearer authentication required - if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.DeleteAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestGroupParameters", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - public void TestInlineAdditionalProperties(Dictionary requestBody, int operationIndex = 0) - { - TestInlineAdditionalPropertiesWithHttpInfo(requestBody); - } - - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestInlineAdditionalPropertiesWithHttpInfo(Dictionary requestBody, int operationIndex = 0) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestInlineAdditionalProperties"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestInlineAdditionalProperties"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/inline-additionalProperties", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestInlineAdditionalPropertiesWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test inline additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestInlineAdditionalPropertiesWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestInlineAdditionalProperties"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestInlineAdditionalProperties"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/inline-additionalProperties", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - public void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0) - { - TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); - } - - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0) - { - // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set - if (testInlineFreeformAdditionalPropertiesRequest == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest; - - localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(testInlineFreeformAdditionalPropertiesRequest, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test inline free-form additionalProperties - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set - if (testInlineFreeformAdditionalPropertiesRequest == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest; - - localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// - public void TestJsonFormData(string param, string param2, int operationIndex = 0) - { - TestJsonFormDataWithHttpInfo(param, param2); - } - - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo(string param, string param2, int operationIndex = 0) - { - // verify the required parameter 'param' is set - if (param == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); - } - - // verify the required parameter 'param2' is set - if (param2 == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter - localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter - - localVarRequestOptions.Operation = "FakeApi.TestJsonFormData"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/fake/jsonFormData", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestJsonFormData", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestJsonFormDataAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestJsonFormDataWithHttpInfoAsync(param, param2, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test json serialization of form data - /// - /// Thrown when fails to make API call - /// field1 - /// field2 - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestJsonFormDataWithHttpInfoAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'param' is set - if (param == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); - } - - // verify the required parameter 'param2' is set - if (param2 == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter - localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter - - localVarRequestOptions.Operation = "FakeApi.TestJsonFormData"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/jsonFormData", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestJsonFormData", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// - public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) - { - TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); - } - - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) - { - // verify the required parameter 'pipe' is set - if (pipe == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'ioutil' is set - if (ioutil == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'http' is set - if (http == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'url' is set - if (url == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'context' is set - if (context == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'requiredNotNullable' is set - if (requiredNotNullable == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'requiredNullable' is set - if (requiredNullable == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "pipe", pipe)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); - if (notRequiredNotNullable != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); - } - if (notRequiredNullable != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); - } - - localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Put("/fake/test-query-parameters", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// To test the collection format in query parameters - /// - /// Thrown when fails to make API call - /// - /// - /// - /// - /// - /// - /// - /// (optional) - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'pipe' is set - if (pipe == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'ioutil' is set - if (ioutil == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'http' is set - if (http == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'url' is set - if (url == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'context' is set - if (context == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'requiredNotNullable' is set - if (requiredNotNullable == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - // verify the required parameter 'requiredNullable' is set - if (requiredNullable == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "pipe", pipe)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); - if (notRequiredNotNullable != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); - } - if (notRequiredNullable != null) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); - } - - localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/test-query-parameters", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// - public void TestStringMapReference(Dictionary requestBody, int operationIndex = 0) - { - TestStringMapReferenceWithHttpInfo(requestBody); - } - - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse TestStringMapReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestStringMapReference"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestStringMapReference"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/stringMap-reference", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestStringMapReference", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task TestStringMapReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await TestStringMapReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// test referenced string map - /// - /// Thrown when fails to make API call - /// request body - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> TestStringMapReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'requestBody' is set - if (requestBody == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestStringMapReference"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = requestBody; - - localVarRequestOptions.Operation = "FakeApi.TestStringMapReference"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/stringMap-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestStringMapReference", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs deleted file mode 100644 index b0e5066eef8f..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ /dev/null @@ -1,364 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeClassnameTags123ApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// To test class name in snake case - /// - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - ModelClient TestClassname(ModelClient modelClient, int operationIndex = 0); - - /// - /// To test class name in snake case - /// - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - ApiResponse TestClassnameWithHttpInfo(ModelClient modelClient, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeClassnameTags123ApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// To test class name in snake case - /// - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - System.Threading.Tasks.Task TestClassnameAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// To test class name in snake case - /// - /// - /// To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestClassnameWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IFakeClassnameTags123Api : IFakeClassnameTags123ApiSync, IFakeClassnameTags123ApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeClassnameTags123Api() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public FakeClassnameTags123Api(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public FakeClassnameTags123Api(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public FakeClassnameTags123Api(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// To test class name in snake case To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ModelClient - public ModelClient TestClassname(ModelClient modelClient, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClassnameWithHttpInfo(modelClient); - return localVarResponse.Data; - } - - /// - /// To test class name in snake case To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// ApiResponse of ModelClient - public Org.OpenAPITools.Client.ApiResponse TestClassnameWithHttpInfo(ModelClient modelClient, int operationIndex = 0) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "FakeClassnameTags123Api.TestClassname"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key_query) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - var localVarResponse = this.Client.Patch("/fake_classname_test", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// To test class name in snake case To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ModelClient - public async System.Threading.Tasks.Task TestClassnameAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClassnameWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// To test class name in snake case To test class name in snake case - /// - /// Thrown when fails to make API call - /// client model - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestClassnameWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'modelClient' is set - if (modelClient == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = modelClient; - - localVarRequestOptions.Operation = "FakeClassnameTags123Api.TestClassname"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key_query) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PatchAsync("/fake_classname_test", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs deleted file mode 100644 index 96d721326221..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ /dev/null @@ -1,2346 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IPetApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// - void AddPet(Pet pet, int operationIndex = 0); - - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse AddPetWithHttpInfo(Pet pet, int operationIndex = 0); - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// - void DeletePet(long petId, string? apiKey = default(string?), int operationIndex = 0); - - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse DeletePetWithHttpInfo(long petId, string? apiKey = default(string?), int operationIndex = 0); - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// List<Pet> - List FindPetsByStatus(List status, int operationIndex = 0); - - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// ApiResponse of List<Pet> - ApiResponse> FindPetsByStatusWithHttpInfo(List status, int operationIndex = 0); - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// List<Pet> - [Obsolete] - List FindPetsByTags(List tags, int operationIndex = 0); - - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// ApiResponse of List<Pet> - [Obsolete] - ApiResponse> FindPetsByTagsWithHttpInfo(List tags, int operationIndex = 0); - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Pet - Pet GetPetById(long petId, int operationIndex = 0); - - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// ApiResponse of Pet - ApiResponse GetPetByIdWithHttpInfo(long petId, int operationIndex = 0); - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// - void UpdatePet(Pet pet, int operationIndex = 0); - - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse UpdatePetWithHttpInfo(Pet pet, int operationIndex = 0); - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// - void UpdatePetWithForm(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0); - - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0); - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// ApiResponse - ApiResponse UploadFile(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0); - - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// ApiResponse of ApiResponse - ApiResponse UploadFileWithHttpInfo(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0); - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// ApiResponse - ApiResponse UploadFileWithRequiredFile(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0); - - /// - /// uploads an image (required) - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// ApiResponse of ApiResponse - ApiResponse UploadFileWithRequiredFileWithHttpInfo(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IPetApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Add a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task DeletePetAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Deletes a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Pet> - System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Finds Pets by status - /// - /// - /// Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Pet>) - System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Pet> - [Obsolete] - System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Finds Pets by tags - /// - /// - /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Pet>) - [Obsolete] - System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Pet - System.Threading.Tasks.Task GetPetByIdAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Find pet by ID - /// - /// - /// Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Pet) - System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task UpdatePetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Update an existing pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Updates a pet in the store with form data - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task UploadFileAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ApiResponse) - System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// uploads an image (required) - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// uploads an image (required) - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ApiResponse) - System.Threading.Tasks.Task> UploadFileWithRequiredFileWithHttpInfoAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IPetApi : IPetApiSync, IPetApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class PetApi : IPetApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public PetApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public PetApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public PetApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public PetApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// - public void AddPet(Pet pet, int operationIndex = 0) - { - AddPetWithHttpInfo(pet); - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, int operationIndex = 0) - { - // verify the required parameter 'pet' is set - if (pet == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json", - "application/xml" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = pet; - - localVarRequestOptions.Operation = "PetApi.AddPet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "POST", "/pet", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/pet", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await AddPetWithHttpInfoAsync(pet, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Add a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'pet' is set - if (pet == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json", - "application/xml" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = pet; - - localVarRequestOptions.Operation = "PetApi.AddPet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "POST", "/pet", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// - public void DeletePet(long petId, string? apiKey = default(string?), int operationIndex = 0) - { - DeletePetWithHttpInfo(petId, apiKey); - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse DeletePetWithHttpInfo(long petId, string? apiKey = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (apiKey != null) - { - localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter - } - - localVarRequestOptions.Operation = "PetApi.DeletePet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = this.Client.Delete("/pet/{petId}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task DeletePetAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await DeletePetWithHttpInfoAsync(petId, apiKey, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a pet - /// - /// Thrown when fails to make API call - /// Pet id to delete - /// (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (apiKey != null) - { - localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter - } - - localVarRequestOptions.Operation = "PetApi.DeletePet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.DeleteAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// List<Pet> - public List FindPetsByStatus(List status, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByStatusWithHttpInfo(status); - return localVarResponse.Data; - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// ApiResponse of List<Pet> - public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpInfo(List status, int operationIndex = 0) - { - // verify the required parameter 'status' is set - if (status == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); - - localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByStatus", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = this.Client.Get>("/pet/findByStatus", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Pet> - public async System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByStatusWithHttpInfoAsync(status, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Finds Pets by status Multiple status values can be provided with comma separated strings - /// - /// Thrown when fails to make API call - /// Status values that need to be considered for filter (deprecated) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Pet>) - public async System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'status' is set - if (status == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); - - localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByStatus", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByStatus", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// List<Pet> - [Obsolete] - public List FindPetsByTags(List tags, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByTagsWithHttpInfo(tags); - return localVarResponse.Data; - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// ApiResponse of List<Pet> - [Obsolete] - public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo(List tags, int operationIndex = 0) - { - // verify the required parameter 'tags' is set - if (tags == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); - - localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByTags", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = this.Client.Get>("/pet/findByTags", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of List<Pet> - [Obsolete] - public async System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByTagsWithHttpInfoAsync(tags, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - /// - /// Thrown when fails to make API call - /// Tags to filter by - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (List<Pet>) - [Obsolete] - public async System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'tags' is set - if (tags == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); - - localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByTags", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByTags", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Pet - public Pet GetPetById(long petId, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetPetByIdWithHttpInfo(petId); - return localVarResponse.Data; - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// ApiResponse of Pet - public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petId, int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - - localVarRequestOptions.Operation = "PetApi.GetPetById"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api-key"))) - { - localVarRequestOptions.HeaderParameters.Add("api-key", this.Configuration.GetApiKeyWithPrefix("api-key")); - } - // authentication (api_key_query) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - var localVarResponse = this.Client.Get("/pet/{petId}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Pet - public async System.Threading.Tasks.Task GetPetByIdAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetPetByIdWithHttpInfoAsync(petId, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Find pet by ID Returns a single pet - /// - /// Thrown when fails to make API call - /// ID of pet to return - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Pet) - public async System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - - localVarRequestOptions.Operation = "PetApi.GetPetById"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api-key"))) - { - localVarRequestOptions.HeaderParameters.Add("api-key", this.Configuration.GetApiKeyWithPrefix("api-key")); - } - // authentication (api_key_query) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) - { - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// - public void UpdatePet(Pet pet, int operationIndex = 0) - { - UpdatePetWithHttpInfo(pet); - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet, int operationIndex = 0) - { - // verify the required parameter 'pet' is set - if (pet == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json", - "application/xml" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = pet; - - localVarRequestOptions.Operation = "PetApi.UpdatePet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "PUT", "/pet", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = this.Client.Put("/pet", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task UpdatePetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await UpdatePetWithHttpInfoAsync(pet, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Update an existing pet - /// - /// Thrown when fails to make API call - /// Pet object that needs to be added to the store - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'pet' is set - if (pet == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json", - "application/xml" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = pet; - - localVarRequestOptions.Operation = "PetApi.UpdatePet"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - // authentication (http_signature_test) required - if (this.Configuration.HttpSigningConfiguration != null) - { - var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "PUT", "/pet", localVarRequestOptions); - foreach (var headerItem in HttpSigningHeaders) - { - if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) - { - localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; - } - else - { - localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); - } - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// - public void UpdatePetWithForm(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0) - { - UpdatePetWithFormWithHttpInfo(petId, name, status); - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (name != null) - { - localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter - } - if (status != null) - { - localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter - } - - localVarRequestOptions.Operation = "PetApi.UpdatePetWithForm"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/pet/{petId}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await UpdatePetWithFormWithHttpInfoAsync(petId, name, status, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Updates a pet in the store with form data - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be updated - /// Updated name of the pet (optional) - /// Updated status of the pet (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/x-www-form-urlencoded" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (name != null) - { - localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter - } - if (status != null) - { - localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter - } - - localVarRequestOptions.Operation = "PetApi.UpdatePetWithForm"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// ApiResponse - public ApiResponse UploadFile(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithHttpInfo(petId, additionalMetadata, file); - return localVarResponse.Data; - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// ApiResponse of ApiResponse - public Org.OpenAPITools.Client.ApiResponse UploadFileWithHttpInfo(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "multipart/form-data" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) - { - localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter - } - if (file != null) - { - localVarRequestOptions.FileParameters.Add("file", file); - } - - localVarRequestOptions.Operation = "PetApi.UploadFile"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task UploadFileAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileWithHttpInfoAsync(petId, additionalMetadata, file, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ApiResponse) - public async System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "multipart/form-data" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) - { - localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter - } - if (file != null) - { - localVarRequestOptions.FileParameters.Add("file", file); - } - - localVarRequestOptions.Operation = "PetApi.UploadFile"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// ApiResponse - public ApiResponse UploadFileWithRequiredFile(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); - return localVarResponse.Data; - } - - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// ApiResponse of ApiResponse - public Org.OpenAPITools.Client.ApiResponse UploadFileWithRequiredFileWithHttpInfo(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0) - { - // verify the required parameter 'requiredFile' is set - if (requiredFile == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "multipart/form-data" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) - { - localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter - } - localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); - - localVarRequestOptions.Operation = "PetApi.UploadFileWithRequiredFile"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = this.Client.Post("/fake/{petId}/uploadImageWithRequiredFile", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileWithRequiredFileWithHttpInfoAsync(petId, requiredFile, additionalMetadata, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// uploads an image (required) - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// file to upload - /// Additional data to pass to server (optional) - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (ApiResponse) - public async System.Threading.Tasks.Task> UploadFileWithRequiredFileWithHttpInfoAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'requiredFile' is set - if (requiredFile == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "multipart/form-data" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter - if (additionalMetadata != null) - { - localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter - } - localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); - - localVarRequestOptions.Operation = "PetApi.UploadFileWithRequiredFile"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (petstore_auth) required - // oauth required - if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) - { - if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) - { - localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); - } - else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && - !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && - this.Configuration.OAuthFlow != null) - { - localVarRequestOptions.OAuth = true; - } - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/{petId}/uploadImageWithRequiredFile", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs deleted file mode 100644 index 57193a85d293..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ /dev/null @@ -1,903 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IStoreApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// - void DeleteOrder(string orderId, int operationIndex = 0); - - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse DeleteOrderWithHttpInfo(string orderId, int operationIndex = 0); - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Dictionary<string, int> - Dictionary GetInventory(int operationIndex = 0); - - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of Dictionary<string, int> - ApiResponse> GetInventoryWithHttpInfo(int operationIndex = 0); - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Order - Order GetOrderById(long orderId, int operationIndex = 0); - - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// ApiResponse of Order - ApiResponse GetOrderByIdWithHttpInfo(long orderId, int operationIndex = 0); - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Order - Order PlaceOrder(Order order, int operationIndex = 0); - - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// ApiResponse of Order - ApiResponse PlaceOrderWithHttpInfo(Order order, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IStoreApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task DeleteOrderAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Delete purchase order by ID - /// - /// - /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Dictionary<string, int> - System.Threading.Tasks.Task> GetInventoryAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Returns pet inventories by status - /// - /// - /// Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Dictionary<string, int>) - System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Order - System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Find purchase order by ID - /// - /// - /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Order) - System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Order - System.Threading.Tasks.Task PlaceOrderAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Place an order for a pet - /// - /// - /// - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Order) - System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IStoreApi : IStoreApiSync, IStoreApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class StoreApi : IStoreApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public StoreApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public StoreApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public StoreApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public StoreApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// - public void DeleteOrder(string orderId, int operationIndex = 0) - { - 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 - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(string orderId, int operationIndex = 0) - { - // verify the required parameter 'orderId' is set - if (orderId == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter - - localVarRequestOptions.Operation = "StoreApi.DeleteOrder"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Delete("/store/order/{order_id}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task DeleteOrderAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await DeleteOrderWithHttpInfoAsync(orderId, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - /// - /// Thrown when fails to make API call - /// ID of the order that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'orderId' is set - if (orderId == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter - - localVarRequestOptions.Operation = "StoreApi.DeleteOrder"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.DeleteAsync("/store/order/{order_id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Dictionary<string, int> - public Dictionary GetInventory(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetInventoryWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of Dictionary<string, int> - public Org.OpenAPITools.Client.ApiResponse> GetInventoryWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "StoreApi.GetInventory"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api-key"))) - { - localVarRequestOptions.HeaderParameters.Add("api-key", this.Configuration.GetApiKeyWithPrefix("api-key")); - } - - // make the HTTP request - var localVarResponse = this.Client.Get>("/store/inventory", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Dictionary<string, int> - public async System.Threading.Tasks.Task> GetInventoryAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetInventoryWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Dictionary<string, int>) - public async System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "StoreApi.GetInventory"; - localVarRequestOptions.OperationIndex = operationIndex; - - // authentication (api_key) required - if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api-key"))) - { - localVarRequestOptions.HeaderParameters.Add("api-key", this.Configuration.GetApiKeyWithPrefix("api-key")); - } - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync>("/store/inventory", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Order - public Order GetOrderById(long orderId, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetOrderByIdWithHttpInfo(orderId); - return localVarResponse.Data; - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// ApiResponse of Order - public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long orderId, int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter - - localVarRequestOptions.Operation = "StoreApi.GetOrderById"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/store/order/{order_id}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Order - public async System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetOrderByIdWithHttpInfoAsync(orderId, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Order) - public async System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter - - localVarRequestOptions.Operation = "StoreApi.GetOrderById"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/store/order/{order_id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Order - public Order PlaceOrder(Order order, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = PlaceOrderWithHttpInfo(order); - return localVarResponse.Data; - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// ApiResponse of Order - public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order order, int operationIndex = 0) - { - // verify the required parameter 'order' is set - if (order == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = order; - - localVarRequestOptions.Operation = "StoreApi.PlaceOrder"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/store/order", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of Order - public async System.Threading.Tasks.Task PlaceOrderAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await PlaceOrderWithHttpInfoAsync(order, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Place an order for a pet - /// - /// Thrown when fails to make API call - /// order placed for purchasing the pet - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (Order) - public async System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'order' is set - if (order == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = order; - - localVarRequestOptions.Operation = "StoreApi.PlaceOrder"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/store/order", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs deleted file mode 100644 index 174d0572e677..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ /dev/null @@ -1,1691 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IUserApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// - void CreateUser(User user, int operationIndex = 0); - - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse CreateUserWithHttpInfo(User user, int operationIndex = 0); - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// - void CreateUsersWithArrayInput(List user, int operationIndex = 0); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user, int operationIndex = 0); - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// - void CreateUsersWithListInput(List user, int operationIndex = 0); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse CreateUsersWithListInputWithHttpInfo(List user, int operationIndex = 0); - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// - void DeleteUser(string username, int operationIndex = 0); - - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse DeleteUserWithHttpInfo(string username, int operationIndex = 0); - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// User - User GetUserByName(string username, int operationIndex = 0); - - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// ApiResponse of User - ApiResponse GetUserByNameWithHttpInfo(string username, int operationIndex = 0); - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// string - string LoginUser(string username, string password, int operationIndex = 0); - - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// ApiResponse of string - ApiResponse LoginUserWithHttpInfo(string username, string password, int operationIndex = 0); - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// - void LogoutUser(int operationIndex = 0); - - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse LogoutUserWithHttpInfo(int operationIndex = 0); - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// - void UpdateUser(string username, User user, int operationIndex = 0); - - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - ApiResponse UpdateUserWithHttpInfo(string username, User user, int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IUserApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task CreateUserAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Create user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Creates list of users with given input array - /// - /// - /// - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task DeleteUserAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Delete user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of User - System.Threading.Tasks.Task GetUserByNameAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Get user by user name - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (User) - System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of string - System.Threading.Tasks.Task LoginUserAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Logs user into the system - /// - /// - /// - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (string) - System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task LogoutUserAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Logs out current logged in user session - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - System.Threading.Tasks.Task UpdateUserAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// Updated user - /// - /// - /// This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IUserApi : IUserApiSync, IUserApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class UserApi : IUserApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public UserApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public UserApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public UserApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public UserApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// - public void CreateUser(User user, int operationIndex = 0) - { - CreateUserWithHttpInfo(user); - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User user, int operationIndex = 0) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/user", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task CreateUserAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await CreateUserWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Create user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// Created user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/user", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// - public void CreateUsersWithArrayInput(List user, int operationIndex = 0) - { - CreateUsersWithArrayInputWithHttpInfo(user); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user, int operationIndex = 0) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUsersWithArrayInput"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/user/createWithArray", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await CreateUsersWithArrayInputWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUsersWithArrayInput"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithArray", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// - public void CreateUsersWithListInput(List user, int operationIndex = 0) - { - CreateUsersWithListInputWithHttpInfo(user); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithHttpInfo(List user, int operationIndex = 0) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUsersWithListInput"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Post("/user/createWithList", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await CreateUsersWithListInputWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates list of users with given input array - /// - /// Thrown when fails to make API call - /// List of user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.CreateUsersWithListInput"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithList", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// - public void DeleteUser(string username, int operationIndex = 0) - { - DeleteUserWithHttpInfo(username); - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string username, int operationIndex = 0) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - - localVarRequestOptions.Operation = "UserApi.DeleteUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Delete("/user/{username}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task DeleteUserAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await DeleteUserWithHttpInfoAsync(username, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Delete user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// The name that needs to be deleted - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - - localVarRequestOptions.Operation = "UserApi.DeleteUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.DeleteAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// User - public User GetUserByName(string username, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = GetUserByNameWithHttpInfo(username); - return localVarResponse.Data; - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// ApiResponse of User - public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(string username, int operationIndex = 0) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - - localVarRequestOptions.Operation = "UserApi.GetUserByName"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/user/{username}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of User - public async System.Threading.Tasks.Task GetUserByNameAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetUserByNameWithHttpInfoAsync(username, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Get user by user name - /// - /// Thrown when fails to make API call - /// The name that needs to be fetched. Use user1 for testing. - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (User) - public async System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - - localVarRequestOptions.Operation = "UserApi.GetUserByName"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// string - public string LoginUser(string username, string password, int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = LoginUserWithHttpInfo(username, password); - return localVarResponse.Data; - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// ApiResponse of string - public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string username, string password, int operationIndex = 0) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); - } - - // verify the required parameter 'password' is set - if (password == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); - - localVarRequestOptions.Operation = "UserApi.LoginUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/user/login", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of string - public async System.Threading.Tasks.Task LoginUserAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await LoginUserWithHttpInfoAsync(username, password, operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// Logs user into the system - /// - /// Thrown when fails to make API call - /// The user name for login - /// The password for login in clear text - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (string) - public async System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); - } - - // verify the required parameter 'password' is set - if (password == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/xml", - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); - localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); - - localVarRequestOptions.Operation = "UserApi.LoginUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/user/login", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// - public void LogoutUser(int operationIndex = 0) - { - LogoutUserWithHttpInfo(); - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "UserApi.LogoutUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/user/logout", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task LogoutUserAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await LogoutUserWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Logs out current logged in user session - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "UserApi.LogoutUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/user/logout", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// - public void UpdateUser(string username, User user, int operationIndex = 0) - { - UpdateUserWithHttpInfo(username, user); - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// ApiResponse of Object(void) - public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string username, User user, int operationIndex = 0) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); - } - - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); - } - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.UpdateUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Put("/user/{username}", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of void - public async System.Threading.Tasks.Task UpdateUserAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - await UpdateUserWithHttpInfoAsync(username, user, operationIndex, cancellationToken).ConfigureAwait(false); - } - - /// - /// Updated user This can only be done by the logged in user. - /// - /// Thrown when fails to make API call - /// name that need to be deleted - /// Updated user object - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - // verify the required parameter 'username' is set - if (username == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); - } - - // verify the required parameter 'user' is set - if (user == null) - { - throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); - } - - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - "application/json" - }; - - // to determine the Accept header - string[] _accepts = new string[] { - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter - localVarRequestOptions.Data = user; - - localVarRequestOptions.Operation = "UserApi.UpdateUser"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.PutAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs deleted file mode 100644 index 8431e531175d..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ /dev/null @@ -1,830 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters; -using System.Text; -using System.Threading; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using RestSharp; -using RestSharp.Serializers; -using RestSharpMethod = RestSharp.Method; -using FileIO = System.IO.File; -using Polly; -using Org.OpenAPITools.Client.Auth; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Client -{ - /// - /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. - /// - internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer - { - private readonly IReadableConfiguration _configuration; - private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - public CustomJsonCodec(IReadableConfiguration configuration) - { - _configuration = configuration; - } - - public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) - { - _serializerSettings = serializerSettings; - _configuration = configuration; - } - - /// - /// Serialize the object into a JSON string. - /// - /// Object to be serialized. - /// A JSON string. - public string Serialize(object obj) - { - if (obj != null && obj is AbstractOpenAPISchema) - { - // the object to be serialized is an oneOf/anyOf schema - return ((AbstractOpenAPISchema)obj).ToJson(); - } - else - { - return JsonConvert.SerializeObject(obj, _serializerSettings); - } - } - - public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); - - public T Deserialize(RestResponse response) - { - var result = (T)Deserialize(response, typeof(T)); - return result; - } - - /// - /// Deserialize the JSON string into a proper object. - /// - /// The HTTP response. - /// Object type. - /// Object representation of the JSON string. - internal object Deserialize(RestResponse response, Type type) - { - if (type == typeof(byte[])) // return byte array - { - return response.RawBytes; - } - - // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) - if (type == typeof(Stream)) - { - var bytes = response.RawBytes; - if (response.Headers != null) - { - var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) - ? global::System.IO.Path.GetTempPath() - : _configuration.TempFolderPath; - var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); - foreach (var header in response.Headers) - { - var match = regex.Match(header.ToString()); - if (match.Success) - { - string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); - FileIO.WriteAllBytes(fileName, bytes); - return new FileStream(fileName, FileMode.Open); - } - } - } - var stream = new MemoryStream(bytes); - return stream; - } - - if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object - { - return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); - } - - if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type - { - return Convert.ChangeType(response.Content, type); - } - - // at this point, it must be a model (json) - try - { - return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); - } - catch (Exception e) - { - throw new ApiException(500, e.Message); - } - } - - public ISerializer Serializer => this; - public IDeserializer Deserializer => this; - - public string[] AcceptedContentTypes => ContentType.JsonAccept; - - public SupportsContentType SupportsContentType => contentType => - contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || - contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); - - public ContentType ContentType { get; set; } = ContentType.Json; - - public DataFormat DataFormat => DataFormat.Json; - } - /// - /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), - /// encapsulating general REST accessor use cases. - /// - public partial class ApiClient : ISynchronousClient, IAsynchronousClient - { - private readonly string _baseUrl; - - /// - /// Specifies the settings on a object. - /// These settings can be adjusted to accommodate custom serialization rules. - /// - public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - /// - /// Allows for extending request processing for generated code. - /// - /// The RestSharp request object - partial void InterceptRequest(RestRequest request); - - /// - /// Allows for extending response processing for generated code. - /// - /// The RestSharp request object - /// The RestSharp response object - partial void InterceptResponse(RestRequest request, RestResponse response); - - /// - /// Initializes a new instance of the , defaulting to the global configurations' base url. - /// - public ApiClient() - { - _baseUrl = GlobalConfiguration.Instance.BasePath; - } - - /// - /// Initializes a new instance of the - /// - /// The target service's base path in URL format. - /// - public ApiClient(string basePath) - { - if (string.IsNullOrEmpty(basePath)) - throw new ArgumentException("basePath cannot be empty"); - - _baseUrl = basePath; - } - - /// - /// Constructs the RestSharp version of an http method - /// - /// Swagger Client Custom HttpMethod - /// RestSharp's HttpMethod instance. - /// - private RestSharpMethod Method(HttpMethod method) - { - RestSharpMethod other; - switch (method) - { - case HttpMethod.Get: - other = RestSharpMethod.Get; - break; - case HttpMethod.Post: - other = RestSharpMethod.Post; - break; - case HttpMethod.Put: - other = RestSharpMethod.Put; - break; - case HttpMethod.Delete: - other = RestSharpMethod.Delete; - break; - case HttpMethod.Head: - other = RestSharpMethod.Head; - break; - case HttpMethod.Options: - other = RestSharpMethod.Options; - break; - case HttpMethod.Patch: - other = RestSharpMethod.Patch; - break; - default: - throw new ArgumentOutOfRangeException("method", method, null); - } - - return other; - } - - /// - /// Provides all logic for constructing a new RestSharp . - /// At this point, all information for querying the service is known. - /// Here, it is simply mapped into the RestSharp request. - /// - /// The http verb. - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// [private] A new RestRequest instance. - /// - private RestRequest NewRequest( - HttpMethod method, - string path, - RequestOptions options, - IReadableConfiguration configuration) - { - if (path == null) throw new ArgumentNullException("path"); - if (options == null) throw new ArgumentNullException("options"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - RestRequest request = new RestRequest(path, Method(method)); - - if (options.PathParameters != null) - { - foreach (var pathParam in options.PathParameters) - { - request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); - } - } - - if (options.QueryParameters != null) - { - foreach (var queryParam in options.QueryParameters) - { - foreach (var value in queryParam.Value) - { - request.AddQueryParameter(queryParam.Key, value); - } - } - } - - if (configuration.DefaultHeaders != null) - { - foreach (var headerParam in configuration.DefaultHeaders) - { - request.AddHeader(headerParam.Key, headerParam.Value); - } - } - - if (options.HeaderParameters != null) - { - foreach (var headerParam in options.HeaderParameters) - { - foreach (var value in headerParam.Value) - { - request.AddHeader(headerParam.Key, value); - } - } - } - - if (options.FormParameters != null) - { - foreach (var formParam in options.FormParameters) - { - request.AddParameter(formParam.Key, formParam.Value); - } - } - - if (options.Data != null) - { - if (options.Data is Stream stream) - { - var contentType = "application/octet-stream"; - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - contentType = contentTypes[0]; - } - - var bytes = ClientUtils.ReadAsBytes(stream); - request.AddParameter(contentType, bytes, ParameterType.RequestBody); - } - else - { - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) - { - request.RequestFormat = DataFormat.Json; - } - else - { - // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. - } - } - else - { - // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. - request.RequestFormat = DataFormat.Json; - } - - request.AddJsonBody(options.Data); - } - } - - if (options.FileParameters != null) - { - foreach (var fileParam in options.FileParameters) - { - foreach (var file in fileParam.Value) - { - var bytes = ClientUtils.ReadAsBytes(file); - var fileStream = file as FileStream; - if (fileStream != null) - request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); - else - request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); - } - } - } - - return request; - } - - /// - /// Transforms a RestResponse instance into a new ApiResponse instance. - /// At this point, we have a concrete http response from the service. - /// Here, it is simply mapped into the [public] ApiResponse object. - /// - /// The RestSharp response object - /// A new ApiResponse instance. - private ApiResponse ToApiResponse(RestResponse response) - { - T result = response.Data; - string rawContent = response.Content; - - var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) - { - ErrorText = response.ErrorMessage, - Cookies = new List() - }; - - if (response.Headers != null) - { - foreach (var responseHeader in response.Headers) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.ContentHeaders != null) - { - foreach (var responseHeader in response.ContentHeaders) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.Cookies != null) - { - foreach (var responseCookies in response.Cookies.Cast()) - { - transformed.Cookies.Add( - new Cookie( - responseCookies.Name, - responseCookies.Value, - responseCookies.Path, - responseCookies.Domain) - ); - } - } - - return transformed; - } - - /// - /// Executes the HTTP request for the current service. - /// Based on functions received it can be async or sync. - /// - /// Local function that executes http request and returns http response. - /// Local function to specify options for the service. - /// The RestSharp request object - /// The RestSharp options object - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// A new ApiResponse instance. - private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; - var clientOptions = new RestClientOptions(baseUrl) - { - ClientCertificates = configuration.ClientCertificates, - Timeout = configuration.Timeout, - Proxy = configuration.Proxy, - UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials, - RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback - }; - setOptions(clientOptions); - - if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && - !string.IsNullOrEmpty(configuration.OAuthClientId) && - !string.IsNullOrEmpty(configuration.OAuthClientSecret) && - configuration.OAuthFlow != null) - { - clientOptions.Authenticator = new OAuthAuthenticator( - configuration.OAuthTokenUrl, - configuration.OAuthClientId, - configuration.OAuthClientSecret, - configuration.OAuthScope, - configuration.OAuthFlow, - SerializerSettings, - configuration); - } - - using (RestClient client = new RestClient(clientOptions, - configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) - { - InterceptRequest(request); - - RestResponse response = await getResponse(client); - - // if the response type is oneOf/anyOf, call FromJSON to deserialize the data - if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) - { - try - { - response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); - } - catch (Exception ex) - { - throw ex.InnerException != null ? ex.InnerException : ex; - } - } - else if (typeof(T).Name == "Stream") // for binary response - { - response.Data = (T)(object)new MemoryStream(response.RawBytes); - } - else if (typeof(T).Name == "Byte[]") // for byte response - { - response.Data = (T)(object)response.RawBytes; - } - else if (typeof(T).Name == "String") // for string response - { - response.Data = (T)(object)response.Content; - } - - InterceptResponse(request, response); - - var result = ToApiResponse(response); - if (response.ErrorMessage != null) - { - result.ErrorText = response.ErrorMessage; - } - - if (response.Cookies != null && response.Cookies.Count > 0) - { - if (result.Cookies == null) result.Cookies = new List(); - foreach (var restResponseCookie in response.Cookies.Cast()) - { - var cookie = new Cookie( - restResponseCookie.Name, - restResponseCookie.Value, - restResponseCookie.Path, - restResponseCookie.Domain - ) - { - Comment = restResponseCookie.Comment, - CommentUri = restResponseCookie.CommentUri, - Discard = restResponseCookie.Discard, - Expired = restResponseCookie.Expired, - Expires = restResponseCookie.Expires, - HttpOnly = restResponseCookie.HttpOnly, - Port = restResponseCookie.Port, - Secure = restResponseCookie.Secure, - Version = restResponseCookie.Version - }; - - result.Cookies.Add(cookie); - } - } - return result; - } - } - - private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) - { - if (policyResult.Outcome == OutcomeType.Successful) - { - return await client.Deserialize(policyResult.Result, cancellationToken); - } - else - { - return new RestResponse(request) - { - ErrorException = policyResult.FinalException - }; - } - } - - private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - Action setOptions = (clientOptions) => - { - var cookies = new CookieContainer(); - - if (options.Cookies != null && options.Cookies.Count > 0) - { - foreach (var cookie in options.Cookies) - { - cookies.Add(new Cookie(cookie.Name, cookie.Value)); - } - } - clientOptions.CookieContainer = cookies; - }; - - Func>> getResponse = (client) => - { - if (RetryConfiguration.RetryPolicy != null) - { - var policy = RetryConfiguration.RetryPolicy; - var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); - return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); - } - else - { - return Task.FromResult(client.Execute(request)); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); - } - - private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) - { - Action setOptions = (clientOptions) => - { - //no extra options - }; - - Func>> getResponse = async (client) => - { - if (RetryConfiguration.AsyncRetryPolicy != null) - { - var policy = RetryConfiguration.AsyncRetryPolicy; - var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); - return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); - } - else - { - return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration); - } - - #region IAsynchronousClient - /// - /// Make a HTTP GET request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP POST request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PUT request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP DELETE request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP HEAD request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP OPTION request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PATCH request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); - } - #endregion IAsynchronousClient - - #region ISynchronousClient - /// - /// Make a HTTP GET request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); - } - - /// - /// Make a HTTP POST request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); - } - - /// - /// Make a HTTP PUT request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); - } - - /// - /// Make a HTTP DELETE request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); - } - - /// - /// Make a HTTP HEAD request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); - } - - /// - /// Make a HTTP OPTION request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); - } - - /// - /// Make a HTTP PATCH request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); - } - #endregion ISynchronousClient - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs deleted file mode 100644 index fcf584d1fd25..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ /dev/null @@ -1,806 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.InteropServices; -using System.Security; -using System.Security.Cryptography; -using System.Text; -using System.Web; - -namespace Org.OpenAPITools.Client -{ - /// - /// Class for HttpSigning auth related parameter and methods - /// - public class HttpSigningConfiguration - { - /// - /// Initialize the HashAlgorithm and SigningAlgorithm to default value - /// - public HttpSigningConfiguration() - { - HashAlgorithm = HashAlgorithmName.SHA256; - SigningAlgorithm = "PKCS1-v15"; - } - - /// - ///Gets the Api keyId - /// - public string KeyId { get; set; } - - /// - /// Gets the Key file path - /// - public string KeyFilePath { get; set; } - - /// - /// Specify the API key in the form of a string, either configure the KeyString property or configure the KeyFilePath property. - /// - public string KeyString { get; set; } - - /// - /// Gets the key pass phrase for password protected key - /// - public SecureString KeyPassPhrase { get; set; } - - /// - /// Gets the HTTP signing header - /// - public List HttpSigningHeader { get; set; } - - /// - /// Gets the hash algorithm sha256 or sha512 - /// - public HashAlgorithmName HashAlgorithm { get; set; } - - /// - /// Gets the signing algorithm - /// - public string SigningAlgorithm { get; set; } - - /// - /// Gets the Signature validity period in seconds - /// - public int SignatureValidityPeriod { get; set; } - - private enum PrivateKeyType - { - None = 0, - RSA = 1, - ECDSA = 2, - } - - /// - /// Gets the Headers for HttpSigning - /// - /// Base path - /// HTTP method - /// Path - /// Request options - /// Http signed headers - public Dictionary GetHttpSignedHeader(string basePath,string method, string path, RequestOptions requestOptions) - { - const string HEADER_REQUEST_TARGET = "(request-target)"; - //The time when the HTTP signature expires. The API server should reject HTTP requests - //that have expired. - const string HEADER_EXPIRES = "(expires)"; - //The 'Date' header. - const string HEADER_DATE = "Date"; - //The 'Host' header. - const string HEADER_HOST = "Host"; - //The time when the HTTP signature was generated. - const string HEADER_CREATED = "(created)"; - //When the 'Digest' header is included in the HTTP signature, the client automatically - //computes the digest of the HTTP request body, per RFC 3230. - const string HEADER_DIGEST = "Digest"; - //The 'Authorization' header is automatically generated by the client. It includes - //the list of signed headers and a base64-encoded signature. - const string HEADER_AUTHORIZATION = "Authorization"; - - //Read the api key from the file - if(File.Exists(KeyFilePath)) - { - this.KeyString = ReadApiKeyFromFile(KeyFilePath); - } - else if(string.IsNullOrEmpty(KeyString)) - { - throw new Exception("No API key has been provided. Supply it using either KeyFilePath or KeyString"); - } - - //Hash table to store singed headers - var HttpSignedRequestHeader = new Dictionary(); - var HttpSignatureHeader = new Dictionary(); - - if (HttpSigningHeader.Count == 0) - { - HttpSigningHeader.Add("(created)"); - } - - if (requestOptions.PathParameters != null) - { - foreach (var pathParam in requestOptions.PathParameters) - { - var tempPath = path.Replace(pathParam.Key, "0"); - path = string.Format(tempPath, pathParam.Value); - } - } - - var httpValues = HttpUtility.ParseQueryString(string.Empty); - foreach (var parameter in requestOptions.QueryParameters) - { -#if (NETCOREAPP) - if (parameter.Value.Count > 1) - { // array - foreach (var value in parameter.Value) - { - httpValues.Add(HttpUtility.UrlEncode(parameter.Key) + "[]", value); - } - } - else - { - httpValues.Add(HttpUtility.UrlEncode(parameter.Key), parameter.Value[0]); - } -#else - if (parameter.Value.Count > 1) - { // array - foreach (var value in parameter.Value) - { - httpValues.Add(parameter.Key + "[]", value); - } - } - else - { - httpValues.Add(parameter.Key, parameter.Value[0]); - } -#endif - } - var uriBuilder = new UriBuilder(string.Concat(basePath, path)); - uriBuilder.Query = httpValues.ToString().Replace("+", "%20"); - - var dateTime = DateTime.Now; - string Digest = string.Empty; - - //get the body - string requestBody = string.Empty; - if (requestOptions.Data != null) - { - var serializerSettings = new JsonSerializerSettings(); - requestBody = JsonConvert.SerializeObject(requestOptions.Data, serializerSettings); - } - - if (HashAlgorithm == HashAlgorithmName.SHA256) - { - var bodyDigest = GetStringHash(HashAlgorithm, requestBody); - Digest = string.Format("SHA-256={0}", Convert.ToBase64String(bodyDigest)); - } - else if (HashAlgorithm == HashAlgorithmName.SHA512) - { - var bodyDigest = GetStringHash(HashAlgorithm, requestBody); - Digest = string.Format("SHA-512={0}", Convert.ToBase64String(bodyDigest)); - } - else - { - throw new Exception(string.Format("{0} not supported", HashAlgorithm)); - } - - foreach (var header in HttpSigningHeader) - { - if (header.Equals(HEADER_REQUEST_TARGET)) - { - var targetUrl = string.Format("{0} {1}{2}", method.ToLower(), uriBuilder.Path, uriBuilder.Query); - HttpSignatureHeader.Add(header.ToLower(), targetUrl); - } - else if (header.Equals(HEADER_EXPIRES)) - { - var expireDateTime = dateTime.AddSeconds(SignatureValidityPeriod); - HttpSignatureHeader.Add(header.ToLower(), GetUnixTime(expireDateTime).ToString()); - } - else if (header.Equals(HEADER_DATE)) - { - var utcDateTime = dateTime.ToUniversalTime().ToString("r"); - HttpSignatureHeader.Add(header.ToLower(), utcDateTime); - HttpSignedRequestHeader.Add(HEADER_DATE, utcDateTime); - } - else if (header.Equals(HEADER_HOST)) - { - HttpSignatureHeader.Add(header.ToLower(), uriBuilder.Host); - HttpSignedRequestHeader.Add(HEADER_HOST, uriBuilder.Host); - } - else if (header.Equals(HEADER_CREATED)) - { - HttpSignatureHeader.Add(header.ToLower(), GetUnixTime(dateTime).ToString()); - } - else if (header.Equals(HEADER_DIGEST)) - { - HttpSignedRequestHeader.Add(HEADER_DIGEST, Digest); - HttpSignatureHeader.Add(header.ToLower(), Digest); - } - else - { - bool isHeaderFound = false; - foreach (var item in requestOptions.HeaderParameters) - { - if (string.Equals(item.Key, header, StringComparison.OrdinalIgnoreCase)) - { - HttpSignatureHeader.Add(header.ToLower(), item.Value.ToString()); - isHeaderFound = true; - break; - } - } - if (!isHeaderFound) - { - throw new Exception(string.Format("Cannot sign HTTP request.Request does not contain the {0} header.",header)); - } - } - - } - var headersKeysString = string.Join(" ", HttpSignatureHeader.Keys); - var headerValuesList = new List(); - - foreach (var keyVal in HttpSignatureHeader) - { - headerValuesList.Add(string.Format("{0}: {1}", keyVal.Key, keyVal.Value)); - } - //Concatenate headers value separated by new line - var headerValuesString = string.Join("\n", headerValuesList); - var signatureStringHash = GetStringHash(HashAlgorithm, headerValuesString); - string headerSignatureStr = null; - var keyType = GetKeyType(KeyString); - - if (keyType == PrivateKeyType.RSA) - { - headerSignatureStr = GetRSASignature(signatureStringHash); - } - else if (keyType == PrivateKeyType.ECDSA) - { - headerSignatureStr = GetECDSASignature(signatureStringHash); - } - else - { - throw new Exception(string.Format("Private key type {0} not supported", keyType)); - } - const string cryptographicScheme = "hs2019"; - var authorizationHeaderValue = string.Format("Signature keyId=\"{0}\",algorithm=\"{1}\"", - KeyId, cryptographicScheme); - - if (HttpSignatureHeader.ContainsKey(HEADER_CREATED)) - { - authorizationHeaderValue += string.Format(",created={0}", HttpSignatureHeader[HEADER_CREATED]); - } - - if (HttpSignatureHeader.ContainsKey(HEADER_EXPIRES)) - { - authorizationHeaderValue += string.Format(",expires={0}", HttpSignatureHeader[HEADER_EXPIRES]); - } - - authorizationHeaderValue += string.Format(",headers=\"{0}\",signature=\"{1}\"", - headersKeysString, headerSignatureStr); - HttpSignedRequestHeader.Add(HEADER_AUTHORIZATION, authorizationHeaderValue); - return HttpSignedRequestHeader; - } - - private byte[] GetStringHash(HashAlgorithmName hashAlgorithmName, string stringToBeHashed) - { - HashAlgorithm? hashAlgorithm = null; - - if (hashAlgorithmName == HashAlgorithmName.SHA1) - hashAlgorithm = SHA1.Create(); - - if (hashAlgorithmName == HashAlgorithmName.SHA256) - hashAlgorithm = SHA256.Create(); - - if (hashAlgorithmName == HashAlgorithmName.SHA512) - hashAlgorithm = SHA512.Create(); - - if (hashAlgorithmName == HashAlgorithmName.MD5) - hashAlgorithm = MD5.Create(); - - if (hashAlgorithm == null) - throw new NullReferenceException($"{ nameof(hashAlgorithm) } was null."); - - byte[] bytes = Encoding.UTF8.GetBytes(stringToBeHashed); - byte[] stringHash = hashAlgorithm.ComputeHash(bytes); - return stringHash; - } - - private int GetUnixTime(DateTime date2) - { - DateTime date1 = new DateTime(1970, 01, 01); - TimeSpan timeSpan = date2 - date1; - return (int)timeSpan.TotalSeconds; - } - - private string GetRSASignature(byte[] stringToSign) - { - if (string.IsNullOrEmpty(KeyString)) - { - throw new Exception("No API key has been provided."); - } - RSA rsa = GetRSAProviderFromPemFile(KeyString, KeyPassPhrase); - if (SigningAlgorithm == "RSASSA-PSS") - { - var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pss); - return Convert.ToBase64String(signedbytes); - } - else if (SigningAlgorithm == "PKCS1-v15") - { - var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pkcs1); - return Convert.ToBase64String(signedbytes); - } - else - { - return string.Empty; - } - } - - /// - /// Gets the ECDSA signature - /// - /// - /// ECDSA signature - private string GetECDSASignature(byte[] dataToSign) - { - if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) - { - throw new Exception("No API key has been provided."); - } - - var keyStr = KeyString; - const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; - const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; - var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); - var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); - var ecdsa = ECDsa.Create(); - - var byteCount = 0; - if (KeyPassPhrase != null) - { - IntPtr unmanagedString = IntPtr.Zero; - try - { - // convert secure string to byte array - unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); - ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); - } - finally - { - if (unmanagedString != IntPtr.Zero) - { - Marshal.ZeroFreeBSTR(unmanagedString); - } - } - } - else - ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); - - var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); - var signedString = System.Convert.ToBase64String(derBytes); - - return signedString; - } - - /// - /// Convert ANS1 format to DER format. Not recommended to use because it generate inavlid signature occationally. - /// - /// - /// - private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) - { - var derBytes = new List(); - byte derLength = 68; //default length for ECDSA code signing bit 0x44 - byte rbytesLength = 32; //R length 0x20 - byte sbytesLength = 32; //S length 0x20 - var rBytes = new List(); - var sBytes = new List(); - for (int i = 0; i < 32; i++) - { - rBytes.Add(signedBytes[i]); - } - for (int i = 32; i < 64; i++) - { - sBytes.Add(signedBytes[i]); - } - - if (rBytes[0] > 0x7F) - { - derLength++; - rbytesLength++; - var tempBytes = new List(); - tempBytes.AddRange(rBytes); - rBytes.Clear(); - rBytes.Add(0x00); - rBytes.AddRange(tempBytes); - } - - if (sBytes[0] > 0x7F) - { - derLength++; - sbytesLength++; - var tempBytes = new List(); - tempBytes.AddRange(sBytes); - sBytes.Clear(); - sBytes.Add(0x00); - sBytes.AddRange(tempBytes); - - } - - derBytes.Add(48); //start of the sequence 0x30 - derBytes.Add(derLength); //total length r length, type and r bytes - - derBytes.Add(2); //tag for integer - derBytes.Add(rbytesLength); //length of r - derBytes.AddRange(rBytes); - - derBytes.Add(2); //tag for integer - derBytes.Add(sbytesLength); //length of s - derBytes.AddRange(sBytes); - return derBytes.ToArray(); - } - - private RSACryptoServiceProvider GetRSAProviderFromPemFile(string keyString, SecureString keyPassPhrase = null) - { - if (string.IsNullOrEmpty(KeyString)) - { - throw new Exception("No API key has been provided."); - } - - const string pempubheader = "-----BEGIN PUBLIC KEY-----"; - const string pempubfooter = "-----END PUBLIC KEY-----"; - bool isPrivateKeyFile = true; - byte[] pemkey = null; - string pemstr = keyString; - - if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) - { - isPrivateKeyFile = false; - } - - if (isPrivateKeyFile) - { - pemkey = ConvertPrivateKeyToBytes(pemstr, keyPassPhrase); - if (pemkey == null) - { - return null; - } - return DecodeRSAPrivateKey(pemkey); - } - return null; - } - - private byte[] ConvertPrivateKeyToBytes(string instr, SecureString keyPassPhrase = null) - { - const string pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; - const string pemprivfooter = "-----END RSA PRIVATE KEY-----"; - string pemstr = instr.Trim(); - byte[] binkey; - - if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) - { - return null; - } - - StringBuilder sb = new StringBuilder(pemstr); - sb.Replace(pemprivheader, ""); - sb.Replace(pemprivfooter, ""); - string pvkstr = sb.ToString().Trim(); - - try - { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key - binkey = Convert.FromBase64String(pvkstr); - return binkey; - } - catch (global::System.FormatException) - { - StringReader str = new StringReader(pvkstr); - - //-------- read PEM encryption info. lines and extract salt ----- - if (!str.ReadLine().StartsWith("Proc-Type: 4,ENCRYPTED")) - { - return null; - } - string saltline = str.ReadLine(); - if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) - { - return null; - } - string saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); - byte[] salt = new byte[saltstr.Length / 2]; - for (int i = 0; i < salt.Length; i++) - salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); - if (str.ReadLine() != "") - { - return null; - } - - //------ remaining b64 data is encrypted RSA key ---- - string encryptedstr = str.ReadToEnd(); - - try - { //should have b64 encrypted RSA key now - binkey = Convert.FromBase64String(encryptedstr); - } - catch (global::System.FormatException) - { //data is not in base64 format - return null; - } - - byte[] deskey = GetEncryptedKey(salt, keyPassPhrase, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes - if (deskey == null) - { - return null; - } - - //------ Decrypt the encrypted 3des-encrypted RSA private key ------ - byte[] rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV - return rsakey; - } - } - - private RSACryptoServiceProvider DecodeRSAPrivateKey(byte[] privkey) - { - byte[] bytesModulus, bytesE, bytesD, bytesP, bytesQ, bytesDP, bytesDQ, bytesIQ; - - // --------- Set up stream to decode the asn.1 encoded RSA private key ------ - MemoryStream mem = new MemoryStream(privkey); - BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading - byte bt = 0; - ushort twobytes = 0; - int elems = 0; - try - { - twobytes = binr.ReadUInt16(); - if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) - { - binr.ReadByte(); //advance 1 byte - } - else if (twobytes == 0x8230) - { - binr.ReadInt16(); //advance 2 bytes - } - else - { - return null; - } - - twobytes = binr.ReadUInt16(); - if (twobytes != 0x0102) //version number - { - return null; - } - bt = binr.ReadByte(); - if (bt != 0x00) - { - return null; - } - - //------ all private key components are Integer sequences ---- - elems = GetIntegerSize(binr); - bytesModulus = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesE = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesD = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesP = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesQ = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesDP = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesDQ = binr.ReadBytes(elems); - - elems = GetIntegerSize(binr); - bytesIQ = binr.ReadBytes(elems); - - // ------- create RSACryptoServiceProvider instance and initialize with public key ----- - RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); - RSAParameters RSAparams = new RSAParameters(); - RSAparams.Modulus = bytesModulus; - RSAparams.Exponent = bytesE; - RSAparams.D = bytesD; - RSAparams.P = bytesP; - RSAparams.Q = bytesQ; - RSAparams.DP = bytesDP; - RSAparams.DQ = bytesDQ; - RSAparams.InverseQ = bytesIQ; - RSA.ImportParameters(RSAparams); - return RSA; - } - catch (Exception) - { - return null; - } - finally - { - binr.Close(); - } - } - - private int GetIntegerSize(BinaryReader binr) - { - byte bt = 0; - byte lowbyte = 0x00; - byte highbyte = 0x00; - int count = 0; - bt = binr.ReadByte(); - if (bt != 0x02) //expect integer - { - return 0; - } - bt = binr.ReadByte(); - - if (bt == 0x81) - { - count = binr.ReadByte(); // data size in next byte - } - else if (bt == 0x82) - { - highbyte = binr.ReadByte(); // data size in next 2 bytes - lowbyte = binr.ReadByte(); - byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; - count = BitConverter.ToInt32(modint, 0); - } - else - { - count = bt; // we already have the data size - } - while (binr.ReadByte() == 0x00) - { - //remove high order zeros in data - count -= 1; - } - binr.BaseStream.Seek(-1, SeekOrigin.Current); - //last ReadByte wasn't a removed zero, so back up a byte - return count; - } - - private byte[] GetEncryptedKey(byte[] salt, SecureString secpswd, int count, int miter) - { - IntPtr unmanagedPswd = IntPtr.Zero; - const int HASHLENGTH = 16; //MD5 bytes - byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store concatenated Mi hashed results - - byte[] psbytes = new byte[secpswd.Length]; - unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); - Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); - Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); - - // --- concatenate salt and pswd bytes into fixed data array --- - byte[] data00 = new byte[psbytes.Length + salt.Length]; - Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes - Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes - - // ---- do multi-hashing and concatenate results D1, D2 ... into keymaterial bytes ---- - MD5 md5 = MD5.Create(); - byte[] result = null; - byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget - - for (int j = 0; j < miter; j++) - { - // ---- Now hash consecutively for count times ------ - if (j == 0) - { - result = data00; //initialize - } - else - { - Array.Copy(result, hashtarget, result.Length); - Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); - result = hashtarget; - } - - for (int i = 0; i < count; i++) - { - result = md5.ComputeHash(result); - } - Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //concatenate to keymaterial - } - byte[] deskey = new byte[24]; - Array.Copy(keymaterial, deskey, deskey.Length); - - Array.Clear(psbytes, 0, psbytes.Length); - Array.Clear(data00, 0, data00.Length); - Array.Clear(result, 0, result.Length); - Array.Clear(hashtarget, 0, hashtarget.Length); - Array.Clear(keymaterial, 0, keymaterial.Length); - return deskey; - } - - private byte[] DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) - { - MemoryStream memst = new MemoryStream(); - TripleDES alg = TripleDES.Create(); - alg.Key = desKey; - alg.IV = IV; - try - { - CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); - cs.Write(cipherData, 0, cipherData.Length); - cs.Close(); - } - catch (Exception) - { - return null; - } - byte[] decryptedData = memst.ToArray(); - return decryptedData; - } - - /// - /// Detect the key type from the pem file. - /// - /// api key in string format - /// Private Key Type - private PrivateKeyType GetKeyType(string keyString) - { - string[] key = null; - - if (string.IsNullOrEmpty(keyString)) - { - throw new Exception("No API key has been provided."); - } - - const string ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY"; - const string ecPrivateKeyFooter = "END EC PRIVATE KEY"; - const string rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY"; - const string rsaPrivateFooter = "END RSA PRIVATE KEY"; - //var pkcs8Header = "BEGIN PRIVATE KEY"; - //var pkcs8Footer = "END PRIVATE KEY"; - PrivateKeyType keyType; - key = KeyString.TrimEnd().Split('\n'); - - if (key[0].Contains(rsaPrivateKeyHeader) && - key[key.Length - 1].ToString().Contains(rsaPrivateFooter)) - { - keyType = PrivateKeyType.RSA; - } - else if (key[0].Contains(ecPrivateKeyHeader) && - key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) - { - keyType = PrivateKeyType.ECDSA; - } - else - { - throw new Exception("The key file path does not exist or key is invalid or key is not supported"); - } - return keyType; - } - - /// - /// Read the api key form the api key file path and stored it in KeyString property. - /// - /// api key file path - private string ReadApiKeyFromFile(string apiKeyFilePath) - { - string apiKeyString = null; - - if(File.Exists(apiKeyFilePath)) - { - apiKeyString = File.ReadAllText(apiKeyFilePath); - } - else - { - throw new Exception("Provided API key file path does not exists."); - } - return apiKeyString; - } - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/CatAllOf.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/CatAllOf.cs deleted file mode 100644 index edc61ef4f659..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/CatAllOf.cs +++ /dev/null @@ -1,117 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// CatAllOf - /// - [DataContract(Name = "Cat_allOf")] - public partial class CatAllOf : IEquatable, IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// declawed. - public CatAllOf(bool declawed = default(bool)) - { - this.Declawed = declawed; - } - - /// - /// Gets or Sets Declawed - /// - [DataMember(Name = "declawed", EmitDefaultValue = true)] - public bool Declawed { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class CatAllOf {\n"); - sb.Append(" Declawed: ").Append(Declawed).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as CatAllOf).AreEqual; - } - - /// - /// Returns true if CatAllOf instances are equal - /// - /// Instance of CatAllOf to be compared - /// Boolean - public bool Equals(CatAllOf input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - hashCode = (hashCode * 59) + this.Declawed.GetHashCode(); - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ChildCatAllOf.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ChildCatAllOf.cs deleted file mode 100644 index 737e504099fc..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ChildCatAllOf.cs +++ /dev/null @@ -1,143 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// ChildCatAllOf - /// - [DataContract(Name = "ChildCat_allOf")] - public partial class ChildCatAllOf : IEquatable, IValidatableObject - { - /// - /// Defines PetType - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum PetTypeEnum - { - /// - /// Enum ChildCat for value: ChildCat - /// - [EnumMember(Value = "ChildCat")] - ChildCat = 1 - } - - - /// - /// Gets or Sets PetType - /// - [DataMember(Name = "pet_type", EmitDefaultValue = false)] - public PetTypeEnum? PetType { get; set; } - /// - /// Initializes a new instance of the class. - /// - /// name. - /// petType (default to PetTypeEnum.ChildCat). - public ChildCatAllOf(string name = default(string), PetTypeEnum? petType = PetTypeEnum.ChildCat) - { - this.Name = name; - this.PetType = petType; - } - - /// - /// Gets or Sets Name - /// - [DataMember(Name = "name", EmitDefaultValue = false)] - public string Name { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class ChildCatAllOf {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PetType: ").Append(PetType).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as ChildCatAllOf).AreEqual; - } - - /// - /// Returns true if ChildCatAllOf instances are equal - /// - /// Instance of ChildCatAllOf to be compared - /// Boolean - public bool Equals(ChildCatAllOf input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.Name != null) - { - hashCode = (hashCode * 59) + this.Name.GetHashCode(); - } - hashCode = (hashCode * 59) + this.PetType.GetHashCode(); - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/DogAllOf.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/DogAllOf.cs deleted file mode 100644 index e748e261c470..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/DogAllOf.cs +++ /dev/null @@ -1,120 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// DogAllOf - /// - [DataContract(Name = "Dog_allOf")] - public partial class DogAllOf : IEquatable, IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// breed. - public DogAllOf(string breed = default(string)) - { - this.Breed = breed; - } - - /// - /// Gets or Sets Breed - /// - [DataMember(Name = "breed", EmitDefaultValue = false)] - public string Breed { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class DogAllOf {\n"); - sb.Append(" Breed: ").Append(Breed).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as DogAllOf).AreEqual; - } - - /// - /// Returns true if DogAllOf instances are equal - /// - /// Instance of DogAllOf to be compared - /// Boolean - public bool Equals(DogAllOf input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.Breed != null) - { - hashCode = (hashCode * 59) + this.Breed.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedEnumType.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedEnumType.cs deleted file mode 100644 index 95b561a9f076..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedEnumType.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// Defines MixedEnumType - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum MixedEnumType - { - /// - /// Enum SOMETHING for value: SOMETHING - /// - [EnumMember(Value = "SOMETHING")] - SOMETHING = 1, - - /// - /// Enum OTHER for value: OTHER - /// - [EnumMember(Value = "OTHER")] - OTHER = 2 - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedNullableEnumType.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedNullableEnumType.cs deleted file mode 100644 index 166feb8ea602..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedNullableEnumType.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// Defines MixedNullableEnumType - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum MixedNullableEnumType - { - /// - /// Enum SOMETHINGNULL for value: SOMETHING_NULL - /// - [EnumMember(Value = "SOMETHING_NULL")] - SOMETHINGNULL = 1, - - /// - /// Enum SOMETHINGNEWED for value: SOMETHING_NEWED - /// - [EnumMember(Value = "SOMETHING_NEWED")] - SOMETHINGNEWED = 2, - - /// - /// Enum Null for value: null - /// - [EnumMember(Value = "null")] - Null = 3 - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/UpdatePet200Response.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/UpdatePet200Response.cs deleted file mode 100644 index 25d4092d1ff3..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/UpdatePet200Response.cs +++ /dev/null @@ -1,120 +0,0 @@ -/* - * OpenAPI Petstore - * - * 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 - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// UpdatePet200Response - /// - [DataContract(Name = "updatePet_200_response")] - public partial class UpdatePet200Response : IEquatable, IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// varString. - public UpdatePet200Response(Pet varString = default(Pet)) - { - this.VarString = varString; - } - - /// - /// Gets or Sets VarString - /// - [DataMember(Name = "string", EmitDefaultValue = false)] - public Pet VarString { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class UpdatePet200Response {\n"); - sb.Append(" VarString: ").Append(VarString).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as UpdatePet200Response).AreEqual; - } - - /// - /// Returns true if UpdatePet200Response instances are equal - /// - /// Instance of UpdatePet200Response to be compared - /// Boolean - public bool Equals(UpdatePet200Response input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.VarString != null) - { - hashCode = (hashCode * 59) + this.VarString.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj deleted file mode 100644 index dff6798bca8b..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - false - net7.0 - Org.OpenAPITools - Org.OpenAPITools - Library - OpenAPI - OpenAPI - OpenAPI Library - A library generated from a OpenAPI doc - No Copyright - Org.OpenAPITools - 1.0.0 - bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml - https://github.com/GIT_USER_ID/GIT_REPO_ID.git - git - Minor update - annotations - false - - - - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj deleted file mode 100644 index 2bd81bb6826e..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - Org.OpenAPITools.Test - Org.OpenAPITools.Test - net7.0 - false - annotations - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs deleted file mode 100644 index fddeca8791c1..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs +++ /dev/null @@ -1,326 +0,0 @@ -/* - * OpenAPI Dates - * - * Thic spec contains endpoints with dates in different formats - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Net; -using System.Net.Mime; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Api -{ - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IDefaultApiSync : IApiAccessor - { - #region Synchronous Operations - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// NowGet200Response - NowGet200Response NowGet(int operationIndex = 0); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of NowGet200Response - ApiResponse NowGetWithHttpInfo(int operationIndex = 0); - #endregion Synchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IDefaultApiAsync : IApiAccessor - { - #region Asynchronous Operations - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of NowGet200Response - System.Threading.Tasks.Task NowGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - - /// - /// - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (NowGet200Response) - System.Threading.Tasks.Task> NowGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); - #endregion Asynchronous Operations - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public interface IDefaultApi : IDefaultApiSync, IDefaultApiAsync - { - - } - - /// - /// Represents a collection of functions to interact with the API endpoints - /// - public partial class DefaultApi : IDefaultApi - { - private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; - - /// - /// Initializes a new instance of the class. - /// - /// - public DefaultApi() : this((string)null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// - public DefaultApi(string basePath) - { - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - new Org.OpenAPITools.Client.Configuration { BasePath = basePath } - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using Configuration object - /// - /// An instance of Configuration - /// - public DefaultApi(Org.OpenAPITools.Client.Configuration configuration) - { - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( - Org.OpenAPITools.Client.GlobalConfiguration.Instance, - configuration - ); - this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); - ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// Initializes a new instance of the class - /// using a Configuration object and client instance. - /// - /// The client interface for synchronous API access. - /// The client interface for asynchronous API access. - /// The configuration object. - public DefaultApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) - { - if (client == null) throw new ArgumentNullException("client"); - if (asyncClient == null) throw new ArgumentNullException("asyncClient"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - this.Client = client; - this.AsynchronousClient = asyncClient; - this.Configuration = configuration; - this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; - } - - /// - /// The client for accessing this underlying API asynchronously. - /// - public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } - - /// - /// The client for accessing this underlying API synchronously. - /// - public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - public string GetBasePath() - { - return this.Configuration.BasePath; - } - - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory - { - get - { - if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) - { - throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); - } - return _exceptionFactory; - } - set { _exceptionFactory = value; } - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// NowGet200Response - public NowGet200Response NowGet(int operationIndex = 0) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = NowGetWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// ApiResponse of NowGet200Response - public Org.OpenAPITools.Client.ApiResponse NowGetWithHttpInfo(int operationIndex = 0) - { - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.NowGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = this.Client.Get("/now", localVarRequestOptions, this.Configuration); - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("NowGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of NowGet200Response - public async System.Threading.Tasks.Task NowGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - Org.OpenAPITools.Client.ApiResponse localVarResponse = await NowGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); - return localVarResponse.Data; - } - - /// - /// - /// - /// Thrown when fails to make API call - /// Index associated with the operation. - /// Cancellation Token to cancel the request. - /// Task of ApiResponse (NowGet200Response) - public async System.Threading.Tasks.Task> NowGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) - { - - Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); - - string[] _contentTypes = new string[] { - }; - - // to determine the Accept header - string[] _accepts = new string[] { - "application/json" - }; - - var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); - if (localVarContentType != null) - { - localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); - } - - var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); - if (localVarAccept != null) - { - localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); - } - - - localVarRequestOptions.Operation = "DefaultApi.NowGet"; - localVarRequestOptions.OperationIndex = operationIndex; - - - // make the HTTP request - var localVarResponse = await this.AsynchronousClient.GetAsync("/now", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); - - if (this.ExceptionFactory != null) - { - Exception _exception = this.ExceptionFactory("NowGet", localVarResponse); - if (_exception != null) - { - throw _exception; - } - } - - return localVarResponse; - } - - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs deleted file mode 100644 index bc3f8ca8e981..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs +++ /dev/null @@ -1,814 +0,0 @@ -/* - * OpenAPI Dates - * - * Thic spec contains endpoints with dates in different formats - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters; -using System.Text; -using System.Threading; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using RestSharp; -using RestSharp.Serializers; -using RestSharpMethod = RestSharp.Method; -using FileIO = System.IO.File; -using Polly; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Client -{ - /// - /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. - /// - internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer - { - private readonly IReadableConfiguration _configuration; - private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - public CustomJsonCodec(IReadableConfiguration configuration) - { - _configuration = configuration; - } - - public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) - { - _serializerSettings = serializerSettings; - _configuration = configuration; - } - - /// - /// Serialize the object into a JSON string. - /// - /// Object to be serialized. - /// A JSON string. - public string Serialize(object obj) - { - if (obj != null && obj is AbstractOpenAPISchema) - { - // the object to be serialized is an oneOf/anyOf schema - return ((AbstractOpenAPISchema)obj).ToJson(); - } - else - { - return JsonConvert.SerializeObject(obj, _serializerSettings); - } - } - - public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); - - public T Deserialize(RestResponse response) - { - var result = (T)Deserialize(response, typeof(T)); - return result; - } - - /// - /// Deserialize the JSON string into a proper object. - /// - /// The HTTP response. - /// Object type. - /// Object representation of the JSON string. - internal object Deserialize(RestResponse response, Type type) - { - if (type == typeof(byte[])) // return byte array - { - return response.RawBytes; - } - - // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) - if (type == typeof(Stream)) - { - var bytes = response.RawBytes; - if (response.Headers != null) - { - var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) - ? global::System.IO.Path.GetTempPath() - : _configuration.TempFolderPath; - var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); - foreach (var header in response.Headers) - { - var match = regex.Match(header.ToString()); - if (match.Success) - { - string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); - FileIO.WriteAllBytes(fileName, bytes); - return new FileStream(fileName, FileMode.Open); - } - } - } - var stream = new MemoryStream(bytes); - return stream; - } - - if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object - { - return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); - } - - if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type - { - return Convert.ChangeType(response.Content, type); - } - - // at this point, it must be a model (json) - try - { - return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); - } - catch (Exception e) - { - throw new ApiException(500, e.Message); - } - } - - public ISerializer Serializer => this; - public IDeserializer Deserializer => this; - - public string[] AcceptedContentTypes => ContentType.JsonAccept; - - public SupportsContentType SupportsContentType => contentType => - contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || - contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); - - public ContentType ContentType { get; set; } = ContentType.Json; - - public DataFormat DataFormat => DataFormat.Json; - } - /// - /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), - /// encapsulating general REST accessor use cases. - /// - public partial class ApiClient : ISynchronousClient, IAsynchronousClient - { - private readonly string _baseUrl; - - /// - /// Specifies the settings on a object. - /// These settings can be adjusted to accommodate custom serialization rules. - /// - public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - /// - /// Allows for extending request processing for generated code. - /// - /// The RestSharp request object - partial void InterceptRequest(RestRequest request); - - /// - /// Allows for extending response processing for generated code. - /// - /// The RestSharp request object - /// The RestSharp response object - partial void InterceptResponse(RestRequest request, RestResponse response); - - /// - /// Initializes a new instance of the , defaulting to the global configurations' base url. - /// - public ApiClient() - { - _baseUrl = GlobalConfiguration.Instance.BasePath; - } - - /// - /// Initializes a new instance of the - /// - /// The target service's base path in URL format. - /// - public ApiClient(string basePath) - { - if (string.IsNullOrEmpty(basePath)) - throw new ArgumentException("basePath cannot be empty"); - - _baseUrl = basePath; - } - - /// - /// Constructs the RestSharp version of an http method - /// - /// Swagger Client Custom HttpMethod - /// RestSharp's HttpMethod instance. - /// - private RestSharpMethod Method(HttpMethod method) - { - RestSharpMethod other; - switch (method) - { - case HttpMethod.Get: - other = RestSharpMethod.Get; - break; - case HttpMethod.Post: - other = RestSharpMethod.Post; - break; - case HttpMethod.Put: - other = RestSharpMethod.Put; - break; - case HttpMethod.Delete: - other = RestSharpMethod.Delete; - break; - case HttpMethod.Head: - other = RestSharpMethod.Head; - break; - case HttpMethod.Options: - other = RestSharpMethod.Options; - break; - case HttpMethod.Patch: - other = RestSharpMethod.Patch; - break; - default: - throw new ArgumentOutOfRangeException("method", method, null); - } - - return other; - } - - /// - /// Provides all logic for constructing a new RestSharp . - /// At this point, all information for querying the service is known. - /// Here, it is simply mapped into the RestSharp request. - /// - /// The http verb. - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// [private] A new RestRequest instance. - /// - private RestRequest NewRequest( - HttpMethod method, - string path, - RequestOptions options, - IReadableConfiguration configuration) - { - if (path == null) throw new ArgumentNullException("path"); - if (options == null) throw new ArgumentNullException("options"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - RestRequest request = new RestRequest(path, Method(method)); - - if (options.PathParameters != null) - { - foreach (var pathParam in options.PathParameters) - { - request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); - } - } - - if (options.QueryParameters != null) - { - foreach (var queryParam in options.QueryParameters) - { - foreach (var value in queryParam.Value) - { - request.AddQueryParameter(queryParam.Key, value); - } - } - } - - if (configuration.DefaultHeaders != null) - { - foreach (var headerParam in configuration.DefaultHeaders) - { - request.AddHeader(headerParam.Key, headerParam.Value); - } - } - - if (options.HeaderParameters != null) - { - foreach (var headerParam in options.HeaderParameters) - { - foreach (var value in headerParam.Value) - { - request.AddHeader(headerParam.Key, value); - } - } - } - - if (options.FormParameters != null) - { - foreach (var formParam in options.FormParameters) - { - request.AddParameter(formParam.Key, formParam.Value); - } - } - - if (options.Data != null) - { - if (options.Data is Stream stream) - { - var contentType = "application/octet-stream"; - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - contentType = contentTypes[0]; - } - - var bytes = ClientUtils.ReadAsBytes(stream); - request.AddParameter(contentType, bytes, ParameterType.RequestBody); - } - else - { - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) - { - request.RequestFormat = DataFormat.Json; - } - else - { - // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. - } - } - else - { - // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. - request.RequestFormat = DataFormat.Json; - } - - request.AddJsonBody(options.Data); - } - } - - if (options.FileParameters != null) - { - foreach (var fileParam in options.FileParameters) - { - foreach (var file in fileParam.Value) - { - var bytes = ClientUtils.ReadAsBytes(file); - var fileStream = file as FileStream; - if (fileStream != null) - request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); - else - request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); - } - } - } - - return request; - } - - /// - /// Transforms a RestResponse instance into a new ApiResponse instance. - /// At this point, we have a concrete http response from the service. - /// Here, it is simply mapped into the [public] ApiResponse object. - /// - /// The RestSharp response object - /// A new ApiResponse instance. - private ApiResponse ToApiResponse(RestResponse response) - { - T result = response.Data; - string rawContent = response.Content; - - var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) - { - ErrorText = response.ErrorMessage, - Cookies = new List() - }; - - if (response.Headers != null) - { - foreach (var responseHeader in response.Headers) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.ContentHeaders != null) - { - foreach (var responseHeader in response.ContentHeaders) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.Cookies != null) - { - foreach (var responseCookies in response.Cookies.Cast()) - { - transformed.Cookies.Add( - new Cookie( - responseCookies.Name, - responseCookies.Value, - responseCookies.Path, - responseCookies.Domain) - ); - } - } - - return transformed; - } - - /// - /// Executes the HTTP request for the current service. - /// Based on functions received it can be async or sync. - /// - /// Local function that executes http request and returns http response. - /// Local function to specify options for the service. - /// The RestSharp request object - /// The RestSharp options object - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// A new ApiResponse instance. - private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; - var clientOptions = new RestClientOptions(baseUrl) - { - ClientCertificates = configuration.ClientCertificates, - Timeout = configuration.Timeout, - Proxy = configuration.Proxy, - UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials, - RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback - }; - setOptions(clientOptions); - - using (RestClient client = new RestClient(clientOptions, - configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) - { - InterceptRequest(request); - - RestResponse response = await getResponse(client); - - // if the response type is oneOf/anyOf, call FromJSON to deserialize the data - if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) - { - try - { - response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); - } - catch (Exception ex) - { - throw ex.InnerException != null ? ex.InnerException : ex; - } - } - else if (typeof(T).Name == "Stream") // for binary response - { - response.Data = (T)(object)new MemoryStream(response.RawBytes); - } - else if (typeof(T).Name == "Byte[]") // for byte response - { - response.Data = (T)(object)response.RawBytes; - } - else if (typeof(T).Name == "String") // for string response - { - response.Data = (T)(object)response.Content; - } - - InterceptResponse(request, response); - - var result = ToApiResponse(response); - if (response.ErrorMessage != null) - { - result.ErrorText = response.ErrorMessage; - } - - if (response.Cookies != null && response.Cookies.Count > 0) - { - if (result.Cookies == null) result.Cookies = new List(); - foreach (var restResponseCookie in response.Cookies.Cast()) - { - var cookie = new Cookie( - restResponseCookie.Name, - restResponseCookie.Value, - restResponseCookie.Path, - restResponseCookie.Domain - ) - { - Comment = restResponseCookie.Comment, - CommentUri = restResponseCookie.CommentUri, - Discard = restResponseCookie.Discard, - Expired = restResponseCookie.Expired, - Expires = restResponseCookie.Expires, - HttpOnly = restResponseCookie.HttpOnly, - Port = restResponseCookie.Port, - Secure = restResponseCookie.Secure, - Version = restResponseCookie.Version - }; - - result.Cookies.Add(cookie); - } - } - return result; - } - } - - private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) - { - if (policyResult.Outcome == OutcomeType.Successful) - { - return await client.Deserialize(policyResult.Result, cancellationToken); - } - else - { - return new RestResponse(request) - { - ErrorException = policyResult.FinalException - }; - } - } - - private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - Action setOptions = (clientOptions) => - { - var cookies = new CookieContainer(); - - if (options.Cookies != null && options.Cookies.Count > 0) - { - foreach (var cookie in options.Cookies) - { - cookies.Add(new Cookie(cookie.Name, cookie.Value)); - } - } - clientOptions.CookieContainer = cookies; - }; - - Func>> getResponse = (client) => - { - if (RetryConfiguration.RetryPolicy != null) - { - var policy = RetryConfiguration.RetryPolicy; - var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); - return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); - } - else - { - return Task.FromResult(client.Execute(request)); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); - } - - private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) - { - Action setOptions = (clientOptions) => - { - //no extra options - }; - - Func>> getResponse = async (client) => - { - if (RetryConfiguration.AsyncRetryPolicy != null) - { - var policy = RetryConfiguration.AsyncRetryPolicy; - var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); - return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); - } - else - { - return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration); - } - - #region IAsynchronousClient - /// - /// Make a HTTP GET request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP POST request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PUT request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP DELETE request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP HEAD request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP OPTION request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PATCH request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); - } - #endregion IAsynchronousClient - - #region ISynchronousClient - /// - /// Make a HTTP GET request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); - } - - /// - /// Make a HTTP POST request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); - } - - /// - /// Make a HTTP PUT request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); - } - - /// - /// Make a HTTP DELETE request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); - } - - /// - /// Make a HTTP HEAD request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); - } - - /// - /// Make a HTTP OPTION request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); - } - - /// - /// Make a HTTP PATCH request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); - } - #endregion ISynchronousClient - } -} diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj deleted file mode 100644 index 95d4b0a15bd3..000000000000 --- a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ /dev/null @@ -1,35 +0,0 @@ - - - - false - net7.0 - Org.OpenAPITools - Org.OpenAPITools - Library - OpenAPI - OpenAPI - OpenAPI Library - A library generated from a OpenAPI doc - No Copyright - Org.OpenAPITools - 1.0.0 - bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml - https://github.com/GIT_USER_ID/GIT_REPO_ID.git - git - Minor update - annotations - false - - - - - - - - - - - - - - diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.gitignore b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.openapi-generator-ignore b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/.openapi-generator/FILES b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.openapi-generator/FILES similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/.openapi-generator/FILES rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/.openapi-generator/FILES diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.openapi-generator/VERSION b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/Org.OpenAPITools.sln b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/README.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/README.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/README.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/README.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/api/openapi.yaml similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/api/openapi.yaml rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/api/openapi.yaml diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/appveyor.yml b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Activity.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Activity.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Activity.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Activity.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ActivityOutputElementRepresentation.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ActivityOutputElementRepresentation.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ActivityOutputElementRepresentation.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ActivityOutputElementRepresentation.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/AdditionalPropertiesClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/AdditionalPropertiesClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/AdditionalPropertiesClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Animal.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Animal.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Animal.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Animal.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/AnotherFakeApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/AnotherFakeApi.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/AnotherFakeApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ApiResponse.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ApiResponse.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ApiResponse.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ApiResponse.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Apple.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Apple.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Apple.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Apple.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/AppleReq.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/AppleReq.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/AppleReq.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/AppleReq.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ArrayOfArrayOfNumberOnly.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ArrayOfArrayOfNumberOnly.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ArrayOfArrayOfNumberOnly.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ArrayOfNumberOnly.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ArrayOfNumberOnly.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ArrayOfNumberOnly.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ArrayOfNumberOnly.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ArrayTest.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ArrayTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ArrayTest.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ArrayTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Banana.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Banana.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Banana.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Banana.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/BananaReq.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/BananaReq.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/BananaReq.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/BananaReq.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/BasquePig.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/BasquePig.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/BasquePig.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/BasquePig.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Capitalization.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Capitalization.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Capitalization.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Capitalization.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Cat.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Cat.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Cat.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Cat.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Category.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Category.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Category.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Category.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ChildCat.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ChildCat.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ChildCat.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ChildCat.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ClassModel.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ClassModel.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ClassModel.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ClassModel.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ComplexQuadrilateral.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ComplexQuadrilateral.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ComplexQuadrilateral.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ComplexQuadrilateral.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DanishPig.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/DanishPig.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DanishPig.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/DanishPig.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DateOnlyClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/DateOnlyClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DateOnlyClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/DateOnlyClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DefaultApi.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/DefaultApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DefaultApi.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/DefaultApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DeprecatedObject.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/DeprecatedObject.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/DeprecatedObject.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/DeprecatedObject.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Dog.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Dog.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Dog.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Dog.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Drawing.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Drawing.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Drawing.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Drawing.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/EnumArrays.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/EnumArrays.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/EnumArrays.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/EnumArrays.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/EnumClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/EnumClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/EnumClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/EnumClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/EnumTest.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/EnumTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/EnumTest.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/EnumTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/EquilateralTriangle.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/EquilateralTriangle.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/EquilateralTriangle.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/EquilateralTriangle.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FakeApi.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FakeApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FakeApi.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FakeApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FakeClassnameTags123Api.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FakeClassnameTags123Api.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FakeClassnameTags123Api.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FakeClassnameTags123Api.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/File.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/File.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/File.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/File.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FileSchemaTestClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FileSchemaTestClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FileSchemaTestClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Foo.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Foo.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Foo.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Foo.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FooGetDefaultResponse.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FooGetDefaultResponse.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FooGetDefaultResponse.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FooGetDefaultResponse.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FormatTest.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FormatTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FormatTest.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FormatTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Fruit.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Fruit.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Fruit.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Fruit.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FruitReq.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FruitReq.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/FruitReq.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/FruitReq.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/GmFruit.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/GmFruit.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/GmFruit.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/GmFruit.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/GrandparentAnimal.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/GrandparentAnimal.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/GrandparentAnimal.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/GrandparentAnimal.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/HasOnlyReadOnly.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/HasOnlyReadOnly.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/HasOnlyReadOnly.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/HasOnlyReadOnly.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/HealthCheckResult.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/HealthCheckResult.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/HealthCheckResult.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/HealthCheckResult.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/IsoscelesTriangle.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/IsoscelesTriangle.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/IsoscelesTriangle.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/IsoscelesTriangle.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/List.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/List.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/List.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/List.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/LiteralStringClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/LiteralStringClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/LiteralStringClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/LiteralStringClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Mammal.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Mammal.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Mammal.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Mammal.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MapTest.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MapTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MapTest.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MapTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedAnyOf.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedAnyOf.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedAnyOf.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedAnyOf.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedAnyOfContent.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedAnyOfContent.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedAnyOfContent.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedAnyOfContent.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedOneOf.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedOneOf.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedOneOf.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedOneOf.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedOneOfContent.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedOneOfContent.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedOneOfContent.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedOneOfContent.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedPropertiesAndAdditionalPropertiesClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedPropertiesAndAdditionalPropertiesClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedPropertiesAndAdditionalPropertiesClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedSubId.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedSubId.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/MixedSubId.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/MixedSubId.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Model200Response.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Model200Response.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Model200Response.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Model200Response.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ModelClient.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ModelClient.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ModelClient.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ModelClient.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Name.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Name.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Name.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Name.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NotificationtestGetElementsV1ResponseMPayload.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NotificationtestGetElementsV1ResponseMPayload.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NotificationtestGetElementsV1ResponseMPayload.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NotificationtestGetElementsV1ResponseMPayload.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NullableClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NullableClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NullableClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NullableClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NullableGuidClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NullableGuidClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NullableGuidClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NullableGuidClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NullableShape.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NullableShape.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NullableShape.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NullableShape.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NumberOnly.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NumberOnly.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/NumberOnly.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/NumberOnly.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ObjectWithDeprecatedFields.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ObjectWithDeprecatedFields.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ObjectWithDeprecatedFields.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ObjectWithDeprecatedFields.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OneOfString.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OneOfString.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OneOfString.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OneOfString.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Order.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Order.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Order.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Order.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterComposite.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterComposite.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterComposite.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterComposite.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnum.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnum.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnum.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnum.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnumDefaultValue.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnumDefaultValue.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnumDefaultValue.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnumDefaultValue.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnumInteger.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnumInteger.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnumInteger.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnumInteger.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnumIntegerDefaultValue.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnumIntegerDefaultValue.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnumIntegerDefaultValue.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnumTest.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnumTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/OuterEnumTest.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/OuterEnumTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ParentPet.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ParentPet.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ParentPet.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ParentPet.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Pet.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Pet.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Pet.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Pet.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/PetApi.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/PetApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/PetApi.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/PetApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Pig.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Pig.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Pig.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Pig.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/PolymorphicProperty.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/PolymorphicProperty.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/PolymorphicProperty.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/PolymorphicProperty.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Quadrilateral.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Quadrilateral.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Quadrilateral.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Quadrilateral.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/QuadrilateralInterface.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/QuadrilateralInterface.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/QuadrilateralInterface.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/QuadrilateralInterface.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ReadOnlyFirst.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ReadOnlyFirst.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ReadOnlyFirst.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ReadOnlyFirst.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/RequiredClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/RequiredClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/RequiredClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/RequiredClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Return.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Return.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Return.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Return.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/RolesReportsHash.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/RolesReportsHash.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/RolesReportsHash.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/RolesReportsHash.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/RolesReportsHashRole.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/RolesReportsHashRole.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/RolesReportsHashRole.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/RolesReportsHashRole.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ScaleneTriangle.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ScaleneTriangle.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ScaleneTriangle.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ScaleneTriangle.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Shape.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Shape.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Shape.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Shape.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ShapeInterface.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ShapeInterface.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ShapeInterface.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ShapeInterface.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ShapeOrNull.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ShapeOrNull.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ShapeOrNull.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ShapeOrNull.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/SimpleQuadrilateral.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/SimpleQuadrilateral.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/SimpleQuadrilateral.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/SimpleQuadrilateral.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/SpecialModelName.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/SpecialModelName.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/SpecialModelName.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/SpecialModelName.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/StoreApi.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/StoreApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/StoreApi.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/StoreApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Tag.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Tag.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Tag.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Tag.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/TestCollectionEndingWithWordList.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/TestCollectionEndingWithWordList.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/TestCollectionEndingWithWordList.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/TestCollectionEndingWithWordList.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/TestCollectionEndingWithWordListObject.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/TestCollectionEndingWithWordListObject.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/TestCollectionEndingWithWordListObject.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/TestCollectionEndingWithWordListObject.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/TestInlineFreeformAdditionalPropertiesRequest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/TestInlineFreeformAdditionalPropertiesRequest.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/TestInlineFreeformAdditionalPropertiesRequest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Triangle.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Triangle.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Triangle.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Triangle.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/TriangleInterface.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/TriangleInterface.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/TriangleInterface.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/TriangleInterface.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/User.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/User.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/User.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/User.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/UserApi.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/UserApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/UserApi.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/UserApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Whale.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Whale.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Whale.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Whale.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Zebra.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Zebra.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/Zebra.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/Zebra.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ZeroBasedEnum.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ZeroBasedEnum.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ZeroBasedEnum.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ZeroBasedEnum.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ZeroBasedEnumClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/docs/ZeroBasedEnumClass.md rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/docs/ZeroBasedEnumClass.md diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/git_push.sh b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/git_push.sh similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/git_push.sh rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/git_push.sh diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/PetApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/PetApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/PetApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/UserApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Api/UserApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Api/UserApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ActivityTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ActivityTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ActivityTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ActivityTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/AnimalTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/AnimalTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/AnimalTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/AppleTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/AppleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/AppleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/AppleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/BananaTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/BananaTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/BananaTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/BananaTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/CatTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/CatTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/CatTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/CategoryTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/CategoryTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/CategoryTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DogTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DogTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DogTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DogTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DrawingTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/DrawingTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/DrawingTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FileTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FileTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FileTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FooTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FooTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FooTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FooTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FruitTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FruitTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/FruitTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/FruitTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ListTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ListTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ListTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ListTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MammalTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MammalTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MammalTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MammalTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MapTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MapTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MapTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NameTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NameTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NameTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NameTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OrderTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OrderTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OrderTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/PetTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/PetTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/PetTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/PigTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/PigTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/PigTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/PigTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ReturnTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ReturnTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ReturnTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ReturnTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ShapeTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TagTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TagTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TagTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TriangleTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TriangleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/TriangleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/TriangleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/UserTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/UserTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/UserTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/WhaleTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/WhaleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/WhaleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/WhaleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ZebraTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ZebraTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ZebraTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ZebraTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..64ebed26518e --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net8.0 + false + annotations + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/AnotherFakeApi.cs new file mode 100644 index 000000000000..1060a9cbc232 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -0,0 +1,355 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAnotherFakeApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + ModelClient Call123TestSpecialTags(ModelClient modelClient, int operationIndex = 0); + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + ApiResponse Call123TestSpecialTagsWithHttpInfo(ModelClient modelClient, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAnotherFakeApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + System.Threading.Tasks.Task Call123TestSpecialTagsAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAnotherFakeApi : IAnotherFakeApiSync, IAnotherFakeApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class AnotherFakeApi : IAnotherFakeApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public AnotherFakeApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public AnotherFakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + public ModelClient Call123TestSpecialTags(ModelClient modelClient, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); + return localVarResponse.Data; + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + public Org.OpenAPITools.Client.ApiResponse Call123TestSpecialTagsWithHttpInfo(ModelClient modelClient, int operationIndex = 0) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "AnotherFakeApi.Call123TestSpecialTags"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Patch("/another-fake/dummy", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + public async System.Threading.Tasks.Task Call123TestSpecialTagsAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await Call123TestSpecialTagsWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "AnotherFakeApi.Call123TestSpecialTags"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PatchAsync("/another-fake/dummy", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..ddcafaaeb043 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,1023 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// FooGetDefaultResponse + FooGetDefaultResponse FooGet(int operationIndex = 0); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of FooGetDefaultResponse + ApiResponse FooGetWithHttpInfo(int operationIndex = 0); + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + void GetCountry(string country, int operationIndex = 0); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse GetCountryWithHttpInfo(string country, int operationIndex = 0); + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<Guid> + List Hello(int operationIndex = 0); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<Guid> + ApiResponse> HelloWithHttpInfo(int operationIndex = 0); + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<List<RolesReportsHash>> + List> RolesReportGet(int operationIndex = 0); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<List<RolesReportsHash>> + ApiResponse>> RolesReportGetWithHttpInfo(int operationIndex = 0); + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// NotificationtestGetElementsV1ResponseMPayload + NotificationtestGetElementsV1ResponseMPayload Test(int operationIndex = 0); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of NotificationtestGetElementsV1ResponseMPayload + ApiResponse TestWithHttpInfo(int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of FooGetDefaultResponse + System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (FooGetDefaultResponse) + System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task GetCountryAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> GetCountryWithHttpInfoAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Guid> + System.Threading.Tasks.Task> HelloAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Guid>) + System.Threading.Tasks.Task>> HelloWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<List<RolesReportsHash>> + System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<List<RolesReportsHash>>) + System.Threading.Tasks.Task>>> RolesReportGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of NotificationtestGetElementsV1ResponseMPayload + System.Threading.Tasks.Task TestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (NotificationtestGetElementsV1ResponseMPayload) + System.Threading.Tasks.Task> TestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApi : IDefaultApiSync, IDefaultApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class DefaultApi : IDefaultApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public DefaultApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public DefaultApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// FooGetDefaultResponse + public FooGetDefaultResponse FooGet(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of FooGetDefaultResponse + public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.FooGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of FooGetDefaultResponse + public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (FooGetDefaultResponse) + public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.FooGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + public void GetCountry(string country, int operationIndex = 0) + { + GetCountryWithHttpInfo(country); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse GetCountryWithHttpInfo(string country, int operationIndex = 0) + { + // verify the required parameter 'country' is set + if (country == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'country' when calling DefaultApi->GetCountry"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.FormParameters.Add("country", Org.OpenAPITools.Client.ClientUtils.ParameterToString(country)); // form parameter + + localVarRequestOptions.Operation = "DefaultApi.GetCountry"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/country", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetCountry", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task GetCountryAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await GetCountryWithHttpInfoAsync(country, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> GetCountryWithHttpInfoAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'country' is set + if (country == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'country' when calling DefaultApi->GetCountry"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.FormParameters.Add("country", Org.OpenAPITools.Client.ClientUtils.ParameterToString(country)); // form parameter + + localVarRequestOptions.Operation = "DefaultApi.GetCountry"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/country", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetCountry", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<Guid> + public List Hello(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = HelloWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<Guid> + public Org.OpenAPITools.Client.ApiResponse> HelloWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.Hello"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get>("/hello", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Hello", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Guid> + public async System.Threading.Tasks.Task> HelloAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await HelloWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Guid>) + public async System.Threading.Tasks.Task>> HelloWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.Hello"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/hello", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Hello", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<List<RolesReportsHash>> + public List> RolesReportGet(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse>> localVarResponse = RolesReportGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<List<RolesReportsHash>> + public Org.OpenAPITools.Client.ApiResponse>> RolesReportGetWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.RolesReportGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get>>("/roles/report", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RolesReportGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<List<RolesReportsHash>> + public async System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse>> localVarResponse = await RolesReportGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<List<RolesReportsHash>>) + public async System.Threading.Tasks.Task>>> RolesReportGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.RolesReportGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>>("/roles/report", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RolesReportGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// NotificationtestGetElementsV1ResponseMPayload + public NotificationtestGetElementsV1ResponseMPayload Test(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = TestWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of NotificationtestGetElementsV1ResponseMPayload + public Org.OpenAPITools.Client.ApiResponse TestWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.Test"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/test", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Test", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of NotificationtestGetElementsV1ResponseMPayload + public async System.Threading.Tasks.Task TestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (NotificationtestGetElementsV1ResponseMPayload) + public async System.Threading.Tasks.Task> TestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.Test"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/test", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Test", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/FakeApi.cs new file mode 100644 index 000000000000..0d9db708d63a --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/FakeApi.cs @@ -0,0 +1,4444 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// HealthCheckResult + HealthCheckResult FakeHealthGet(int operationIndex = 0); + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of HealthCheckResult + ApiResponse FakeHealthGetWithHttpInfo(int operationIndex = 0); + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// bool + bool FakeOuterBooleanSerialize(bool? body = default(bool?), int operationIndex = 0); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// ApiResponse of bool + ApiResponse FakeOuterBooleanSerializeWithHttpInfo(bool? body = default(bool?), int operationIndex = 0); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// OuterComposite + OuterComposite FakeOuterCompositeSerialize(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// ApiResponse of OuterComposite + ApiResponse FakeOuterCompositeSerializeWithHttpInfo(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// decimal + decimal FakeOuterNumberSerialize(decimal? body = default(decimal?), int operationIndex = 0); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// ApiResponse of decimal + ApiResponse FakeOuterNumberSerializeWithHttpInfo(decimal? body = default(decimal?), int operationIndex = 0); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// string + string FakeOuterStringSerialize(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// ApiResponse of string + ApiResponse FakeOuterStringSerializeWithHttpInfo(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0); + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<OuterEnum> + List GetArrayOfEnums(int operationIndex = 0); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<OuterEnum> + ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// MixedAnyOf + MixedAnyOf GetMixedAnyOf(int operationIndex = 0); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of MixedAnyOf + ApiResponse GetMixedAnyOfWithHttpInfo(int operationIndex = 0); + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// MixedOneOf + MixedOneOf GetMixedOneOf(int operationIndex = 0); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of MixedOneOf + ApiResponse GetMixedOneOfWithHttpInfo(int operationIndex = 0); + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + void TestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0); + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// + void TestBodyWithQueryParams(string query, User user, int operationIndex = 0); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestBodyWithQueryParamsWithHttpInfo(string query, User user, int operationIndex = 0); + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + ModelClient TestClientModel(ModelClient modelClient, int operationIndex = 0); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + ApiResponse TestClientModelWithHttpInfo(ModelClient modelClient, int operationIndex = 0); + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// + void TestEndpointParameters(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestEndpointParametersWithHttpInfo(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0); + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// + void TestEnumParameters(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestEnumParametersWithHttpInfo(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0); + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// + void TestGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0); + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestInlineAdditionalProperties(Dictionary requestBody, int operationIndex = 0); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestInlineAdditionalPropertiesWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0); + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// + void TestJsonFormData(string param, string param2, int operationIndex = 0); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestJsonFormDataWithHttpInfo(string param, string param2, int operationIndex = 0); + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestStringMapReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestStringMapReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of HealthCheckResult + System.Threading.Tasks.Task FakeHealthGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (HealthCheckResult) + System.Threading.Tasks.Task> FakeHealthGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of bool + System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (bool) + System.Threading.Tasks.Task> FakeOuterBooleanSerializeWithHttpInfoAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of OuterComposite + System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (OuterComposite) + System.Threading.Tasks.Task> FakeOuterCompositeSerializeWithHttpInfoAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of decimal + System.Threading.Tasks.Task FakeOuterNumberSerializeAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (decimal) + System.Threading.Tasks.Task> FakeOuterNumberSerializeWithHttpInfoAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + System.Threading.Tasks.Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + System.Threading.Tasks.Task> FakeOuterStringSerializeWithHttpInfoAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<OuterEnum> + System.Threading.Tasks.Task> GetArrayOfEnumsAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<OuterEnum>) + System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of MixedAnyOf + System.Threading.Tasks.Task GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MixedAnyOf) + System.Threading.Tasks.Task> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of MixedOneOf + System.Threading.Tasks.Task GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MixedOneOf) + System.Threading.Tasks.Task> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithFileSchemaWithHttpInfoAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestBodyWithQueryParamsAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithQueryParamsWithHttpInfoAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + System.Threading.Tasks.Task TestClientModelAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> TestClientModelWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestEndpointParametersAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestEndpointParametersWithHttpInfoAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestEnumParametersAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestEnumParametersWithHttpInfoAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestGroupParametersAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestGroupParametersWithHttpInfoAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestInlineAdditionalPropertiesWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestJsonFormDataAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestJsonFormDataWithHttpInfoAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestStringMapReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestStringMapReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApi : IFakeApiSync, IFakeApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class FakeApi : IFakeApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public FakeApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public FakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// HealthCheckResult + public HealthCheckResult FakeHealthGet(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeHealthGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of HealthCheckResult + public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.FakeHealthGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake/health", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeHealthGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of HealthCheckResult + public async System.Threading.Tasks.Task FakeHealthGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeHealthGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (HealthCheckResult) + public async System.Threading.Tasks.Task> FakeHealthGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.FakeHealthGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/health", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeHealthGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// bool + public bool FakeOuterBooleanSerialize(bool? body = default(bool?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// ApiResponse of bool + public Org.OpenAPITools.Client.ApiResponse FakeOuterBooleanSerializeWithHttpInfo(bool? body = default(bool?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterBooleanSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/outer/boolean", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of bool + public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterBooleanSerializeWithHttpInfoAsync(body, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (bool) + public async System.Threading.Tasks.Task> FakeOuterBooleanSerializeWithHttpInfoAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterBooleanSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/boolean", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// OuterComposite + public OuterComposite FakeOuterCompositeSerialize(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterCompositeSerializeWithHttpInfo(outerComposite); + return localVarResponse.Data; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// ApiResponse of OuterComposite + public Org.OpenAPITools.Client.ApiResponse FakeOuterCompositeSerializeWithHttpInfo(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = outerComposite; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterCompositeSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/outer/composite", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of OuterComposite + public async System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterCompositeSerializeWithHttpInfoAsync(outerComposite, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (OuterComposite) + public async System.Threading.Tasks.Task> FakeOuterCompositeSerializeWithHttpInfoAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = outerComposite; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterCompositeSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/composite", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// decimal + public decimal FakeOuterNumberSerialize(decimal? body = default(decimal?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// ApiResponse of decimal + public Org.OpenAPITools.Client.ApiResponse FakeOuterNumberSerializeWithHttpInfo(decimal? body = default(decimal?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterNumberSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/outer/number", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of decimal + public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterNumberSerializeWithHttpInfoAsync(body, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (decimal) + public async System.Threading.Tasks.Task> FakeOuterNumberSerializeWithHttpInfoAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterNumberSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/number", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// string + public string FakeOuterStringSerialize(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterStringSerializeWithHttpInfo(requiredStringUuid, body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// ApiResponse of string + public Org.OpenAPITools.Client.ApiResponse FakeOuterStringSerializeWithHttpInfo(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_uuid", requiredStringUuid)); + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterStringSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/outer/string", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterStringSerializeWithHttpInfoAsync(requiredStringUuid, body, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + public async System.Threading.Tasks.Task> FakeOuterStringSerializeWithHttpInfoAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_uuid", requiredStringUuid)); + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterStringSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/string", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<OuterEnum> + public List GetArrayOfEnums(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetArrayOfEnumsWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<OuterEnum> + public Org.OpenAPITools.Client.ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetArrayOfEnums"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get>("/fake/array-of-enums", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetArrayOfEnums", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<OuterEnum> + public async System.Threading.Tasks.Task> GetArrayOfEnumsAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetArrayOfEnumsWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<OuterEnum>) + public async System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetArrayOfEnums"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/fake/array-of-enums", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetArrayOfEnums", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// MixedAnyOf + public MixedAnyOf GetMixedAnyOf(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetMixedAnyOfWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of MixedAnyOf + public Org.OpenAPITools.Client.ApiResponse GetMixedAnyOfWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of MixedAnyOf + public async System.Threading.Tasks.Task GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetMixedAnyOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MixedAnyOf) + public async System.Threading.Tasks.Task> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// MixedOneOf + public MixedOneOf GetMixedOneOf(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetMixedOneOfWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of MixedOneOf + public Org.OpenAPITools.Client.ApiResponse GetMixedOneOfWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of MixedOneOf + public async System.Threading.Tasks.Task GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetMixedOneOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MixedOneOf) + public async System.Threading.Tasks.Task> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + public void TestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = fileSchemaTestClass; + + localVarRequestOptions.Operation = "FakeApi.TestBodyWithFileSchema"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Put("/fake/body-with-file-schema", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestBodyWithFileSchemaWithHttpInfoAsync(fileSchemaTestClass, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithFileSchemaWithHttpInfoAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = fileSchemaTestClass; + + localVarRequestOptions.Operation = "FakeApi.TestBodyWithFileSchema"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/body-with-file-schema", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// + public void TestBodyWithQueryParams(string query, User user, int operationIndex = 0) + { + TestBodyWithQueryParamsWithHttpInfo(query, user); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestBodyWithQueryParamsWithHttpInfo(string query, User user, int operationIndex = 0) + { + // verify the required parameter 'query' is set + if (query == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); + } + + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling FakeApi->TestBodyWithQueryParams"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "FakeApi.TestBodyWithQueryParams"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Put("/fake/body-with-query-params", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestBodyWithQueryParams", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithQueryParamsAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestBodyWithQueryParamsWithHttpInfoAsync(query, user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithQueryParamsWithHttpInfoAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'query' is set + if (query == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); + } + + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling FakeApi->TestBodyWithQueryParams"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "FakeApi.TestBodyWithQueryParams"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/body-with-query-params", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestBodyWithQueryParams", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + public ModelClient TestClientModel(ModelClient modelClient, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClientModelWithHttpInfo(modelClient); + return localVarResponse.Data; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpInfo(ModelClient modelClient, int operationIndex = 0) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeApi->TestClientModel"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "FakeApi.TestClientModel"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Patch("/fake", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestClientModel", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + public async System.Threading.Tasks.Task TestClientModelAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClientModelWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> TestClientModelWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeApi->TestClientModel"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "FakeApi.TestClientModel"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PatchAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestClientModel", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// + public void TestEndpointParameters(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0) + { + TestEndpointParametersWithHttpInfo(number, varDouble, patternWithoutDelimiter, varByte, integer, int32, int64, varFloat, varString, binary, date, dateTime, password, callback); + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestEndpointParametersWithHttpInfo(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0) + { + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); + } + + // verify the required parameter 'varByte' is set + if (varByte == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'varByte' when calling FakeApi->TestEndpointParameters"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (integer != null) + { + localVarRequestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter + } + if (int32 != null) + { + localVarRequestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter + } + if (int64 != null) + { + localVarRequestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter + } + localVarRequestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter + if (varFloat != null) + { + localVarRequestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varFloat)); // form parameter + } + localVarRequestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varDouble)); // form parameter + if (varString != null) + { + localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varString)); // form parameter + } + localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varByte)); // form parameter + if (binary != null) + { + localVarRequestOptions.FileParameters.Add("binary", binary); + } + if (date != null) + { + localVarRequestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter + } + if (dateTime != null) + { + localVarRequestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter + } + if (password != null) + { + localVarRequestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter + } + if (callback != null) + { + localVarRequestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestEndpointParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (http_basic_test) required + // http basic authentication required + if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestEndpointParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestEndpointParametersAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestEndpointParametersWithHttpInfoAsync(number, varDouble, patternWithoutDelimiter, varByte, integer, int32, int64, varFloat, varString, binary, date, dateTime, password, callback, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestEndpointParametersWithHttpInfoAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); + } + + // verify the required parameter 'varByte' is set + if (varByte == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'varByte' when calling FakeApi->TestEndpointParameters"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (integer != null) + { + localVarRequestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter + } + if (int32 != null) + { + localVarRequestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter + } + if (int64 != null) + { + localVarRequestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter + } + localVarRequestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter + if (varFloat != null) + { + localVarRequestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varFloat)); // form parameter + } + localVarRequestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varDouble)); // form parameter + if (varString != null) + { + localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varString)); // form parameter + } + localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varByte)); // form parameter + if (binary != null) + { + localVarRequestOptions.FileParameters.Add("binary", binary); + } + if (date != null) + { + localVarRequestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter + } + if (dateTime != null) + { + localVarRequestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter + } + if (password != null) + { + localVarRequestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter + } + if (callback != null) + { + localVarRequestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestEndpointParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (http_basic_test) required + // http basic authentication required + if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestEndpointParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// + public void TestEnumParameters(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0) + { + TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestEnumParametersWithHttpInfo(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (enumQueryStringArray != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "enum_query_string_array", enumQueryStringArray)); + } + if (enumQueryString != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)); + } + if (enumQueryInteger != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)); + } + if (enumQueryDouble != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); + } + if (enumHeaderStringArray != null) + { + localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + } + if (enumHeaderString != null) + { + localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + } + if (enumFormStringArray != null) + { + localVarRequestOptions.FormParameters.Add("enum_form_string_array", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter + } + if (enumFormString != null) + { + localVarRequestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestEnumParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestEnumParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestEnumParametersAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestEnumParametersWithHttpInfoAsync(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestEnumParametersWithHttpInfoAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (enumQueryStringArray != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "enum_query_string_array", enumQueryStringArray)); + } + if (enumQueryString != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)); + } + if (enumQueryInteger != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)); + } + if (enumQueryDouble != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); + } + if (enumHeaderStringArray != null) + { + localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + } + if (enumHeaderString != null) + { + localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + } + if (enumFormStringArray != null) + { + localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter + } + if (enumFormString != null) + { + localVarRequestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestEnumParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestEnumParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// + public void TestGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0) + { + TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)); + if (stringGroup != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)); + } + if (int64Group != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)); + } + localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter + if (booleanGroup != null) + { + localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestGroupParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (bearer_test) required + // bearer authentication required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Delete("/fake", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestGroupParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestGroupParametersAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestGroupParametersWithHttpInfoAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestGroupParametersWithHttpInfoAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)); + if (stringGroup != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)); + } + if (int64Group != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)); + } + localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter + if (booleanGroup != null) + { + localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestGroupParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (bearer_test) required + // bearer authentication required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestGroupParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestInlineAdditionalProperties(Dictionary requestBody, int operationIndex = 0) + { + TestInlineAdditionalPropertiesWithHttpInfo(requestBody); + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestInlineAdditionalPropertiesWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestInlineAdditionalProperties"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestInlineAdditionalProperties"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/inline-additionalProperties", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestInlineAdditionalPropertiesWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestInlineAdditionalPropertiesWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestInlineAdditionalProperties"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestInlineAdditionalProperties"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/inline-additionalProperties", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0) + { + TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0) + { + // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set + if (testInlineFreeformAdditionalPropertiesRequest == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest; + + localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(testInlineFreeformAdditionalPropertiesRequest, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set + if (testInlineFreeformAdditionalPropertiesRequest == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest; + + localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// + public void TestJsonFormData(string param, string param2, int operationIndex = 0) + { + TestJsonFormDataWithHttpInfo(param, param2); + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo(string param, string param2, int operationIndex = 0) + { + // verify the required parameter 'param' is set + if (param == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter + + localVarRequestOptions.Operation = "FakeApi.TestJsonFormData"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake/jsonFormData", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestJsonFormData", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestJsonFormDataAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestJsonFormDataWithHttpInfoAsync(param, param2, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestJsonFormDataWithHttpInfoAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'param' is set + if (param == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter + + localVarRequestOptions.Operation = "FakeApi.TestJsonFormData"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/jsonFormData", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestJsonFormData", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) + { + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) + { + // verify the required parameter 'pipe' is set + if (pipe == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'http' is set + if (http == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'url' is set + if (url == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'context' is set + if (context == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "pipe", pipe)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } + + localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Put("/fake/test-query-parameters", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'pipe' is set + if (pipe == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'http' is set + if (http == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'url' is set + if (url == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'context' is set + if (context == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "pipe", pipe)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } + + localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/test-query-parameters", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestStringMapReference(Dictionary requestBody, int operationIndex = 0) + { + TestStringMapReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestStringMapReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestStringMapReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestStringMapReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/stringMap-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestStringMapReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestStringMapReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestStringMapReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestStringMapReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestStringMapReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestStringMapReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/stringMap-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestStringMapReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs new file mode 100644 index 000000000000..07c4ad398c66 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -0,0 +1,365 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeClassnameTags123ApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + ModelClient TestClassname(ModelClient modelClient, int operationIndex = 0); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + ApiResponse TestClassnameWithHttpInfo(ModelClient modelClient, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeClassnameTags123ApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + System.Threading.Tasks.Task TestClassnameAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> TestClassnameWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeClassnameTags123Api : IFakeClassnameTags123ApiSync, IFakeClassnameTags123ApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public FakeClassnameTags123Api(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public FakeClassnameTags123Api(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + public ModelClient TestClassname(ModelClient modelClient, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClassnameWithHttpInfo(modelClient); + return localVarResponse.Data; + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + public Org.OpenAPITools.Client.ApiResponse TestClassnameWithHttpInfo(ModelClient modelClient, int operationIndex = 0) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "FakeClassnameTags123Api.TestClassname"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key_query) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); + } + + // make the HTTP request + var localVarResponse = this.Client.Patch("/fake_classname_test", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + public async System.Threading.Tasks.Task TestClassnameAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClassnameWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> TestClassnameWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "FakeClassnameTags123Api.TestClassname"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key_query) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PatchAsync("/fake_classname_test", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/PetApi.cs new file mode 100644 index 000000000000..9769e375ee7f --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/PetApi.cs @@ -0,0 +1,2355 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// + void AddPet(Pet pet, int operationIndex = 0); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse AddPetWithHttpInfo(Pet pet, int operationIndex = 0); + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// + void DeletePet(long petId, string? apiKey = default(string?), int operationIndex = 0); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse DeletePetWithHttpInfo(long petId, string? apiKey = default(string?), int operationIndex = 0); + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// List<Pet> + List FindPetsByStatus(List status, int operationIndex = 0); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// ApiResponse of List<Pet> + ApiResponse> FindPetsByStatusWithHttpInfo(List status, int operationIndex = 0); + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// List<Pet> + [Obsolete] + List FindPetsByTags(List tags, int operationIndex = 0); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// ApiResponse of List<Pet> + [Obsolete] + ApiResponse> FindPetsByTagsWithHttpInfo(List tags, int operationIndex = 0); + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Pet + Pet GetPetById(long petId, int operationIndex = 0); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// ApiResponse of Pet + ApiResponse GetPetByIdWithHttpInfo(long petId, int operationIndex = 0); + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// + void UpdatePet(Pet pet, int operationIndex = 0); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse UpdatePetWithHttpInfo(Pet pet, int operationIndex = 0); + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// + void UpdatePetWithForm(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0); + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// ApiResponse + ApiResponse UploadFile(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithHttpInfo(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0); + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// ApiResponse + ApiResponse UploadFileWithRequiredFile(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task DeletePetAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + [Obsolete] + System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + [Obsolete] + System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Pet + System.Threading.Tasks.Task GetPetByIdAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task UpdatePetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileWithRequiredFileWithHttpInfoAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApi : IPetApiSync, IPetApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class PetApi : IPetApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public PetApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public PetApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// + public void AddPet(Pet pet, int operationIndex = 0) + { + AddPetWithHttpInfo(pet); + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, int operationIndex = 0) + { + // verify the required parameter 'pet' is set + if (pet == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = pet; + + localVarRequestOptions.Operation = "PetApi.AddPet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "POST", "/pet", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/pet", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await AddPetWithHttpInfoAsync(pet, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'pet' is set + if (pet == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = pet; + + localVarRequestOptions.Operation = "PetApi.AddPet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "POST", "/pet", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// + public void DeletePet(long petId, string? apiKey = default(string?), int operationIndex = 0) + { + DeletePetWithHttpInfo(petId, apiKey); + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeletePetWithHttpInfo(long petId, string? apiKey = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (apiKey != null) + { + localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter + } + + localVarRequestOptions.Operation = "PetApi.DeletePet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = this.Client.Delete("/pet/{petId}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task DeletePetAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await DeletePetWithHttpInfoAsync(petId, apiKey, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (apiKey != null) + { + localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter + } + + localVarRequestOptions.Operation = "PetApi.DeletePet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// List<Pet> + public List FindPetsByStatus(List status, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByStatusWithHttpInfo(status); + return localVarResponse.Data; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// ApiResponse of List<Pet> + public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpInfo(List status, int operationIndex = 0) + { + // verify the required parameter 'status' is set + if (status == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); + + localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByStatus", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/pet/findByStatus", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + public async System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByStatusWithHttpInfoAsync(status, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + public async System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'status' is set + if (status == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); + + localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByStatus", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByStatus", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// List<Pet> + [Obsolete] + public List FindPetsByTags(List tags, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByTagsWithHttpInfo(tags); + return localVarResponse.Data; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// ApiResponse of List<Pet> + [Obsolete] + public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo(List tags, int operationIndex = 0) + { + // verify the required parameter 'tags' is set + if (tags == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); + + localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByTags", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/pet/findByTags", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + [Obsolete] + public async System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByTagsWithHttpInfoAsync(tags, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + [Obsolete] + public async System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'tags' is set + if (tags == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); + + localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByTags", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByTags", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Pet + public Pet GetPetById(long petId, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetPetByIdWithHttpInfo(petId); + return localVarResponse.Data; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// ApiResponse of Pet + public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petId, int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + + localVarRequestOptions.Operation = "PetApi.GetPetById"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + // authentication (api_key_query) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); + } + + // make the HTTP request + var localVarResponse = this.Client.Get("/pet/{petId}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Pet + public async System.Threading.Tasks.Task GetPetByIdAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetPetByIdWithHttpInfoAsync(petId, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + public async System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + + localVarRequestOptions.Operation = "PetApi.GetPetById"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + // authentication (api_key_query) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// + public void UpdatePet(Pet pet, int operationIndex = 0) + { + UpdatePetWithHttpInfo(pet); + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet, int operationIndex = 0) + { + // verify the required parameter 'pet' is set + if (pet == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = pet; + + localVarRequestOptions.Operation = "PetApi.UpdatePet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "PUT", "/pet", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = this.Client.Put("/pet", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task UpdatePetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await UpdatePetWithHttpInfoAsync(pet, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'pet' is set + if (pet == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = pet; + + localVarRequestOptions.Operation = "PetApi.UpdatePet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "PUT", "/pet", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// + public void UpdatePetWithForm(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0) + { + UpdatePetWithFormWithHttpInfo(petId, name, status); + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (name != null) + { + localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter + } + if (status != null) + { + localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter + } + + localVarRequestOptions.Operation = "PetApi.UpdatePetWithForm"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/pet/{petId}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await UpdatePetWithFormWithHttpInfoAsync(petId, name, status, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (name != null) + { + localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter + } + if (status != null) + { + localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter + } + + localVarRequestOptions.Operation = "PetApi.UpdatePetWithForm"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// ApiResponse + public ApiResponse UploadFile(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithHttpInfo(petId, additionalMetadata, file); + return localVarResponse.Data; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// ApiResponse of ApiResponse + public Org.OpenAPITools.Client.ApiResponse UploadFileWithHttpInfo(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (file != null) + { + localVarRequestOptions.FileParameters.Add("file", file); + } + + localVarRequestOptions.Operation = "PetApi.UploadFile"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileWithHttpInfoAsync(petId, additionalMetadata, file, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (file != null) + { + localVarRequestOptions.FileParameters.Add("file", file); + } + + localVarRequestOptions.Operation = "PetApi.UploadFile"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// ApiResponse of ApiResponse + public Org.OpenAPITools.Client.ApiResponse UploadFileWithRequiredFileWithHttpInfo(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0) + { + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); + + localVarRequestOptions.Operation = "PetApi.UploadFileWithRequiredFile"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/{petId}/uploadImageWithRequiredFile", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileWithRequiredFileWithHttpInfoAsync(petId, requiredFile, additionalMetadata, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileWithRequiredFileWithHttpInfoAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); + + localVarRequestOptions.Operation = "PetApi.UploadFileWithRequiredFile"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/{petId}/uploadImageWithRequiredFile", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/StoreApi.cs new file mode 100644 index 000000000000..af79df6916fe --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,907 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// + void DeleteOrder(string orderId, int operationIndex = 0); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse DeleteOrderWithHttpInfo(string orderId, int operationIndex = 0); + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Dictionary<string, int> + Dictionary GetInventory(int operationIndex = 0); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Dictionary<string, int> + ApiResponse> GetInventoryWithHttpInfo(int operationIndex = 0); + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Order + Order GetOrderById(long orderId, int operationIndex = 0); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// ApiResponse of Order + ApiResponse GetOrderByIdWithHttpInfo(long orderId, int operationIndex = 0); + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Order + Order PlaceOrder(Order order, int operationIndex = 0); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// ApiResponse of Order + ApiResponse PlaceOrderWithHttpInfo(Order order, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task DeleteOrderAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, int> + System.Threading.Tasks.Task> GetInventoryAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, int>) + System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Order + System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Order + System.Threading.Tasks.Task PlaceOrderAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApi : IStoreApiSync, IStoreApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class StoreApi : IStoreApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public StoreApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public StoreApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// + public void DeleteOrder(string orderId, int operationIndex = 0) + { + 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 + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(string orderId, int operationIndex = 0) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + localVarRequestOptions.Operation = "StoreApi.DeleteOrder"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/store/order/{order_id}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task DeleteOrderAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await DeleteOrderWithHttpInfoAsync(orderId, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + localVarRequestOptions.Operation = "StoreApi.DeleteOrder"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/store/order/{order_id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Dictionary<string, int> + public Dictionary GetInventory(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetInventoryWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Dictionary<string, int> + public Org.OpenAPITools.Client.ApiResponse> GetInventoryWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "StoreApi.GetInventory"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/store/inventory", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, int> + public async System.Threading.Tasks.Task> GetInventoryAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetInventoryWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, int>) + public async System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "StoreApi.GetInventory"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key"))) + { + localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key")); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/store/inventory", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Order + public Order GetOrderById(long orderId, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetOrderByIdWithHttpInfo(orderId); + return localVarResponse.Data; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// ApiResponse of Order + public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long orderId, int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + localVarRequestOptions.Operation = "StoreApi.GetOrderById"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/store/order/{order_id}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Order + public async System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetOrderByIdWithHttpInfoAsync(orderId, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + public async System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + localVarRequestOptions.Operation = "StoreApi.GetOrderById"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/store/order/{order_id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Order + public Order PlaceOrder(Order order, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = PlaceOrderWithHttpInfo(order); + return localVarResponse.Data; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// ApiResponse of Order + public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order order, int operationIndex = 0) + { + // verify the required parameter 'order' is set + if (order == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = order; + + localVarRequestOptions.Operation = "StoreApi.PlaceOrder"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/store/order", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Order + public async System.Threading.Tasks.Task PlaceOrderAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await PlaceOrderWithHttpInfoAsync(order, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + public async System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'order' is set + if (order == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = order; + + localVarRequestOptions.Operation = "StoreApi.PlaceOrder"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/store/order", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/UserApi.cs new file mode 100644 index 000000000000..700610558ef8 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Api/UserApi.cs @@ -0,0 +1,1699 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// + void CreateUser(User user, int operationIndex = 0); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse CreateUserWithHttpInfo(User user, int operationIndex = 0); + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// + void CreateUsersWithArrayInput(List user, int operationIndex = 0); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user, int operationIndex = 0); + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// + void CreateUsersWithListInput(List user, int operationIndex = 0); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse CreateUsersWithListInputWithHttpInfo(List user, int operationIndex = 0); + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// + void DeleteUser(string username, int operationIndex = 0); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse DeleteUserWithHttpInfo(string username, int operationIndex = 0); + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// User + User GetUserByName(string username, int operationIndex = 0); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// ApiResponse of User + ApiResponse GetUserByNameWithHttpInfo(string username, int operationIndex = 0); + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// string + string LoginUser(string username, string password, int operationIndex = 0); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// ApiResponse of string + ApiResponse LoginUserWithHttpInfo(string username, string password, int operationIndex = 0); + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// + void LogoutUser(int operationIndex = 0); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse LogoutUserWithHttpInfo(int operationIndex = 0); + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// + void UpdateUser(string username, User user, int operationIndex = 0); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse UpdateUserWithHttpInfo(string username, User user, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task CreateUserAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task DeleteUserAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of User + System.Threading.Tasks.Task GetUserByNameAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (User) + System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + System.Threading.Tasks.Task LoginUserAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task LogoutUserAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task UpdateUserAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApi : IUserApiSync, IUserApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class UserApi : IUserApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public UserApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public UserApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// + public void CreateUser(User user, int operationIndex = 0) + { + CreateUserWithHttpInfo(user); + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User user, int operationIndex = 0) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/user", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task CreateUserAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await CreateUserWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/user", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// + public void CreateUsersWithArrayInput(List user, int operationIndex = 0) + { + CreateUsersWithArrayInputWithHttpInfo(user); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user, int operationIndex = 0) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUsersWithArrayInput"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/user/createWithArray", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await CreateUsersWithArrayInputWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUsersWithArrayInput"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithArray", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// + public void CreateUsersWithListInput(List user, int operationIndex = 0) + { + CreateUsersWithListInputWithHttpInfo(user); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithHttpInfo(List user, int operationIndex = 0) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUsersWithListInput"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/user/createWithList", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await CreateUsersWithListInputWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUsersWithListInput"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithList", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// + public void DeleteUser(string username, int operationIndex = 0) + { + DeleteUserWithHttpInfo(username); + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string username, int operationIndex = 0) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + localVarRequestOptions.Operation = "UserApi.DeleteUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/user/{username}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task DeleteUserAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await DeleteUserWithHttpInfoAsync(username, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + localVarRequestOptions.Operation = "UserApi.DeleteUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// User + public User GetUserByName(string username, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetUserByNameWithHttpInfo(username); + return localVarResponse.Data; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// ApiResponse of User + public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(string username, int operationIndex = 0) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + localVarRequestOptions.Operation = "UserApi.GetUserByName"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/user/{username}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of User + public async System.Threading.Tasks.Task GetUserByNameAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetUserByNameWithHttpInfoAsync(username, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (User) + public async System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + localVarRequestOptions.Operation = "UserApi.GetUserByName"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// string + public string LoginUser(string username, string password, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = LoginUserWithHttpInfo(username, password); + return localVarResponse.Data; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// ApiResponse of string + public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string username, string password, int operationIndex = 0) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); + + localVarRequestOptions.Operation = "UserApi.LoginUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/user/login", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + public async System.Threading.Tasks.Task LoginUserAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await LoginUserWithHttpInfoAsync(username, password, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + public async System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); + + localVarRequestOptions.Operation = "UserApi.LoginUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/user/login", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// + public void LogoutUser(int operationIndex = 0) + { + LogoutUserWithHttpInfo(); + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "UserApi.LogoutUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/user/logout", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task LogoutUserAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await LogoutUserWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "UserApi.LogoutUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/user/logout", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// + public void UpdateUser(string username, User user, int operationIndex = 0) + { + UpdateUserWithHttpInfo(username, user); + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string username, User user, int operationIndex = 0) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + } + + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.UpdateUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Put("/user/{username}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task UpdateUserAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await UpdateUserWithHttpInfoAsync(username, user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + } + + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.UpdateUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs new file mode 100644 index 000000000000..332389566469 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs @@ -0,0 +1,838 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp; +using RestSharp.Serializers; +using RestSharpMethod = RestSharp.Method; +using FileIO = System.IO.File; +using Polly; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer + { + private readonly IReadableConfiguration _configuration; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); + + public T Deserialize(RestResponse response) + { + var result = (T)Deserialize(response, typeof(T)); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(RestResponse response, Type type) + { + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = response.RawBytes; + if (response.Headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? global::System.IO.Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in response.Headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + FileIO.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public ISerializer Serializer => this; + public IDeserializer Deserializer => this; + + public string[] AcceptedContentTypes => ContentType.JsonAccept; + + public SupportsContentType SupportsContentType => contentType => + contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || + contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); + + public ContentType ContentType { get; set; } = ContentType.Json; + + public DataFormat DataFormat => DataFormat.Json; + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(RestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(RestRequest request, RestResponse response); + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = GlobalConfiguration.Instance.BasePath; + } + + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + _baseUrl = basePath; + } + + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.Get; + break; + case HttpMethod.Post: + other = RestSharpMethod.Post; + break; + case HttpMethod.Put: + other = RestSharpMethod.Put; + break; + case HttpMethod.Delete: + other = RestSharpMethod.Delete; + break; + case HttpMethod.Head: + other = RestSharpMethod.Head; + break; + case HttpMethod.Options: + other = RestSharpMethod.Options; + break; + case HttpMethod.Patch: + other = RestSharpMethod.Patch; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + + return other; + } + + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. + /// Here, it is simply mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + RestRequest request = new RestRequest(path, Method(method)); + + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.AddHeader(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + + if (options.Data != null) + { + if (options.Data is Stream stream) + { + var contentType = "application/octet-stream"; + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes[0]; + } + + var bytes = ClientUtils.ReadAsBytes(stream); + request.AddParameter(contentType, bytes, ParameterType.RequestBody); + } + else + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + + request.AddJsonBody(options.Data); + } + } + + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var bytes = ClientUtils.ReadAsBytes(file); + var fileStream = file as FileStream; + if (fileStream != null) + request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); + else + request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); + } + } + } + + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + + return request; + } + + /// + /// Transforms a RestResponse instance into a new ApiResponse instance. + /// At this point, we have a concrete http response from the service. + /// Here, it is simply mapped into the [public] ApiResponse object. + /// + /// The RestSharp response object + /// A new ApiResponse instance. + private ApiResponse ToApiResponse(RestResponse response) + { + T result = response.Data; + string rawContent = response.Content; + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.ContentHeaders != null) + { + foreach (var responseHeader in response.ContentHeaders) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies.Cast()) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + + return transformed; + } + + /// + /// Executes the HTTP request for the current service. + /// Based on functions received it can be async or sync. + /// + /// Local function that executes http request and returns http response. + /// Local function to specify options for the service. + /// The RestSharp request object + /// The RestSharp options object + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// A new ApiResponse instance. + private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; + var clientOptions = new RestClientOptions(baseUrl) + { + ClientCertificates = configuration.ClientCertificates, + Timeout = configuration.Timeout, + Proxy = configuration.Proxy, + UserAgent = configuration.UserAgent, + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback + }; + setOptions(clientOptions); + + if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(configuration.OAuthClientId) && + !string.IsNullOrEmpty(configuration.OAuthClientSecret) && + configuration.OAuthFlow != null) + { + clientOptions.Authenticator = new OAuthAuthenticator( + configuration.OAuthTokenUrl, + configuration.OAuthClientId, + configuration.OAuthClientSecret, + configuration.OAuthScope, + configuration.OAuthFlow, + SerializerSettings, + configuration); + } + + using (RestClient client = new RestClient(clientOptions, + configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) + { + InterceptRequest(request); + + RestResponse response = await getResponse(client); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + try + { + response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + catch (Exception ex) + { + throw ex.InnerException != null ? ex.InnerException : ex; + } + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + else if (typeof(T).Name == "Byte[]") // for byte response + { + response.Data = (T)(object)response.RawBytes; + } + else if (typeof(T).Name == "String") // for string response + { + response.Data = (T)(object)response.Content; + } + + InterceptResponse(request, response); + + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies.Cast()) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + } + + private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) + { + if (policyResult.Outcome == OutcomeType.Successful) + { + return await client.Deserialize(policyResult.Result, cancellationToken); + } + else + { + return new RestResponse(request) + { + ErrorException = policyResult.FinalException + }; + } + } + + private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + Action setOptions = (clientOptions) => + { + var cookies = new CookieContainer(); + + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + cookies.Add(new Cookie(cookie.Name, cookie.Value)); + } + } + clientOptions.CookieContainer = cookies; + }; + + Func>> getResponse = (client) => + { + if (RetryConfiguration.RetryPolicy != null) + { + var policy = RetryConfiguration.RetryPolicy; + var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); + return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); + } + else + { + return Task.FromResult(client.Execute(request)); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); + } + + private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) + { + Action setOptions = (clientOptions) => + { + //no extra options + }; + + Func>> getResponse = async (client) => + { + if (RetryConfiguration.AsyncRetryPolicy != null) + { + var policy = RetryConfiguration.AsyncRetryPolicy; + var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); + return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); + } + else + { + return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration); + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); + } + #endregion ISynchronousClient + } +} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiException.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiException.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiException.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiResponse.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ApiResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ClientUtils.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ClientUtils.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ClientUtils.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ExceptionFactory.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ExceptionFactory.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ExceptionFactory.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ExceptionFactory.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/GlobalConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/GlobalConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/GlobalConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/HttpMethod.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/HttpMethod.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/HttpMethod.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/HttpMethod.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs new file mode 100644 index 000000000000..c362a4f50519 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -0,0 +1,806 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Cryptography; +using System.Text; +using System.Web; + +namespace Org.OpenAPITools.Client +{ + /// + /// Class for HttpSigning auth related parameter and methods + /// + public class HttpSigningConfiguration + { + /// + /// Initialize the HashAlgorithm and SigningAlgorithm to default value + /// + public HttpSigningConfiguration() + { + HashAlgorithm = HashAlgorithmName.SHA256; + SigningAlgorithm = "PKCS1-v15"; + } + + /// + ///Gets the Api keyId + /// + public string KeyId { get; set; } + + /// + /// Gets the Key file path + /// + public string KeyFilePath { get; set; } + + /// + /// Specify the API key in the form of a string, either configure the KeyString property or configure the KeyFilePath property. + /// + public string KeyString { get; set; } + + /// + /// Gets the key pass phrase for password protected key + /// + public SecureString KeyPassPhrase { get; set; } + + /// + /// Gets the HTTP signing header + /// + public List HttpSigningHeader { get; set; } + + /// + /// Gets the hash algorithm sha256 or sha512 + /// + public HashAlgorithmName HashAlgorithm { get; set; } + + /// + /// Gets the signing algorithm + /// + public string SigningAlgorithm { get; set; } + + /// + /// Gets the Signature validity period in seconds + /// + public int SignatureValidityPeriod { get; set; } + + private enum PrivateKeyType + { + None = 0, + RSA = 1, + ECDSA = 2, + } + + /// + /// Gets the Headers for HttpSigning + /// + /// Base path + /// HTTP method + /// Path + /// Request options + /// Http signed headers + public Dictionary GetHttpSignedHeader(string basePath,string method, string path, RequestOptions requestOptions) + { + const string HEADER_REQUEST_TARGET = "(request-target)"; + //The time when the HTTP signature expires. The API server should reject HTTP requests + //that have expired. + const string HEADER_EXPIRES = "(expires)"; + //The 'Date' header. + const string HEADER_DATE = "Date"; + //The 'Host' header. + const string HEADER_HOST = "Host"; + //The time when the HTTP signature was generated. + const string HEADER_CREATED = "(created)"; + //When the 'Digest' header is included in the HTTP signature, the client automatically + //computes the digest of the HTTP request body, per RFC 3230. + const string HEADER_DIGEST = "Digest"; + //The 'Authorization' header is automatically generated by the client. It includes + //the list of signed headers and a base64-encoded signature. + const string HEADER_AUTHORIZATION = "Authorization"; + + //Read the api key from the file + if(File.Exists(KeyFilePath)) + { + this.KeyString = ReadApiKeyFromFile(KeyFilePath); + } + else if(string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided. Supply it using either KeyFilePath or KeyString"); + } + + //Hash table to store singed headers + var HttpSignedRequestHeader = new Dictionary(); + var HttpSignatureHeader = new Dictionary(); + + if (HttpSigningHeader.Count == 0) + { + HttpSigningHeader.Add("(created)"); + } + + if (requestOptions.PathParameters != null) + { + foreach (var pathParam in requestOptions.PathParameters) + { + var tempPath = path.Replace(pathParam.Key, "0"); + path = string.Format(tempPath, pathParam.Value); + } + } + + var httpValues = HttpUtility.ParseQueryString(string.Empty); + foreach (var parameter in requestOptions.QueryParameters) + { +#if (NETCOREAPP) + if (parameter.Value.Count > 1) + { // array + foreach (var value in parameter.Value) + { + httpValues.Add(HttpUtility.UrlEncode(parameter.Key) + "[]", value); + } + } + else + { + httpValues.Add(HttpUtility.UrlEncode(parameter.Key), parameter.Value[0]); + } +#else + if (parameter.Value.Count > 1) + { // array + foreach (var value in parameter.Value) + { + httpValues.Add(parameter.Key + "[]", value); + } + } + else + { + httpValues.Add(parameter.Key, parameter.Value[0]); + } +#endif + } + var uriBuilder = new UriBuilder(string.Concat(basePath, path)); + uriBuilder.Query = httpValues.ToString().Replace("+", "%20"); + + var dateTime = DateTime.Now; + string Digest = string.Empty; + + //get the body + string requestBody = string.Empty; + if (requestOptions.Data != null) + { + var serializerSettings = new JsonSerializerSettings(); + requestBody = JsonConvert.SerializeObject(requestOptions.Data, serializerSettings); + } + + if (HashAlgorithm == HashAlgorithmName.SHA256) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + Digest = string.Format("SHA-256={0}", Convert.ToBase64String(bodyDigest)); + } + else if (HashAlgorithm == HashAlgorithmName.SHA512) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + Digest = string.Format("SHA-512={0}", Convert.ToBase64String(bodyDigest)); + } + else + { + throw new Exception(string.Format("{0} not supported", HashAlgorithm)); + } + + foreach (var header in HttpSigningHeader) + { + if (header.Equals(HEADER_REQUEST_TARGET)) + { + var targetUrl = string.Format("{0} {1}{2}", method.ToLower(), uriBuilder.Path, uriBuilder.Query); + HttpSignatureHeader.Add(header.ToLower(), targetUrl); + } + else if (header.Equals(HEADER_EXPIRES)) + { + var expireDateTime = dateTime.AddSeconds(SignatureValidityPeriod); + HttpSignatureHeader.Add(header.ToLower(), GetUnixTime(expireDateTime).ToString()); + } + else if (header.Equals(HEADER_DATE)) + { + var utcDateTime = dateTime.ToUniversalTime().ToString("r"); + HttpSignatureHeader.Add(header.ToLower(), utcDateTime); + HttpSignedRequestHeader.Add(HEADER_DATE, utcDateTime); + } + else if (header.Equals(HEADER_HOST)) + { + HttpSignatureHeader.Add(header.ToLower(), uriBuilder.Host); + HttpSignedRequestHeader.Add(HEADER_HOST, uriBuilder.Host); + } + else if (header.Equals(HEADER_CREATED)) + { + HttpSignatureHeader.Add(header.ToLower(), GetUnixTime(dateTime).ToString()); + } + else if (header.Equals(HEADER_DIGEST)) + { + HttpSignedRequestHeader.Add(HEADER_DIGEST, Digest); + HttpSignatureHeader.Add(header.ToLower(), Digest); + } + else + { + bool isHeaderFound = false; + foreach (var item in requestOptions.HeaderParameters) + { + if (string.Equals(item.Key, header, StringComparison.OrdinalIgnoreCase)) + { + HttpSignatureHeader.Add(header.ToLower(), item.Value.ToString()); + isHeaderFound = true; + break; + } + } + if (!isHeaderFound) + { + throw new Exception(string.Format("Cannot sign HTTP request.Request does not contain the {0} header.",header)); + } + } + + } + var headersKeysString = string.Join(" ", HttpSignatureHeader.Keys); + var headerValuesList = new List(); + + foreach (var keyVal in HttpSignatureHeader) + { + headerValuesList.Add(string.Format("{0}: {1}", keyVal.Key, keyVal.Value)); + } + //Concatenate headers value separated by new line + var headerValuesString = string.Join("\n", headerValuesList); + var signatureStringHash = GetStringHash(HashAlgorithm, headerValuesString); + string headerSignatureStr = null; + var keyType = GetKeyType(KeyString); + + if (keyType == PrivateKeyType.RSA) + { + headerSignatureStr = GetRSASignature(signatureStringHash); + } + else if (keyType == PrivateKeyType.ECDSA) + { + headerSignatureStr = GetECDSASignature(signatureStringHash); + } + else + { + throw new Exception(string.Format("Private key type {0} not supported", keyType)); + } + const string cryptographicScheme = "hs2019"; + var authorizationHeaderValue = string.Format("Signature keyId=\"{0}\",algorithm=\"{1}\"", + KeyId, cryptographicScheme); + + if (HttpSignatureHeader.ContainsKey(HEADER_CREATED)) + { + authorizationHeaderValue += string.Format(",created={0}", HttpSignatureHeader[HEADER_CREATED]); + } + + if (HttpSignatureHeader.ContainsKey(HEADER_EXPIRES)) + { + authorizationHeaderValue += string.Format(",expires={0}", HttpSignatureHeader[HEADER_EXPIRES]); + } + + authorizationHeaderValue += string.Format(",headers=\"{0}\",signature=\"{1}\"", + headersKeysString, headerSignatureStr); + HttpSignedRequestHeader.Add(HEADER_AUTHORIZATION, authorizationHeaderValue); + return HttpSignedRequestHeader; + } + + private byte[] GetStringHash(HashAlgorithmName hashAlgorithmName, string stringToBeHashed) + { + HashAlgorithm? hashAlgorithm = null; + + if (hashAlgorithmName == HashAlgorithmName.SHA1) + hashAlgorithm = SHA1.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA256) + hashAlgorithm = SHA256.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA512) + hashAlgorithm = SHA512.Create(); + + if (hashAlgorithmName == HashAlgorithmName.MD5) + hashAlgorithm = MD5.Create(); + + if (hashAlgorithm == null) + throw new NullReferenceException($"{ nameof(hashAlgorithm) } was null."); + + byte[] bytes = Encoding.UTF8.GetBytes(stringToBeHashed); + byte[] stringHash = hashAlgorithm.ComputeHash(bytes); + return stringHash; + } + + private int GetUnixTime(DateTime date2) + { + DateTime date1 = new DateTime(1970, 01, 01); + TimeSpan timeSpan = date2 - date1; + return (int)timeSpan.TotalSeconds; + } + + private string GetRSASignature(byte[] stringToSign) + { + if (string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + RSA rsa = GetRSAProviderFromPemFile(KeyString, KeyPassPhrase); + if (SigningAlgorithm == "RSASSA-PSS") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pss); + return Convert.ToBase64String(signedbytes); + } + else if (SigningAlgorithm == "PKCS1-v15") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pkcs1); + return Convert.ToBase64String(signedbytes); + } + else + { + return string.Empty; + } + } + + /// + /// Gets the ECDSA signature + /// + /// + /// ECDSA signature + private string GetECDSASignature(byte[] dataToSign) + { + if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + var keyStr = KeyString; + const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + { + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; + } + + /// + /// Convert ANS1 format to DER format. Not recommended to use because it generate invalid signature occasionally. + /// + /// + /// + private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) + { + var derBytes = new List(); + byte derLength = 68; //default length for ECDSA code signing bit 0x44 + byte rbytesLength = 32; //R length 0x20 + byte sbytesLength = 32; //S length 0x20 + var rBytes = new List(); + var sBytes = new List(); + for (int i = 0; i < 32; i++) + { + rBytes.Add(signedBytes[i]); + } + for (int i = 32; i < 64; i++) + { + sBytes.Add(signedBytes[i]); + } + + if (rBytes[0] > 0x7F) + { + derLength++; + rbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(rBytes); + rBytes.Clear(); + rBytes.Add(0x00); + rBytes.AddRange(tempBytes); + } + + if (sBytes[0] > 0x7F) + { + derLength++; + sbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(sBytes); + sBytes.Clear(); + sBytes.Add(0x00); + sBytes.AddRange(tempBytes); + + } + + derBytes.Add(48); //start of the sequence 0x30 + derBytes.Add(derLength); //total length r length, type and r bytes + + derBytes.Add(2); //tag for integer + derBytes.Add(rbytesLength); //length of r + derBytes.AddRange(rBytes); + + derBytes.Add(2); //tag for integer + derBytes.Add(sbytesLength); //length of s + derBytes.AddRange(sBytes); + return derBytes.ToArray(); + } + + private RSACryptoServiceProvider GetRSAProviderFromPemFile(string keyString, SecureString keyPassPhrase = null) + { + if (string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + const string pempubheader = "-----BEGIN PUBLIC KEY-----"; + const string pempubfooter = "-----END PUBLIC KEY-----"; + bool isPrivateKeyFile = true; + byte[] pemkey = null; + string pemstr = keyString; + + if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) + { + isPrivateKeyFile = false; + } + + if (isPrivateKeyFile) + { + pemkey = ConvertPrivateKeyToBytes(pemstr, keyPassPhrase); + if (pemkey == null) + { + return null; + } + return DecodeRSAPrivateKey(pemkey); + } + return null; + } + + private byte[] ConvertPrivateKeyToBytes(string instr, SecureString keyPassPhrase = null) + { + const string pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; + const string pemprivfooter = "-----END RSA PRIVATE KEY-----"; + string pemstr = instr.Trim(); + byte[] binkey; + + if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) + { + return null; + } + + StringBuilder sb = new StringBuilder(pemstr); + sb.Replace(pemprivheader, ""); + sb.Replace(pemprivfooter, ""); + string pvkstr = sb.ToString().Trim(); + + try + { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key + binkey = Convert.FromBase64String(pvkstr); + return binkey; + } + catch (global::System.FormatException) + { + StringReader str = new StringReader(pvkstr); + + //-------- read PEM encryption info. lines and extract salt ----- + if (!str.ReadLine().StartsWith("Proc-Type: 4,ENCRYPTED")) + { + return null; + } + string saltline = str.ReadLine(); + if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) + { + return null; + } + string saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); + byte[] salt = new byte[saltstr.Length / 2]; + for (int i = 0; i < salt.Length; i++) + salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); + if (str.ReadLine() != "") + { + return null; + } + + //------ remaining b64 data is encrypted RSA key ---- + string encryptedstr = str.ReadToEnd(); + + try + { //should have b64 encrypted RSA key now + binkey = Convert.FromBase64String(encryptedstr); + } + catch (global::System.FormatException) + { //data is not in base64 format + return null; + } + + byte[] deskey = GetEncryptedKey(salt, keyPassPhrase, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes + if (deskey == null) + { + return null; + } + + //------ Decrypt the encrypted 3des-encrypted RSA private key ------ + byte[] rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV + return rsakey; + } + } + + private RSACryptoServiceProvider DecodeRSAPrivateKey(byte[] privkey) + { + byte[] bytesModulus, bytesE, bytesD, bytesP, bytesQ, bytesDP, bytesDQ, bytesIQ; + + // --------- Set up stream to decode the asn.1 encoded RSA private key ------ + MemoryStream mem = new MemoryStream(privkey); + BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading + byte bt = 0; + ushort twobytes = 0; + int elems = 0; + try + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + { + binr.ReadByte(); //advance 1 byte + } + else if (twobytes == 0x8230) + { + binr.ReadInt16(); //advance 2 bytes + } + else + { + return null; + } + + twobytes = binr.ReadUInt16(); + if (twobytes != 0x0102) //version number + { + return null; + } + bt = binr.ReadByte(); + if (bt != 0x00) + { + return null; + } + + //------ all private key components are Integer sequences ---- + elems = GetIntegerSize(binr); + bytesModulus = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesE = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesD = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesDP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesDQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesIQ = binr.ReadBytes(elems); + + // ------- create RSACryptoServiceProvider instance and initialize with public key ----- + RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); + RSAParameters RSAparams = new RSAParameters(); + RSAparams.Modulus = bytesModulus; + RSAparams.Exponent = bytesE; + RSAparams.D = bytesD; + RSAparams.P = bytesP; + RSAparams.Q = bytesQ; + RSAparams.DP = bytesDP; + RSAparams.DQ = bytesDQ; + RSAparams.InverseQ = bytesIQ; + RSA.ImportParameters(RSAparams); + return RSA; + } + catch (Exception) + { + return null; + } + finally + { + binr.Close(); + } + } + + private int GetIntegerSize(BinaryReader binr) + { + byte bt = 0; + byte lowbyte = 0x00; + byte highbyte = 0x00; + int count = 0; + bt = binr.ReadByte(); + if (bt != 0x02) //expect integer + { + return 0; + } + bt = binr.ReadByte(); + + if (bt == 0x81) + { + count = binr.ReadByte(); // data size in next byte + } + else if (bt == 0x82) + { + highbyte = binr.ReadByte(); // data size in next 2 bytes + lowbyte = binr.ReadByte(); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; + count = BitConverter.ToInt32(modint, 0); + } + else + { + count = bt; // we already have the data size + } + while (binr.ReadByte() == 0x00) + { + //remove high order zeros in data + count -= 1; + } + binr.BaseStream.Seek(-1, SeekOrigin.Current); + //last ReadByte wasn't a removed zero, so back up a byte + return count; + } + + private byte[] GetEncryptedKey(byte[] salt, SecureString secpswd, int count, int miter) + { + IntPtr unmanagedPswd = IntPtr.Zero; + const int HASHLENGTH = 16; //MD5 bytes + byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store concatenated Mi hashed results + + byte[] psbytes = new byte[secpswd.Length]; + unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); + Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); + Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); + + // --- concatenate salt and pswd bytes into fixed data array --- + byte[] data00 = new byte[psbytes.Length + salt.Length]; + Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes + Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes + + // ---- do multi-hashing and concatenate results D1, D2 ... into keymaterial bytes ---- + MD5 md5 = MD5.Create(); + byte[] result = null; + byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget + + for (int j = 0; j < miter; j++) + { + // ---- Now hash consecutively for count times ------ + if (j == 0) + { + result = data00; //initialize + } + else + { + Array.Copy(result, hashtarget, result.Length); + Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); + result = hashtarget; + } + + for (int i = 0; i < count; i++) + { + result = md5.ComputeHash(result); + } + Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //concatenate to keymaterial + } + byte[] deskey = new byte[24]; + Array.Copy(keymaterial, deskey, deskey.Length); + + Array.Clear(psbytes, 0, psbytes.Length); + Array.Clear(data00, 0, data00.Length); + Array.Clear(result, 0, result.Length); + Array.Clear(hashtarget, 0, hashtarget.Length); + Array.Clear(keymaterial, 0, keymaterial.Length); + return deskey; + } + + private byte[] DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) + { + MemoryStream memst = new MemoryStream(); + TripleDES alg = TripleDES.Create(); + alg.Key = desKey; + alg.IV = IV; + try + { + CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); + cs.Write(cipherData, 0, cipherData.Length); + cs.Close(); + } + catch (Exception) + { + return null; + } + byte[] decryptedData = memst.ToArray(); + return decryptedData; + } + + /// + /// Detect the key type from the pem file. + /// + /// api key in string format + /// Private Key Type + private PrivateKeyType GetKeyType(string keyString) + { + string[] key = null; + + if (string.IsNullOrEmpty(keyString)) + { + throw new Exception("No API key has been provided."); + } + + const string ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY"; + const string ecPrivateKeyFooter = "END EC PRIVATE KEY"; + const string rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY"; + const string rsaPrivateFooter = "END RSA PRIVATE KEY"; + //var pkcs8Header = "BEGIN PRIVATE KEY"; + //var pkcs8Footer = "END PRIVATE KEY"; + PrivateKeyType keyType; + key = KeyString.TrimEnd().Split('\n'); + + if (key[0].Contains(rsaPrivateKeyHeader) && + key[key.Length - 1].ToString().Contains(rsaPrivateFooter)) + { + keyType = PrivateKeyType.RSA; + } + else if (key[0].Contains(ecPrivateKeyHeader) && + key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + { + keyType = PrivateKeyType.ECDSA; + } + else + { + throw new Exception("The key file path does not exist or key is invalid or key is not supported"); + } + return keyType; + } + + /// + /// Read the api key form the api key file path and stored it in KeyString property. + /// + /// api key file path + private string ReadApiKeyFromFile(string apiKeyFilePath) + { + string apiKeyString = null; + + if(File.Exists(apiKeyFilePath)) + { + apiKeyString = File.ReadAllText(apiKeyFilePath); + } + else + { + throw new Exception("Provided API key file path does not exists."); + } + return apiKeyString; + } + } +} diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IApiAccessor.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/IApiAccessor.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IApiAccessor.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/IApiAccessor.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IAsynchronousClient.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/IAsynchronousClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IAsynchronousClient.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/IAsynchronousClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ISynchronousClient.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ISynchronousClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ISynchronousClient.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/ISynchronousClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Multimap.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Multimap.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Multimap.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/Multimap.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/RequestOptions.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/RequestOptions.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/RequestOptions.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/RequestOptions.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Activity.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Activity.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Activity.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Animal.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Animal.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Animal.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ApiResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ApiResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ApiResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Apple.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Apple.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Apple.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/AppleReq.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/AppleReq.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/AppleReq.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ArrayTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ArrayTest.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ArrayTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Banana.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Banana.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Banana.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/BananaReq.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/BananaReq.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/BananaReq.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/BasquePig.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/BasquePig.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/BasquePig.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Capitalization.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Capitalization.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Capitalization.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Cat.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Cat.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Cat.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Category.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Category.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Category.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ChildCat.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ChildCat.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ChildCat.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ClassModel.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ClassModel.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ClassModel.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/DanishPig.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/DanishPig.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/DanishPig.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/DateOnlyClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/DateOnlyClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/DateOnlyClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/DeprecatedObject.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/DeprecatedObject.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/DeprecatedObject.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Dog.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Dog.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Dog.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Drawing.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Drawing.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Drawing.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/EnumArrays.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/EnumArrays.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/EnumArrays.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/EnumClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/EnumClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/EnumClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/EnumTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/EnumTest.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/EnumTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/EquilateralTriangle.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/EquilateralTriangle.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/EquilateralTriangle.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/File.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/File.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/File.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Foo.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Foo.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Foo.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/FormatTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/FormatTest.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/FormatTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Fruit.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Fruit.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Fruit.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/FruitReq.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/FruitReq.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/FruitReq.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/GmFruit.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/GmFruit.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/GmFruit.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/GrandparentAnimal.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/GrandparentAnimal.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/GrandparentAnimal.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/HealthCheckResult.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/HealthCheckResult.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/HealthCheckResult.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/List.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/List.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/List.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/LiteralStringClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/LiteralStringClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/LiteralStringClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Mammal.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Mammal.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MapTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MapTest.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MapTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedAnyOf.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedAnyOf.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedAnyOf.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedOneOf.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedOneOf.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedOneOf.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedOneOfContent.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedOneOfContent.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedOneOfContent.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedOneOfContent.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedSubId.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/MixedSubId.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/MixedSubId.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Model200Response.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Model200Response.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Model200Response.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ModelClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ModelClient.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ModelClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Name.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Name.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Name.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NullableClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NullableClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NullableClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NullableGuidClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NullableGuidClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NullableGuidClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NullableShape.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NullableShape.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NullableShape.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NumberOnly.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/NumberOnly.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/NumberOnly.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OneOfString.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OneOfString.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OneOfString.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Order.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Order.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Order.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterComposite.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterComposite.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterComposite.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnum.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnum.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnum.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumInteger.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumInteger.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumInteger.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumTest.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/OuterEnumTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ParentPet.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ParentPet.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ParentPet.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Pet.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Pet.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Pet.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Pig.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Pig.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Pig.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/PolymorphicProperty.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/PolymorphicProperty.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/PolymorphicProperty.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Quadrilateral.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Quadrilateral.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Quadrilateral.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/RequiredClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/RequiredClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/RequiredClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Return.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Return.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Return.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/RolesReportsHash.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/RolesReportsHash.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/RolesReportsHash.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ScaleneTriangle.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ScaleneTriangle.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ScaleneTriangle.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Shape.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Shape.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Shape.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ShapeInterface.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ShapeInterface.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ShapeInterface.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ShapeOrNull.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ShapeOrNull.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ShapeOrNull.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/SpecialModelName.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/SpecialModelName.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/SpecialModelName.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Tag.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Tag.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Tag.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Triangle.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Triangle.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Triangle.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/TriangleInterface.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/TriangleInterface.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/TriangleInterface.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/User.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/User.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/User.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Whale.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Whale.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Whale.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Zebra.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/Zebra.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/Zebra.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs rename to samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..9c6388725ca5 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/EnumMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,36 @@ + + + + false + net8.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + annotations + false + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.gitignore b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.openapi-generator-ignore b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/.openapi-generator/FILES b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.openapi-generator/FILES similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/.openapi-generator/FILES rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.openapi-generator/FILES diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.openapi-generator/VERSION b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/Org.OpenAPITools.sln b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/README.md b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/README.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/README.md rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/README.md diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/api/openapi.yaml similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/api/openapi.yaml rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/api/openapi.yaml diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/appveyor.yml b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/docs/Env.md b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/docs/Env.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/docs/Env.md rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/docs/Env.md diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/docs/FakeApi.md b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/docs/FakeApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/docs/FakeApi.md rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/docs/FakeApi.md diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/docs/PropertyNameMapping.md b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/docs/PropertyNameMapping.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/docs/PropertyNameMapping.md rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/docs/PropertyNameMapping.md diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/git_push.sh b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/git_push.sh similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/EnumMappings/git_push.sh rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/git_push.sh diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Model/EnvTests.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools.Test/Model/EnvTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Model/EnvTests.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools.Test/Model/EnvTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Model/PropertyNameMappingTests.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools.Test/Model/PropertyNameMappingTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools.Test/Model/PropertyNameMappingTests.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools.Test/Model/PropertyNameMappingTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..64ebed26518e --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net8.0 + false + annotations + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Api/FakeApi.cs new file mode 100644 index 000000000000..621402b02c83 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Api/FakeApi.cs @@ -0,0 +1,403 @@ +/* + * Dummy + * + * To test name, parameter mapping options + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// parameter name mapping test + /// + /// Thrown when fails to make API call + /// _type + /// type + /// type_ + /// http debug option (to test parameter naming option) + /// Index associated with the operation. + /// Env + Env GetParameterNameMapping(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0); + + /// + /// parameter name mapping test + /// + /// + /// + /// + /// Thrown when fails to make API call + /// _type + /// type + /// type_ + /// http debug option (to test parameter naming option) + /// Index associated with the operation. + /// ApiResponse of Env + ApiResponse GetParameterNameMappingWithHttpInfo(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// parameter name mapping test + /// + /// + /// + /// + /// Thrown when fails to make API call + /// _type + /// type + /// type_ + /// http debug option (to test parameter naming option) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Env + System.Threading.Tasks.Task GetParameterNameMappingAsync(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// parameter name mapping test + /// + /// + /// + /// + /// Thrown when fails to make API call + /// _type + /// type + /// type_ + /// http debug option (to test parameter naming option) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Env) + System.Threading.Tasks.Task> GetParameterNameMappingWithHttpInfoAsync(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApi : IFakeApiSync, IFakeApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class FakeApi : IFakeApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public FakeApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public FakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// parameter name mapping test + /// + /// Thrown when fails to make API call + /// _type + /// type + /// type_ + /// http debug option (to test parameter naming option) + /// Index associated with the operation. + /// Env + public Env GetParameterNameMapping(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetParameterNameMappingWithHttpInfo(UnderscoreType, type, TypeWithUnderscore, httpDebugOption); + return localVarResponse.Data; + } + + /// + /// parameter name mapping test + /// + /// Thrown when fails to make API call + /// _type + /// type + /// type_ + /// http debug option (to test parameter naming option) + /// Index associated with the operation. + /// ApiResponse of Env + public Org.OpenAPITools.Client.ApiResponse GetParameterNameMappingWithHttpInfo(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0) + { + // verify the required parameter 'type' is set + if (type == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'type' when calling FakeApi->GetParameterNameMapping"); + } + + // verify the required parameter 'TypeWithUnderscore' is set + if (TypeWithUnderscore == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'TypeWithUnderscore' when calling FakeApi->GetParameterNameMapping"); + } + + // verify the required parameter 'httpDebugOption' is set + if (httpDebugOption == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'httpDebugOption' when calling FakeApi->GetParameterNameMapping"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "type", type)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "http_debug_option", httpDebugOption)); + localVarRequestOptions.HeaderParameters.Add("_type", Org.OpenAPITools.Client.ClientUtils.ParameterToString(UnderscoreType)); // header parameter + localVarRequestOptions.HeaderParameters.Add("type_", Org.OpenAPITools.Client.ClientUtils.ParameterToString(TypeWithUnderscore)); // header parameter + + localVarRequestOptions.Operation = "FakeApi.GetParameterNameMapping"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake/parameter-name-mapping", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetParameterNameMapping", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// parameter name mapping test + /// + /// Thrown when fails to make API call + /// _type + /// type + /// type_ + /// http debug option (to test parameter naming option) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Env + public async System.Threading.Tasks.Task GetParameterNameMappingAsync(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetParameterNameMappingWithHttpInfoAsync(UnderscoreType, type, TypeWithUnderscore, httpDebugOption, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// parameter name mapping test + /// + /// Thrown when fails to make API call + /// _type + /// type + /// type_ + /// http debug option (to test parameter naming option) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Env) + public async System.Threading.Tasks.Task> GetParameterNameMappingWithHttpInfoAsync(long UnderscoreType, string type, string TypeWithUnderscore, string httpDebugOption, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'type' is set + if (type == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'type' when calling FakeApi->GetParameterNameMapping"); + } + + // verify the required parameter 'TypeWithUnderscore' is set + if (TypeWithUnderscore == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'TypeWithUnderscore' when calling FakeApi->GetParameterNameMapping"); + } + + // verify the required parameter 'httpDebugOption' is set + if (httpDebugOption == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'httpDebugOption' when calling FakeApi->GetParameterNameMapping"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "type", type)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "http_debug_option", httpDebugOption)); + localVarRequestOptions.HeaderParameters.Add("_type", Org.OpenAPITools.Client.ClientUtils.ParameterToString(UnderscoreType)); // header parameter + localVarRequestOptions.HeaderParameters.Add("type_", Org.OpenAPITools.Client.ClientUtils.ParameterToString(TypeWithUnderscore)); // header parameter + + localVarRequestOptions.Operation = "FakeApi.GetParameterNameMapping"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/parameter-name-mapping", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetParameterNameMapping", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs new file mode 100644 index 000000000000..61c2f259c1f4 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiClient.cs @@ -0,0 +1,822 @@ +/* + * Dummy + * + * To test name, parameter mapping options + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp; +using RestSharp.Serializers; +using RestSharpMethod = RestSharp.Method; +using FileIO = System.IO.File; +using Polly; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer + { + private readonly IReadableConfiguration _configuration; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); + + public T Deserialize(RestResponse response) + { + var result = (T)Deserialize(response, typeof(T)); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(RestResponse response, Type type) + { + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = response.RawBytes; + if (response.Headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? global::System.IO.Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in response.Headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + FileIO.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public ISerializer Serializer => this; + public IDeserializer Deserializer => this; + + public string[] AcceptedContentTypes => ContentType.JsonAccept; + + public SupportsContentType SupportsContentType => contentType => + contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || + contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); + + public ContentType ContentType { get; set; } = ContentType.Json; + + public DataFormat DataFormat => DataFormat.Json; + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(RestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(RestRequest request, RestResponse response); + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = GlobalConfiguration.Instance.BasePath; + } + + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + _baseUrl = basePath; + } + + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.Get; + break; + case HttpMethod.Post: + other = RestSharpMethod.Post; + break; + case HttpMethod.Put: + other = RestSharpMethod.Put; + break; + case HttpMethod.Delete: + other = RestSharpMethod.Delete; + break; + case HttpMethod.Head: + other = RestSharpMethod.Head; + break; + case HttpMethod.Options: + other = RestSharpMethod.Options; + break; + case HttpMethod.Patch: + other = RestSharpMethod.Patch; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + + return other; + } + + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. + /// Here, it is simply mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + RestRequest request = new RestRequest(path, Method(method)); + + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.AddHeader(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + + if (options.Data != null) + { + if (options.Data is Stream stream) + { + var contentType = "application/octet-stream"; + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes[0]; + } + + var bytes = ClientUtils.ReadAsBytes(stream); + request.AddParameter(contentType, bytes, ParameterType.RequestBody); + } + else + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + + request.AddJsonBody(options.Data); + } + } + + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var bytes = ClientUtils.ReadAsBytes(file); + var fileStream = file as FileStream; + if (fileStream != null) + request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); + else + request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); + } + } + } + + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + + return request; + } + + /// + /// Transforms a RestResponse instance into a new ApiResponse instance. + /// At this point, we have a concrete http response from the service. + /// Here, it is simply mapped into the [public] ApiResponse object. + /// + /// The RestSharp response object + /// A new ApiResponse instance. + private ApiResponse ToApiResponse(RestResponse response) + { + T result = response.Data; + string rawContent = response.Content; + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.ContentHeaders != null) + { + foreach (var responseHeader in response.ContentHeaders) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies.Cast()) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + + return transformed; + } + + /// + /// Executes the HTTP request for the current service. + /// Based on functions received it can be async or sync. + /// + /// Local function that executes http request and returns http response. + /// Local function to specify options for the service. + /// The RestSharp request object + /// The RestSharp options object + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// A new ApiResponse instance. + private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; + var clientOptions = new RestClientOptions(baseUrl) + { + ClientCertificates = configuration.ClientCertificates, + Timeout = configuration.Timeout, + Proxy = configuration.Proxy, + UserAgent = configuration.UserAgent, + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback + }; + setOptions(clientOptions); + + using (RestClient client = new RestClient(clientOptions, + configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) + { + InterceptRequest(request); + + RestResponse response = await getResponse(client); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + try + { + response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + catch (Exception ex) + { + throw ex.InnerException != null ? ex.InnerException : ex; + } + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + else if (typeof(T).Name == "Byte[]") // for byte response + { + response.Data = (T)(object)response.RawBytes; + } + else if (typeof(T).Name == "String") // for string response + { + response.Data = (T)(object)response.Content; + } + + InterceptResponse(request, response); + + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies.Cast()) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + } + + private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) + { + if (policyResult.Outcome == OutcomeType.Successful) + { + return await client.Deserialize(policyResult.Result, cancellationToken); + } + else + { + return new RestResponse(request) + { + ErrorException = policyResult.FinalException + }; + } + } + + private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + Action setOptions = (clientOptions) => + { + var cookies = new CookieContainer(); + + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + cookies.Add(new Cookie(cookie.Name, cookie.Value)); + } + } + clientOptions.CookieContainer = cookies; + }; + + Func>> getResponse = (client) => + { + if (RetryConfiguration.RetryPolicy != null) + { + var policy = RetryConfiguration.RetryPolicy; + var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); + return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); + } + else + { + return Task.FromResult(client.Execute(request)); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); + } + + private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) + { + Action setOptions = (clientOptions) => + { + //no extra options + }; + + Func>> getResponse = async (client) => + { + if (RetryConfiguration.AsyncRetryPolicy != null) + { + var policy = RetryConfiguration.AsyncRetryPolicy; + var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); + return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); + } + else + { + return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration); + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); + } + #endregion ISynchronousClient + } +} diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiException.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiException.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiException.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiResponse.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ApiResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ApiResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ClientUtils.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ClientUtils.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ClientUtils.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Configuration.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ExceptionFactory.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ExceptionFactory.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ExceptionFactory.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ExceptionFactory.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/GlobalConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/GlobalConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/GlobalConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/HttpMethod.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/HttpMethod.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/HttpMethod.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/HttpMethod.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/IApiAccessor.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/IApiAccessor.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/IApiAccessor.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/IApiAccessor.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/IAsynchronousClient.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/IAsynchronousClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/IAsynchronousClient.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/IAsynchronousClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ISynchronousClient.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ISynchronousClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/ISynchronousClient.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/ISynchronousClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/Multimap.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Multimap.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/Multimap.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/Multimap.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/RequestOptions.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/RequestOptions.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/RequestOptions.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/RequestOptions.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Client/RetryConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Model/Env.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Model/Env.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Model/Env.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Model/Env.cs diff --git a/samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Model/PropertyNameMapping.cs b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Model/PropertyNameMapping.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net6/ParameterMappings/src/Org.OpenAPITools/Model/PropertyNameMapping.cs rename to samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Model/PropertyNameMapping.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..ccb09c252b62 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/ParameterMappings/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,35 @@ + + + + false + net8.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + annotations + false + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/.gitignore b/samples/client/petstore/csharp/restsharp/net8/Petstore/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/.openapi-generator-ignore b/samples/client/petstore/csharp/restsharp/net8/Petstore/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/.openapi-generator/FILES b/samples/client/petstore/csharp/restsharp/net8/Petstore/.openapi-generator/FILES new file mode 100644 index 000000000000..2a5dbfbe6e6f --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/.openapi-generator/FILES @@ -0,0 +1,235 @@ +.gitignore +Org.OpenAPITools.sln +README.md +api/openapi.yaml +appveyor.yml +docs/Activity.md +docs/ActivityOutputElementRepresentation.md +docs/AdditionalPropertiesClass.md +docs/Animal.md +docs/AnotherFakeApi.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/Category.md +docs/ChildCat.md +docs/ClassModel.md +docs/ComplexQuadrilateral.md +docs/DanishPig.md +docs/DateOnlyClass.md +docs/DefaultApi.md +docs/DeprecatedObject.md +docs/Dog.md +docs/Drawing.md +docs/EnumArrays.md +docs/EnumClass.md +docs/EnumTest.md +docs/EquilateralTriangle.md +docs/FakeApi.md +docs/FakeClassnameTags123Api.md +docs/File.md +docs/FileSchemaTestClass.md +docs/Foo.md +docs/FooGetDefaultResponse.md +docs/FormatTest.md +docs/Fruit.md +docs/FruitReq.md +docs/GmFruit.md +docs/GrandparentAnimal.md +docs/HasOnlyReadOnly.md +docs/HealthCheckResult.md +docs/IsoscelesTriangle.md +docs/List.md +docs/LiteralStringClass.md +docs/Mammal.md +docs/MapTest.md +docs/MixLog.md +docs/MixedAnyOf.md +docs/MixedAnyOfContent.md +docs/MixedOneOf.md +docs/MixedOneOfContent.md +docs/MixedPropertiesAndAdditionalPropertiesClass.md +docs/MixedSubId.md +docs/Model200Response.md +docs/ModelClient.md +docs/Name.md +docs/NotificationtestGetElementsV1ResponseMPayload.md +docs/NullableClass.md +docs/NullableGuidClass.md +docs/NullableShape.md +docs/NumberOnly.md +docs/ObjectWithDeprecatedFields.md +docs/OneOfString.md +docs/Order.md +docs/OuterComposite.md +docs/OuterEnum.md +docs/OuterEnumDefaultValue.md +docs/OuterEnumInteger.md +docs/OuterEnumIntegerDefaultValue.md +docs/OuterEnumTest.md +docs/ParentPet.md +docs/Pet.md +docs/PetApi.md +docs/Pig.md +docs/PolymorphicProperty.md +docs/Quadrilateral.md +docs/QuadrilateralInterface.md +docs/ReadOnlyFirst.md +docs/RequiredClass.md +docs/Return.md +docs/RolesReportsHash.md +docs/RolesReportsHashRole.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/TestCollectionEndingWithWordList.md +docs/TestCollectionEndingWithWordListObject.md +docs/TestInlineFreeformAdditionalPropertiesRequest.md +docs/Triangle.md +docs/TriangleInterface.md +docs/User.md +docs/UserApi.md +docs/Whale.md +docs/Zebra.md +docs/ZeroBasedEnum.md +docs/ZeroBasedEnumClass.md +git_push.sh +src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +src/Org.OpenAPITools/Api/AnotherFakeApi.cs +src/Org.OpenAPITools/Api/DefaultApi.cs +src/Org.OpenAPITools/Api/FakeApi.cs +src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +src/Org.OpenAPITools/Api/PetApi.cs +src/Org.OpenAPITools/Api/StoreApi.cs +src/Org.OpenAPITools/Api/UserApi.cs +src/Org.OpenAPITools/Client/ApiClient.cs +src/Org.OpenAPITools/Client/ApiException.cs +src/Org.OpenAPITools/Client/ApiResponse.cs +src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs +src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs +src/Org.OpenAPITools/Client/Auth/TokenResponse.cs +src/Org.OpenAPITools/Client/ClientUtils.cs +src/Org.OpenAPITools/Client/Configuration.cs +src/Org.OpenAPITools/Client/ExceptionFactory.cs +src/Org.OpenAPITools/Client/GlobalConfiguration.cs +src/Org.OpenAPITools/Client/HttpMethod.cs +src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +src/Org.OpenAPITools/Client/IApiAccessor.cs +src/Org.OpenAPITools/Client/IAsynchronousClient.cs +src/Org.OpenAPITools/Client/IReadableConfiguration.cs +src/Org.OpenAPITools/Client/ISynchronousClient.cs +src/Org.OpenAPITools/Client/Multimap.cs +src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs +src/Org.OpenAPITools/Client/RequestOptions.cs +src/Org.OpenAPITools/Client/RetryConfiguration.cs +src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs +src/Org.OpenAPITools/Model/Activity.cs +src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/Animal.cs +src/Org.OpenAPITools/Model/ApiResponse.cs +src/Org.OpenAPITools/Model/Apple.cs +src/Org.OpenAPITools/Model/AppleReq.cs +src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +src/Org.OpenAPITools/Model/ArrayTest.cs +src/Org.OpenAPITools/Model/Banana.cs +src/Org.OpenAPITools/Model/BananaReq.cs +src/Org.OpenAPITools/Model/BasquePig.cs +src/Org.OpenAPITools/Model/Capitalization.cs +src/Org.OpenAPITools/Model/Cat.cs +src/Org.OpenAPITools/Model/Category.cs +src/Org.OpenAPITools/Model/ChildCat.cs +src/Org.OpenAPITools/Model/ClassModel.cs +src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +src/Org.OpenAPITools/Model/DanishPig.cs +src/Org.OpenAPITools/Model/DateOnlyClass.cs +src/Org.OpenAPITools/Model/DeprecatedObject.cs +src/Org.OpenAPITools/Model/Dog.cs +src/Org.OpenAPITools/Model/Drawing.cs +src/Org.OpenAPITools/Model/EnumArrays.cs +src/Org.OpenAPITools/Model/EnumClass.cs +src/Org.OpenAPITools/Model/EnumTest.cs +src/Org.OpenAPITools/Model/EquilateralTriangle.cs +src/Org.OpenAPITools/Model/File.cs +src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +src/Org.OpenAPITools/Model/Foo.cs +src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +src/Org.OpenAPITools/Model/FormatTest.cs +src/Org.OpenAPITools/Model/Fruit.cs +src/Org.OpenAPITools/Model/FruitReq.cs +src/Org.OpenAPITools/Model/GmFruit.cs +src/Org.OpenAPITools/Model/GrandparentAnimal.cs +src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +src/Org.OpenAPITools/Model/HealthCheckResult.cs +src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +src/Org.OpenAPITools/Model/List.cs +src/Org.OpenAPITools/Model/LiteralStringClass.cs +src/Org.OpenAPITools/Model/Mammal.cs +src/Org.OpenAPITools/Model/MapTest.cs +src/Org.OpenAPITools/Model/MixLog.cs +src/Org.OpenAPITools/Model/MixedAnyOf.cs +src/Org.OpenAPITools/Model/MixedAnyOfContent.cs +src/Org.OpenAPITools/Model/MixedOneOf.cs +src/Org.OpenAPITools/Model/MixedOneOfContent.cs +src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +src/Org.OpenAPITools/Model/MixedSubId.cs +src/Org.OpenAPITools/Model/Model200Response.cs +src/Org.OpenAPITools/Model/ModelClient.cs +src/Org.OpenAPITools/Model/Name.cs +src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +src/Org.OpenAPITools/Model/NullableClass.cs +src/Org.OpenAPITools/Model/NullableGuidClass.cs +src/Org.OpenAPITools/Model/NullableShape.cs +src/Org.OpenAPITools/Model/NumberOnly.cs +src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +src/Org.OpenAPITools/Model/OneOfString.cs +src/Org.OpenAPITools/Model/Order.cs +src/Org.OpenAPITools/Model/OuterComposite.cs +src/Org.OpenAPITools/Model/OuterEnum.cs +src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumInteger.cs +src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +src/Org.OpenAPITools/Model/OuterEnumTest.cs +src/Org.OpenAPITools/Model/ParentPet.cs +src/Org.OpenAPITools/Model/Pet.cs +src/Org.OpenAPITools/Model/Pig.cs +src/Org.OpenAPITools/Model/PolymorphicProperty.cs +src/Org.OpenAPITools/Model/Quadrilateral.cs +src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs +src/Org.OpenAPITools/Model/Return.cs +src/Org.OpenAPITools/Model/RolesReportsHash.cs +src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +src/Org.OpenAPITools/Model/ScaleneTriangle.cs +src/Org.OpenAPITools/Model/Shape.cs +src/Org.OpenAPITools/Model/ShapeInterface.cs +src/Org.OpenAPITools/Model/ShapeOrNull.cs +src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +src/Org.OpenAPITools/Model/SpecialModelName.cs +src/Org.OpenAPITools/Model/Tag.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +src/Org.OpenAPITools/Model/Triangle.cs +src/Org.OpenAPITools/Model/TriangleInterface.cs +src/Org.OpenAPITools/Model/User.cs +src/Org.OpenAPITools/Model/Whale.cs +src/Org.OpenAPITools/Model/Zebra.cs +src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +src/Org.OpenAPITools/Org.OpenAPITools.csproj diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/.openapi-generator/VERSION b/samples/client/petstore/csharp/restsharp/net8/Petstore/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/Org.OpenAPITools.sln b/samples/client/petstore/csharp/restsharp/net8/Petstore/Org.OpenAPITools.sln new file mode 100644 index 000000000000..5b15451c9dcf --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/Org.OpenAPITools.sln @@ -0,0 +1,27 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +VisualStudioVersion = 12.0.0.0 +MinimumVisualStudioVersion = 10.0.0.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools", "src\Org.OpenAPITools\Org.OpenAPITools.csproj", "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.OpenAPITools.Test", "src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj", "{19F1DEBC-DE5E-4517-8062-F000CD499087}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {321C8C3F-0156-40C1-AE42-D59761FB9B6C}.Release|Any CPU.Build.0 = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19F1DEBC-DE5E-4517-8062-F000CD499087}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/README.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/README.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/README.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/README.md diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml new file mode 100644 index 000000000000..780d21e19bfa --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml @@ -0,0 +1,3088 @@ +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: + /roles/report: + get: + responses: + "200": + content: + application/json: + schema: + items: + $ref: '#/components/schemas/RolesReport' + type: array + description: returns report + /hello: + get: + description: Hello + operationId: Hello + responses: + "200": + content: + application/json: + schema: + items: + format: uuid + type: string + type: array + description: UUIDs + summary: Hello + /foo: + get: + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/_foo_get_default_response' + description: response + /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 + 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 + 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: + "2XX": + description: Anything within 200-299 + "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 + "4XX": + description: Anything within 400-499 + security: + - http_signature_test: [] + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /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 + /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 + 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: [] + - api_key_query: [] + summary: Find pet by ID + tags: + - pet + post: + description: "" + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/updatePetWithForm_request' + responses: + "405": + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: "" + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + 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 + /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 + /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 + /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 + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate 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 + /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 + /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 + /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 + /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: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + 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 + /user/logout: + get: + description: "" + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /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 + 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 + "598": + description: Not a real HTTP status code + "599": + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Not a real HTTP status code with a return object + summary: Get user by user name + tags: + - user + 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 + /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#$%^ + /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: Something wrong + security: + - bearer_test: [] + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + 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: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEnumParameters_request' + responses: + "400": + description: Invalid request + "404": + description: Not found + summary: To test enum parameters + tags: + - fake + 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 + post: + description: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEndpointParameters_request' + responses: + "400": + description: Invalid username supplied + "404": + description: User not found + security: + - http_basic_test: [] + summary: | + Fake endpoint for testing various parameters + 假端點 + 偽のエンドポイント + 가짜 엔드 포인트 + tags: + - fake + /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 + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + parameters: + - description: Required UUID String + explode: true + in: query + name: required_string_uuid + required: true + schema: + format: uuid + type: string + style: form + 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 + /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 + /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 + /fake/jsonFormData: + get: + description: "" + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testJsonFormData_request' + responses: + "200": + description: successful operation + summary: test json serialization of form data + tags: + - fake + /fake/additionalProperties-reference: + post: + description: "" + operationId: testAdditionalPropertiesReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FreeFormObject' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced additionalProperties + tags: + - fake + /fake/stringMap-reference: + post: + description: "" + operationId: testStringMapReference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MapOfString' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test referenced string map + tags: + - fake + /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 + /fake/inline-freeform-additionalProperties: + post: + description: "" + operationId: testInlineFreeformAdditionalProperties + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/testInlineFreeformAdditionalProperties_request' + description: request body + required: true + responses: + "200": + description: successful operation + summary: test inline free-form additionalProperties + tags: + - fake + /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 + /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? + /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 + /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 + - explode: true + in: query + name: requiredNotNullable + required: true + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: requiredNullable + required: true + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: notRequiredNotNullable + required: false + schema: + nullable: false + type: string + style: form + - explode: true + in: query + name: notRequiredNullable + required: false + schema: + nullable: true + type: string + style: form + responses: + "200": + description: Success + tags: + - fake + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: "" + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFileWithRequiredFile_request' + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + application/vnd.openxmlformats-officedocument.spreadsheetml.sheet: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + /fake/health: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheckResult' + description: The instance started successfully + summary: Health check endpoint + tags: + - fake + /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 + /fake/mixed/anyOf: + get: + operationId: getMixedAnyOf + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MixedAnyOf' + description: Got mixed anyOf + summary: Test mixed type anyOf deserialization + tags: + - fake + /fake/mixed/oneOf: + get: + operationId: getMixedOneOf + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MixedOneOf' + description: Got mixed oneOf + summary: Test mixed type oneOf deserialization + tags: + - fake + /country: + post: + operationId: getCountry + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/getCountry_request' + responses: + "200": + description: OK + /test: + get: + operationId: Test + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/notificationtest-getElements-v1-Response-mPayload' + description: Successful response + summary: Retrieve an existing Notificationtest's Elements +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 + schemas: + RolesReport: + description: Roles report + items: + $ref: '#/components/schemas/RolesReportsHash' + type: array + RolesReportsHash: + description: Role report Hash + example: + role: + name: name + role_uuid: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 + properties: + role_uuid: + format: uuid + type: string + role: + $ref: '#/components/schemas/RolesReportsHash_role' + type: object + 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 + lock: + type: string + abstract: + nullable: true + type: string + unsafe: + type: string + required: + - abstract + - lock + 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' + - properties: + breed: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' + - properties: + declawed: + type: boolean + type: object + 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 + int32Range: + maximum: 2147483647 + minimum: -2147483648 + type: integer + int64Positive: + minimum: 2147483648 + type: integer + int64Negative: + maximum: -2147483649 + type: integer + int64PositiveExclusive: + exclusiveMinimum: true + minimum: 2147483647 + type: integer + int64NegativeExclusive: + exclusiveMaximum: true + maximum: -2147483648 + type: integer + unsigned_integer: + format: int32 + maximum: 200 + minimum: 20 + type: integer + x-unsigned: true + int64: + format: int64 + type: integer + unsigned_long: + format: int64 + type: integer + x-unsigned: true + 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 + pattern_with_backslash: + description: None + pattern: "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\\\ + /([0-9]|[1-2][0-9]|3[0-2]))$" + type: string + required: + - byte + - date + - number + - password + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Outer_Enum_Test: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + type: string + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + 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_with_pattern: + format: uuid + pattern: "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}" + type: string + 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 + x-cls-compliant: true + x-com-visible: true + 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 + FreeFormObject: + additionalProperties: true + description: A schema consisting only of additional properties + type: object + MapOfString: + additionalProperties: + type: string + description: A schema consisting only of additional properties of type string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + nullable: true + type: string + OuterEnumInteger: + enum: + - 0 + - 1 + - 2 + 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 + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + 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 + color_code: + pattern: "^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$" + 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 + nullable: true + oneOf: + - $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 + nullable: true + oneOf: + - $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' + - properties: + name: + type: string + pet_type: + default: ChildCat + enum: + - ChildCat + type: string + x-enum-as-string: true + required: + - pet_type + type: object + 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 + PolymorphicProperty: + oneOf: + - type: boolean + - type: string + - type: object + - items: + $ref: '#/components/schemas/StringArrayItem' + type: array + StringArrayItem: + format: string + type: string + Activity: + description: test map of maps + properties: + activity_outputs: + additionalProperties: + $ref: '#/components/schemas/ActivityOutputRepresentation' + type: object + type: object + ActivityOutputRepresentation: + items: + $ref: '#/components/schemas/ActivityOutputElementRepresentation' + type: array + ActivityOutputElementRepresentation: + properties: + prop1: + type: string + prop2: + type: object + type: object + NullableGuidClass: + properties: + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + type: object + DateOnlyClass: + properties: + dateOnlyProperty: + example: 2017-07-21 + format: date + type: string + type: object + TestCollectionEndingWithWordListObject: + properties: + TestCollectionEndingWithWordList: + items: + $ref: '#/components/schemas/TestCollectionEndingWithWordList' + type: array + type: object + TestCollectionEndingWithWordList: + properties: + value: + type: string + type: object + LiteralStringClass: + properties: + escapedLiteralString: + default: C:\\Users\\username + type: string + unescapedLiteralString: + default: C:\Users\username + type: string + type: object + OneOfString: + oneOf: + - pattern: ^a + type: string + - pattern: ^b + type: string + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + ZeroBasedEnumClass: + properties: + ZeroBasedEnum: + enum: + - unknown + - notUnknown + type: string + type: object + Custom-Variableobject-Response: + additionalProperties: true + description: A Variable object without predefined property names + type: object + Field-pkiNotificationtestID: + type: integer + notificationtest-getElements-v1-Response-mPayload: + example: + a_objVariableobject: + - null + - null + pkiNotificationtestID: 0 + properties: + pkiNotificationtestID: + type: integer + a_objVariableobject: + items: + $ref: '#/components/schemas/Custom-Variableobject-Response' + type: array + required: + - a_objVariableobject + - pkiNotificationtestID + type: object + MixedOneOf: + example: + content: MixedOneOf_content + properties: + content: + $ref: '#/components/schemas/MixedOneOf_content' + MixedAnyOf: + example: + content: MixedAnyOf_content + properties: + content: + $ref: '#/components/schemas/MixedAnyOf_content' + MixedSubId: + properties: + id: + type: string + MixLog: + properties: + id: + format: uuid + type: string + description: + type: string + mixDate: + format: date-time + type: string + shopId: + format: uuid + type: string + totalPrice: + format: float + nullable: true + type: number + totalRecalculations: + format: int32 + type: integer + totalOverPoors: + format: int32 + type: integer + totalSkips: + format: int32 + type: integer + totalUnderPours: + format: int32 + type: integer + formulaVersionDate: + format: date-time + type: string + someCode: + description: SomeCode is only required for color mixes + nullable: true + type: string + batchNumber: + type: string + brandCode: + description: BrandCode is only required for non-color mixes + type: string + brandId: + description: BrandId is only required for color mixes + type: string + brandName: + description: BrandName is only required for color mixes + type: string + categoryCode: + description: CategoryCode is not used anymore + type: string + color: + description: Color is only required for color mixes + type: string + colorDescription: + type: string + comment: + type: string + commercialProductCode: + type: string + productLineCode: + description: ProductLineCode is only required for color mixes + type: string + country: + type: string + createdBy: + type: string + createdByFirstName: + type: string + createdByLastName: + type: string + deltaECalculationRepaired: + type: string + deltaECalculationSprayout: + type: string + ownColorVariantNumber: + format: int32 + nullable: true + type: integer + primerProductId: + type: string + productId: + description: ProductId is only required for color mixes + type: string + productName: + description: ProductName is only required for color mixes + type: string + selectedVersionIndex: + format: int32 + type: integer + required: + - description + - formulaVersionDate + - id + - mixDate + - totalOverPoors + - totalRecalculations + - totalSkips + - totalUnderPours + type: object + uuid: + format: uuid + type: string + _foo_get_default_response: + example: + string: + bar: bar + properties: + string: + $ref: '#/components/schemas/Foo' + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + testEnumParameters_request: + 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 + testEndpointParameters_request: + 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 + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + testInlineFreeformAdditionalProperties_request: + additionalProperties: true + properties: + someProperty: + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + getCountry_request: + allOf: + - properties: + country: + type: string + required: + - country + type: object + RolesReportsHash_role: + example: + name: name + properties: + name: + type: string + type: object + MixedOneOf_content: + description: Mixed oneOf types for testing + oneOf: + - type: string + - type: boolean + - format: uint8 + type: integer + - format: float32 + type: number + - $ref: '#/components/schemas/MixedSubId' + MixedAnyOf_content: + anyOf: + - type: string + - type: boolean + - format: uint8 + type: integer + - format: float32 + type: number + - $ref: '#/components/schemas/MixedSubId' + description: Mixed anyOf types for testing + 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/csharp/restsharp/net8/Petstore/appveyor.yml b/samples/client/petstore/csharp/restsharp/net8/Petstore/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Activity.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Activity.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Activity.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Activity.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ActivityOutputElementRepresentation.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ActivityOutputElementRepresentation.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ActivityOutputElementRepresentation.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ActivityOutputElementRepresentation.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/AdditionalPropertiesClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/AdditionalPropertiesClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/AdditionalPropertiesClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Animal.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Animal.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Animal.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Animal.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/AnotherFakeApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/AnotherFakeApi.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/AnotherFakeApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ApiResponse.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ApiResponse.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ApiResponse.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ApiResponse.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Apple.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Apple.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Apple.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Apple.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/AppleReq.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/AppleReq.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/AppleReq.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/AppleReq.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ArrayOfArrayOfNumberOnly.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ArrayOfArrayOfNumberOnly.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ArrayOfArrayOfNumberOnly.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ArrayOfNumberOnly.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ArrayOfNumberOnly.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ArrayOfNumberOnly.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ArrayOfNumberOnly.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ArrayTest.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ArrayTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ArrayTest.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ArrayTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Banana.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Banana.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Banana.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Banana.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/BananaReq.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/BananaReq.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/BananaReq.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/BananaReq.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/BasquePig.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/BasquePig.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/BasquePig.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/BasquePig.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Capitalization.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Capitalization.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Capitalization.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Capitalization.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Cat.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Cat.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Cat.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Cat.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Category.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Category.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Category.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Category.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ChildCat.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ChildCat.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ChildCat.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ChildCat.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ClassModel.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ClassModel.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ClassModel.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ClassModel.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ComplexQuadrilateral.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ComplexQuadrilateral.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ComplexQuadrilateral.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ComplexQuadrilateral.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DanishPig.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DanishPig.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DanishPig.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DanishPig.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DateOnlyClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DateOnlyClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DateOnlyClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DateOnlyClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DefaultApi.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DefaultApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DefaultApi.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DefaultApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DeprecatedObject.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DeprecatedObject.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/DeprecatedObject.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/DeprecatedObject.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Dog.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Dog.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Dog.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Dog.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Drawing.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Drawing.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Drawing.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Drawing.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/EnumArrays.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EnumArrays.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/EnumArrays.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EnumArrays.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/EnumClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EnumClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/EnumClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EnumClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/EnumTest.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EnumTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/EnumTest.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EnumTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/EquilateralTriangle.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EquilateralTriangle.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/EquilateralTriangle.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/EquilateralTriangle.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FakeApi.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FakeApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FakeApi.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FakeApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FakeClassnameTags123Api.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FakeClassnameTags123Api.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FakeClassnameTags123Api.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FakeClassnameTags123Api.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/File.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/File.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/File.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/File.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FileSchemaTestClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FileSchemaTestClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FileSchemaTestClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Foo.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Foo.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Foo.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Foo.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FooGetDefaultResponse.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FooGetDefaultResponse.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FooGetDefaultResponse.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FooGetDefaultResponse.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FormatTest.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FormatTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FormatTest.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FormatTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Fruit.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Fruit.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Fruit.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Fruit.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FruitReq.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FruitReq.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/FruitReq.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/FruitReq.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/GmFruit.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/GmFruit.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/GmFruit.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/GmFruit.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/GrandparentAnimal.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/GrandparentAnimal.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/GrandparentAnimal.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/GrandparentAnimal.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/HasOnlyReadOnly.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/HasOnlyReadOnly.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/HasOnlyReadOnly.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/HasOnlyReadOnly.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/HealthCheckResult.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/HealthCheckResult.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/HealthCheckResult.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/HealthCheckResult.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/IsoscelesTriangle.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/IsoscelesTriangle.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/IsoscelesTriangle.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/IsoscelesTriangle.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/List.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/List.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/List.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/List.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/LiteralStringClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/LiteralStringClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/LiteralStringClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/LiteralStringClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Mammal.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Mammal.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Mammal.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Mammal.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MapTest.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MapTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MapTest.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MapTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixLog.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixLog.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixLog.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixLog.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedAnyOf.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedAnyOf.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedAnyOf.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedAnyOf.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedAnyOfContent.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedAnyOfContent.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedAnyOfContent.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedAnyOfContent.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedOneOf.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedOneOf.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedOneOf.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedOneOf.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedOneOfContent.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedOneOfContent.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedOneOfContent.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedOneOfContent.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedSubId.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedSubId.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/MixedSubId.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/MixedSubId.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Model200Response.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Model200Response.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Model200Response.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Model200Response.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ModelClient.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ModelClient.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ModelClient.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ModelClient.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Name.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Name.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Name.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Name.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NotificationtestGetElementsV1ResponseMPayload.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NotificationtestGetElementsV1ResponseMPayload.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NotificationtestGetElementsV1ResponseMPayload.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NotificationtestGetElementsV1ResponseMPayload.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NullableClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NullableClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NullableClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NullableClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NullableGuidClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NullableGuidClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NullableGuidClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NullableGuidClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NullableShape.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NullableShape.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NullableShape.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NullableShape.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NumberOnly.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NumberOnly.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/NumberOnly.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/NumberOnly.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ObjectWithDeprecatedFields.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ObjectWithDeprecatedFields.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ObjectWithDeprecatedFields.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ObjectWithDeprecatedFields.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OneOfString.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OneOfString.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OneOfString.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OneOfString.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Order.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Order.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Order.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Order.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterComposite.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterComposite.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterComposite.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterComposite.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnum.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnum.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnum.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnum.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnumDefaultValue.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnumDefaultValue.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnumDefaultValue.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnumDefaultValue.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnumInteger.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnumInteger.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnumInteger.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnumInteger.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnumIntegerDefaultValue.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnumIntegerDefaultValue.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnumIntegerDefaultValue.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnumIntegerDefaultValue.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnumTest.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnumTest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/OuterEnumTest.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/OuterEnumTest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ParentPet.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ParentPet.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ParentPet.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ParentPet.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Pet.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Pet.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Pet.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Pet.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/PetApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/PetApi.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/PetApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Pig.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Pig.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Pig.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Pig.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/PolymorphicProperty.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/PolymorphicProperty.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/PolymorphicProperty.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/PolymorphicProperty.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Quadrilateral.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Quadrilateral.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Quadrilateral.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Quadrilateral.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/QuadrilateralInterface.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/QuadrilateralInterface.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/QuadrilateralInterface.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/QuadrilateralInterface.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ReadOnlyFirst.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ReadOnlyFirst.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ReadOnlyFirst.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ReadOnlyFirst.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/RequiredClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/RequiredClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/RequiredClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/RequiredClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Return.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Return.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Return.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Return.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/RolesReportsHash.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/RolesReportsHash.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/RolesReportsHash.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/RolesReportsHash.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/RolesReportsHashRole.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/RolesReportsHashRole.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/RolesReportsHashRole.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/RolesReportsHashRole.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ScaleneTriangle.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ScaleneTriangle.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ScaleneTriangle.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ScaleneTriangle.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Shape.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Shape.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Shape.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Shape.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ShapeInterface.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ShapeInterface.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ShapeInterface.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ShapeInterface.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ShapeOrNull.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ShapeOrNull.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ShapeOrNull.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ShapeOrNull.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/SimpleQuadrilateral.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/SimpleQuadrilateral.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/SimpleQuadrilateral.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/SimpleQuadrilateral.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/SpecialModelName.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/SpecialModelName.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/SpecialModelName.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/SpecialModelName.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/StoreApi.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/StoreApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/StoreApi.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/StoreApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Tag.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Tag.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Tag.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Tag.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/TestCollectionEndingWithWordList.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/TestCollectionEndingWithWordList.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/TestCollectionEndingWithWordList.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/TestCollectionEndingWithWordList.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/TestCollectionEndingWithWordListObject.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/TestCollectionEndingWithWordListObject.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/TestCollectionEndingWithWordListObject.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/TestCollectionEndingWithWordListObject.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/TestInlineFreeformAdditionalPropertiesRequest.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/TestInlineFreeformAdditionalPropertiesRequest.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/TestInlineFreeformAdditionalPropertiesRequest.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/TestInlineFreeformAdditionalPropertiesRequest.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Triangle.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Triangle.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Triangle.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Triangle.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/TriangleInterface.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/TriangleInterface.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/TriangleInterface.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/TriangleInterface.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/User.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/User.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/User.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/User.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/UserApi.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/UserApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/UserApi.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/UserApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Whale.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Whale.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Whale.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Whale.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Zebra.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Zebra.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/Zebra.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/Zebra.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ZeroBasedEnum.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ZeroBasedEnum.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ZeroBasedEnum.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ZeroBasedEnum.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ZeroBasedEnumClass.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ZeroBasedEnumClass.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/docs/ZeroBasedEnumClass.md rename to samples/client/petstore/csharp/restsharp/net8/Petstore/docs/ZeroBasedEnumClass.md diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/git_push.sh b/samples/client/petstore/csharp/restsharp/net8/Petstore/git_push.sh similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/git_push.sh rename to samples/client/petstore/csharp/restsharp/net8/Petstore/git_push.sh diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/PetApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Api/UserApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ActivityOutputElementRepresentationTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ActivityTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ActivityTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ActivityTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ActivityTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/AnimalTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/AppleReqTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/AppleTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/AppleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/AppleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/AppleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/BananaReqTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/BananaTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/BananaTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/BananaTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/BananaTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/BasquePigTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/CatTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/CatTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/CatTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/CategoryTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ChildCatTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ComplexQuadrilateralTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DanishPigTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DateOnlyClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DeprecatedObjectTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DogTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DogTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DogTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DogTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DrawingTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DrawingTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/DrawingTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/DrawingTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/EquilateralTriangleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FileTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FileTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FileTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FooGetDefaultResponseTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FooTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FooTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FooTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FooTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FruitReqTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FruitTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FruitTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/FruitTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/FruitTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/GmFruitTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/GrandparentAnimalTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/HealthCheckResultTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/IsoscelesTriangleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ListTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ListTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ListTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ListTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/LiteralStringClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MammalTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MammalTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MammalTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MammalTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MapTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixLogTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixLogTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixLogTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixLogTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfContentTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedAnyOfTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfContentTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedOneOfTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/MixedSubIdTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NameTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NameTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NameTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NameTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NotificationtestGetElementsV1ResponseMPayloadTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NullableClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NullableGuidClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NullableShapeTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ObjectWithDeprecatedFieldsTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OneOfStringTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OrderTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OrderTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OrderTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumDefaultValueTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerDefaultValueTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumIntegerTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ParentPetTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/PetTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/PetTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/PetTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/PigTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/PigTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/PigTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/PigTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/PolymorphicPropertyTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralInterfaceTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/QuadrilateralTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ReturnTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashRoleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/RolesReportsHashTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ScaleneTriangleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ShapeInterfaceTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ShapeOrNullTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ShapeTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ShapeTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ShapeTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ShapeTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/SimpleQuadrilateralTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TagTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TagTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TagTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListObjectTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TestCollectionEndingWithWordListTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TestInlineFreeformAdditionalPropertiesRequestTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TriangleInterfaceTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TriangleTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TriangleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/TriangleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/TriangleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/UserTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/UserTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/UserTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/WhaleTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/WhaleTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/WhaleTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/WhaleTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ZebraTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ZebraTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ZebraTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ZebraTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumClassTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Model/ZeroBasedEnumTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..64ebed26518e --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net8.0 + false + annotations + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs new file mode 100644 index 000000000000..1060a9cbc232 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -0,0 +1,355 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAnotherFakeApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + ModelClient Call123TestSpecialTags(ModelClient modelClient, int operationIndex = 0); + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + ApiResponse Call123TestSpecialTagsWithHttpInfo(ModelClient modelClient, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAnotherFakeApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + System.Threading.Tasks.Task Call123TestSpecialTagsAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// To test special tags + /// + /// + /// To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IAnotherFakeApi : IAnotherFakeApiSync, IAnotherFakeApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class AnotherFakeApi : IAnotherFakeApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public AnotherFakeApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public AnotherFakeApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public AnotherFakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + public ModelClient Call123TestSpecialTags(ModelClient modelClient, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); + return localVarResponse.Data; + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + public Org.OpenAPITools.Client.ApiResponse Call123TestSpecialTagsWithHttpInfo(ModelClient modelClient, int operationIndex = 0) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "AnotherFakeApi.Call123TestSpecialTags"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Patch("/another-fake/dummy", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + public async System.Threading.Tasks.Task Call123TestSpecialTagsAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await Call123TestSpecialTagsWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// To test special tags To test special tags and operation ID starting with number + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> Call123TestSpecialTagsWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "AnotherFakeApi.Call123TestSpecialTags"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PatchAsync("/another-fake/dummy", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Call123TestSpecialTags", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..ddcafaaeb043 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,1023 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// FooGetDefaultResponse + FooGetDefaultResponse FooGet(int operationIndex = 0); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of FooGetDefaultResponse + ApiResponse FooGetWithHttpInfo(int operationIndex = 0); + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + void GetCountry(string country, int operationIndex = 0); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse GetCountryWithHttpInfo(string country, int operationIndex = 0); + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<Guid> + List Hello(int operationIndex = 0); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<Guid> + ApiResponse> HelloWithHttpInfo(int operationIndex = 0); + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<List<RolesReportsHash>> + List> RolesReportGet(int operationIndex = 0); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<List<RolesReportsHash>> + ApiResponse>> RolesReportGetWithHttpInfo(int operationIndex = 0); + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// NotificationtestGetElementsV1ResponseMPayload + NotificationtestGetElementsV1ResponseMPayload Test(int operationIndex = 0); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of NotificationtestGetElementsV1ResponseMPayload + ApiResponse TestWithHttpInfo(int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of FooGetDefaultResponse + System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (FooGetDefaultResponse) + System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task GetCountryAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> GetCountryWithHttpInfoAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Guid> + System.Threading.Tasks.Task> HelloAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Hello + /// + /// + /// Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Guid>) + System.Threading.Tasks.Task>> HelloWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<List<RolesReportsHash>> + System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<List<RolesReportsHash>>) + System.Threading.Tasks.Task>>> RolesReportGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of NotificationtestGetElementsV1ResponseMPayload + System.Threading.Tasks.Task TestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (NotificationtestGetElementsV1ResponseMPayload) + System.Threading.Tasks.Task> TestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApi : IDefaultApiSync, IDefaultApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class DefaultApi : IDefaultApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public DefaultApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public DefaultApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// FooGetDefaultResponse + public FooGetDefaultResponse FooGet(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FooGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of FooGetDefaultResponse + public Org.OpenAPITools.Client.ApiResponse FooGetWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.FooGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/foo", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of FooGetDefaultResponse + public async System.Threading.Tasks.Task FooGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FooGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (FooGetDefaultResponse) + public async System.Threading.Tasks.Task> FooGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.FooGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/foo", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FooGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + public void GetCountry(string country, int operationIndex = 0) + { + GetCountryWithHttpInfo(country); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse GetCountryWithHttpInfo(string country, int operationIndex = 0) + { + // verify the required parameter 'country' is set + if (country == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'country' when calling DefaultApi->GetCountry"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.FormParameters.Add("country", Org.OpenAPITools.Client.ClientUtils.ParameterToString(country)); // form parameter + + localVarRequestOptions.Operation = "DefaultApi.GetCountry"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/country", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetCountry", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task GetCountryAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await GetCountryWithHttpInfoAsync(country, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> GetCountryWithHttpInfoAsync(string country, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'country' is set + if (country == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'country' when calling DefaultApi->GetCountry"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.FormParameters.Add("country", Org.OpenAPITools.Client.ClientUtils.ParameterToString(country)); // form parameter + + localVarRequestOptions.Operation = "DefaultApi.GetCountry"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/country", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetCountry", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<Guid> + public List Hello(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = HelloWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<Guid> + public Org.OpenAPITools.Client.ApiResponse> HelloWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.Hello"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get>("/hello", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Hello", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Guid> + public async System.Threading.Tasks.Task> HelloAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await HelloWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Hello Hello + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Guid>) + public async System.Threading.Tasks.Task>> HelloWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.Hello"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/hello", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Hello", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<List<RolesReportsHash>> + public List> RolesReportGet(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse>> localVarResponse = RolesReportGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<List<RolesReportsHash>> + public Org.OpenAPITools.Client.ApiResponse>> RolesReportGetWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.RolesReportGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get>>("/roles/report", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RolesReportGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<List<RolesReportsHash>> + public async System.Threading.Tasks.Task>> RolesReportGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse>> localVarResponse = await RolesReportGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<List<RolesReportsHash>>) + public async System.Threading.Tasks.Task>>> RolesReportGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.RolesReportGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>>("/roles/report", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("RolesReportGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// NotificationtestGetElementsV1ResponseMPayload + public NotificationtestGetElementsV1ResponseMPayload Test(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = TestWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of NotificationtestGetElementsV1ResponseMPayload + public Org.OpenAPITools.Client.ApiResponse TestWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.Test"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/test", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Test", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of NotificationtestGetElementsV1ResponseMPayload + public async System.Threading.Tasks.Task TestAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Retrieve an existing Notificationtest's Elements + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (NotificationtestGetElementsV1ResponseMPayload) + public async System.Threading.Tasks.Task> TestWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.Test"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/test", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("Test", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs new file mode 100644 index 000000000000..0d9db708d63a --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/FakeApi.cs @@ -0,0 +1,4444 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// HealthCheckResult + HealthCheckResult FakeHealthGet(int operationIndex = 0); + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of HealthCheckResult + ApiResponse FakeHealthGetWithHttpInfo(int operationIndex = 0); + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// bool + bool FakeOuterBooleanSerialize(bool? body = default(bool?), int operationIndex = 0); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// ApiResponse of bool + ApiResponse FakeOuterBooleanSerializeWithHttpInfo(bool? body = default(bool?), int operationIndex = 0); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// OuterComposite + OuterComposite FakeOuterCompositeSerialize(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// ApiResponse of OuterComposite + ApiResponse FakeOuterCompositeSerializeWithHttpInfo(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// decimal + decimal FakeOuterNumberSerialize(decimal? body = default(decimal?), int operationIndex = 0); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// ApiResponse of decimal + ApiResponse FakeOuterNumberSerializeWithHttpInfo(decimal? body = default(decimal?), int operationIndex = 0); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// string + string FakeOuterStringSerialize(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// ApiResponse of string + ApiResponse FakeOuterStringSerializeWithHttpInfo(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0); + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<OuterEnum> + List GetArrayOfEnums(int operationIndex = 0); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<OuterEnum> + ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0); + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// MixedAnyOf + MixedAnyOf GetMixedAnyOf(int operationIndex = 0); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of MixedAnyOf + ApiResponse GetMixedAnyOfWithHttpInfo(int operationIndex = 0); + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// MixedOneOf + MixedOneOf GetMixedOneOf(int operationIndex = 0); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of MixedOneOf + ApiResponse GetMixedOneOfWithHttpInfo(int operationIndex = 0); + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + void TestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0); + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// + void TestBodyWithQueryParams(string query, User user, int operationIndex = 0); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestBodyWithQueryParamsWithHttpInfo(string query, User user, int operationIndex = 0); + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + ModelClient TestClientModel(ModelClient modelClient, int operationIndex = 0); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + ApiResponse TestClientModelWithHttpInfo(ModelClient modelClient, int operationIndex = 0); + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// + void TestEndpointParameters(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestEndpointParametersWithHttpInfo(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0); + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// + void TestEnumParameters(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestEnumParametersWithHttpInfo(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0); + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// + void TestGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0); + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestInlineAdditionalProperties(Dictionary requestBody, int operationIndex = 0); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestInlineAdditionalPropertiesWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0); + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// + void TestJsonFormData(string param, string param2, int operationIndex = 0); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestJsonFormDataWithHttpInfo(string param, string param2, int operationIndex = 0); + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// + void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0); + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + void TestStringMapReference(Dictionary requestBody, int operationIndex = 0); + + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse TestStringMapReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of HealthCheckResult + System.Threading.Tasks.Task FakeHealthGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Health check endpoint + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (HealthCheckResult) + System.Threading.Tasks.Task> FakeHealthGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of bool + System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (bool) + System.Threading.Tasks.Task> FakeOuterBooleanSerializeWithHttpInfoAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of OuterComposite + System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (OuterComposite) + System.Threading.Tasks.Task> FakeOuterCompositeSerializeWithHttpInfoAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of decimal + System.Threading.Tasks.Task FakeOuterNumberSerializeAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (decimal) + System.Threading.Tasks.Task> FakeOuterNumberSerializeWithHttpInfoAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + System.Threading.Tasks.Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + System.Threading.Tasks.Task> FakeOuterStringSerializeWithHttpInfoAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<OuterEnum> + System.Threading.Tasks.Task> GetArrayOfEnumsAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Array of Enums + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<OuterEnum>) + System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of MixedAnyOf + System.Threading.Tasks.Task GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Test mixed type anyOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MixedAnyOf) + System.Threading.Tasks.Task> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of MixedOneOf + System.Threading.Tasks.Task GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Test mixed type oneOf deserialization + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MixedOneOf) + System.Threading.Tasks.Task> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test referenced additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithFileSchemaWithHttpInfoAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestBodyWithQueryParamsAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithQueryParamsWithHttpInfoAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + System.Threading.Tasks.Task TestClientModelAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// To test \"client\" model + /// + /// + /// To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> TestClientModelWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestEndpointParametersAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestEndpointParametersWithHttpInfoAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestEnumParametersAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// To test enum parameters + /// + /// + /// To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestEnumParametersWithHttpInfoAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestGroupParametersAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Fake endpoint to test group parameters (optional) + /// + /// + /// Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestGroupParametersWithHttpInfoAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test inline additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestInlineAdditionalPropertiesWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test inline free-form additionalProperties + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestJsonFormDataAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test json serialization of form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestJsonFormDataWithHttpInfoAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task TestStringMapReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// test referenced string map + /// + /// + /// + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> TestStringMapReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeApi : IFakeApiSync, IFakeApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class FakeApi : IFakeApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public FakeApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public FakeApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// HealthCheckResult + public HealthCheckResult FakeHealthGet(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeHealthGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of HealthCheckResult + public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.FakeHealthGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake/health", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeHealthGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of HealthCheckResult + public async System.Threading.Tasks.Task FakeHealthGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeHealthGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Health check endpoint + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (HealthCheckResult) + public async System.Threading.Tasks.Task> FakeHealthGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.FakeHealthGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/health", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeHealthGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// bool + public bool FakeOuterBooleanSerialize(bool? body = default(bool?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// ApiResponse of bool + public Org.OpenAPITools.Client.ApiResponse FakeOuterBooleanSerializeWithHttpInfo(bool? body = default(bool?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterBooleanSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/outer/boolean", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of bool + public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterBooleanSerializeWithHttpInfoAsync(body, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (bool) + public async System.Threading.Tasks.Task> FakeOuterBooleanSerializeWithHttpInfoAsync(bool? body = default(bool?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterBooleanSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/boolean", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// OuterComposite + public OuterComposite FakeOuterCompositeSerialize(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterCompositeSerializeWithHttpInfo(outerComposite); + return localVarResponse.Data; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// ApiResponse of OuterComposite + public Org.OpenAPITools.Client.ApiResponse FakeOuterCompositeSerializeWithHttpInfo(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = outerComposite; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterCompositeSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/outer/composite", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of OuterComposite + public async System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterCompositeSerializeWithHttpInfoAsync(outerComposite, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (OuterComposite) + public async System.Threading.Tasks.Task> FakeOuterCompositeSerializeWithHttpInfoAsync(OuterComposite? outerComposite = default(OuterComposite?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = outerComposite; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterCompositeSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/composite", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// decimal + public decimal FakeOuterNumberSerialize(decimal? body = default(decimal?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// ApiResponse of decimal + public Org.OpenAPITools.Client.ApiResponse FakeOuterNumberSerializeWithHttpInfo(decimal? body = default(decimal?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterNumberSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/outer/number", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of decimal + public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterNumberSerializeWithHttpInfoAsync(body, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (decimal) + public async System.Threading.Tasks.Task> FakeOuterNumberSerializeWithHttpInfoAsync(decimal? body = default(decimal?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterNumberSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/number", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// string + public string FakeOuterStringSerialize(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = FakeOuterStringSerializeWithHttpInfo(requiredStringUuid, body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// ApiResponse of string + public Org.OpenAPITools.Client.ApiResponse FakeOuterStringSerializeWithHttpInfo(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_uuid", requiredStringUuid)); + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterStringSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/outer/string", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await FakeOuterStringSerializeWithHttpInfoAsync(requiredStringUuid, body, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Required UUID String + /// Input string as post body (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + public async System.Threading.Tasks.Task> FakeOuterStringSerializeWithHttpInfoAsync(Guid requiredStringUuid, string? body = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "*/*" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_uuid", requiredStringUuid)); + localVarRequestOptions.Data = body; + + localVarRequestOptions.Operation = "FakeApi.FakeOuterStringSerialize"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/outer/string", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// List<OuterEnum> + public List GetArrayOfEnums(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetArrayOfEnumsWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of List<OuterEnum> + public Org.OpenAPITools.Client.ApiResponse> GetArrayOfEnumsWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetArrayOfEnums"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get>("/fake/array-of-enums", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetArrayOfEnums", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<OuterEnum> + public async System.Threading.Tasks.Task> GetArrayOfEnumsAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetArrayOfEnumsWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Array of Enums + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<OuterEnum>) + public async System.Threading.Tasks.Task>> GetArrayOfEnumsWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetArrayOfEnums"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/fake/array-of-enums", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetArrayOfEnums", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// MixedAnyOf + public MixedAnyOf GetMixedAnyOf(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetMixedAnyOfWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of MixedAnyOf + public Org.OpenAPITools.Client.ApiResponse GetMixedAnyOfWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of MixedAnyOf + public async System.Threading.Tasks.Task GetMixedAnyOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetMixedAnyOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test mixed type anyOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MixedAnyOf) + public async System.Threading.Tasks.Task> GetMixedAnyOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetMixedAnyOf"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/mixed/anyOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMixedAnyOf", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// MixedOneOf + public MixedOneOf GetMixedOneOf(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetMixedOneOfWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of MixedOneOf + public Org.OpenAPITools.Client.ApiResponse GetMixedOneOfWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of MixedOneOf + public async System.Threading.Tasks.Task GetMixedOneOfAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetMixedOneOfWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Test mixed type oneOf deserialization + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (MixedOneOf) + public async System.Threading.Tasks.Task> GetMixedOneOfWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "FakeApi.GetMixedOneOf"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/mixed/oneOf", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetMixedOneOf", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestAdditionalPropertiesReference(Dictionary requestBody, int operationIndex = 0) + { + TestAdditionalPropertiesReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestAdditionalPropertiesReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestAdditionalPropertiesReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestAdditionalPropertiesReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestAdditionalPropertiesReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestAdditionalPropertiesReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/additionalProperties-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestAdditionalPropertiesReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// + public void TestBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = fileSchemaTestClass; + + localVarRequestOptions.Operation = "FakeApi.TestBodyWithFileSchema"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Put("/fake/body-with-file-schema", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithFileSchemaAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestBodyWithFileSchemaWithHttpInfoAsync(fileSchemaTestClass, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithFileSchemaWithHttpInfoAsync(FileSchemaTestClass fileSchemaTestClass, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = fileSchemaTestClass; + + localVarRequestOptions.Operation = "FakeApi.TestBodyWithFileSchema"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/body-with-file-schema", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// + public void TestBodyWithQueryParams(string query, User user, int operationIndex = 0) + { + TestBodyWithQueryParamsWithHttpInfo(query, user); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestBodyWithQueryParamsWithHttpInfo(string query, User user, int operationIndex = 0) + { + // verify the required parameter 'query' is set + if (query == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); + } + + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling FakeApi->TestBodyWithQueryParams"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "FakeApi.TestBodyWithQueryParams"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Put("/fake/body-with-query-params", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestBodyWithQueryParams", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithQueryParamsAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestBodyWithQueryParamsWithHttpInfoAsync(query, user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// + /// + /// Thrown when fails to make API call + /// + /// + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithQueryParamsWithHttpInfoAsync(string query, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'query' is set + if (query == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'query' when calling FakeApi->TestBodyWithQueryParams"); + } + + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling FakeApi->TestBodyWithQueryParams"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "query", query)); + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "FakeApi.TestBodyWithQueryParams"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/body-with-query-params", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestBodyWithQueryParams", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + public ModelClient TestClientModel(ModelClient modelClient, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClientModelWithHttpInfo(modelClient); + return localVarResponse.Data; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpInfo(ModelClient modelClient, int operationIndex = 0) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeApi->TestClientModel"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "FakeApi.TestClientModel"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Patch("/fake", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestClientModel", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + public async System.Threading.Tasks.Task TestClientModelAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClientModelWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// To test \"client\" model To test \"client\" model + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> TestClientModelWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeApi->TestClientModel"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "FakeApi.TestClientModel"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PatchAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestClientModel", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// + public void TestEndpointParameters(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0) + { + TestEndpointParametersWithHttpInfo(number, varDouble, patternWithoutDelimiter, varByte, integer, int32, int64, varFloat, varString, binary, date, dateTime, password, callback); + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestEndpointParametersWithHttpInfo(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0) + { + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); + } + + // verify the required parameter 'varByte' is set + if (varByte == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'varByte' when calling FakeApi->TestEndpointParameters"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (integer != null) + { + localVarRequestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter + } + if (int32 != null) + { + localVarRequestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter + } + if (int64 != null) + { + localVarRequestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter + } + localVarRequestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter + if (varFloat != null) + { + localVarRequestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varFloat)); // form parameter + } + localVarRequestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varDouble)); // form parameter + if (varString != null) + { + localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varString)); // form parameter + } + localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varByte)); // form parameter + if (binary != null) + { + localVarRequestOptions.FileParameters.Add("binary", binary); + } + if (date != null) + { + localVarRequestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter + } + if (dateTime != null) + { + localVarRequestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter + } + if (password != null) + { + localVarRequestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter + } + if (callback != null) + { + localVarRequestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestEndpointParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (http_basic_test) required + // http basic authentication required + if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestEndpointParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestEndpointParametersAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestEndpointParametersWithHttpInfoAsync(number, varDouble, patternWithoutDelimiter, varByte, integer, int32, int64, varFloat, varString, binary, date, dateTime, password, callback, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + /// + /// Thrown when fails to make API call + /// None + /// None + /// None + /// None + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional) + /// None (optional, default to "2010-02-01T10:20:10.111110+01:00") + /// None (optional) + /// None (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestEndpointParametersWithHttpInfoAsync(decimal number, double varDouble, string patternWithoutDelimiter, byte[] varByte, int? integer = default(int?), int? int32 = default(int?), long? int64 = default(long?), float? varFloat = default(float?), string? varString = default(string?), System.IO.Stream? binary = default(System.IO.Stream?), DateOnly? date = default(DateOnly?), DateTime? dateTime = default(DateTime?), string? password = default(string?), string? callback = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'patternWithoutDelimiter' is set + if (patternWithoutDelimiter == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'patternWithoutDelimiter' when calling FakeApi->TestEndpointParameters"); + } + + // verify the required parameter 'varByte' is set + if (varByte == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'varByte' when calling FakeApi->TestEndpointParameters"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (integer != null) + { + localVarRequestOptions.FormParameters.Add("integer", Org.OpenAPITools.Client.ClientUtils.ParameterToString(integer)); // form parameter + } + if (int32 != null) + { + localVarRequestOptions.FormParameters.Add("int32", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int32)); // form parameter + } + if (int64 != null) + { + localVarRequestOptions.FormParameters.Add("int64", Org.OpenAPITools.Client.ClientUtils.ParameterToString(int64)); // form parameter + } + localVarRequestOptions.FormParameters.Add("number", Org.OpenAPITools.Client.ClientUtils.ParameterToString(number)); // form parameter + if (varFloat != null) + { + localVarRequestOptions.FormParameters.Add("float", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varFloat)); // form parameter + } + localVarRequestOptions.FormParameters.Add("double", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varDouble)); // form parameter + if (varString != null) + { + localVarRequestOptions.FormParameters.Add("string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varString)); // form parameter + } + localVarRequestOptions.FormParameters.Add("pattern_without_delimiter", Org.OpenAPITools.Client.ClientUtils.ParameterToString(patternWithoutDelimiter)); // form parameter + localVarRequestOptions.FormParameters.Add("byte", Org.OpenAPITools.Client.ClientUtils.ParameterToString(varByte)); // form parameter + if (binary != null) + { + localVarRequestOptions.FileParameters.Add("binary", binary); + } + if (date != null) + { + localVarRequestOptions.FormParameters.Add("date", Org.OpenAPITools.Client.ClientUtils.ParameterToString(date)); // form parameter + } + if (dateTime != null) + { + localVarRequestOptions.FormParameters.Add("dateTime", Org.OpenAPITools.Client.ClientUtils.ParameterToString(dateTime)); // form parameter + } + if (password != null) + { + localVarRequestOptions.FormParameters.Add("password", Org.OpenAPITools.Client.ClientUtils.ParameterToString(password)); // form parameter + } + if (callback != null) + { + localVarRequestOptions.FormParameters.Add("callback", Org.OpenAPITools.Client.ClientUtils.ParameterToString(callback)); // form parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestEndpointParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (http_basic_test) required + // http basic authentication required + if (!string.IsNullOrEmpty(this.Configuration.Username) || !string.IsNullOrEmpty(this.Configuration.Password) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Basic " + Org.OpenAPITools.Client.ClientUtils.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password)); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestEndpointParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// + public void TestEnumParameters(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0) + { + TestEnumParametersWithHttpInfo(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestEnumParametersWithHttpInfo(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (enumQueryStringArray != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "enum_query_string_array", enumQueryStringArray)); + } + if (enumQueryString != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)); + } + if (enumQueryInteger != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)); + } + if (enumQueryDouble != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); + } + if (enumHeaderStringArray != null) + { + localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + } + if (enumHeaderString != null) + { + localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + } + if (enumFormStringArray != null) + { + localVarRequestOptions.FormParameters.Add("enum_form_string_array", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter + } + if (enumFormString != null) + { + localVarRequestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestEnumParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestEnumParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestEnumParametersAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestEnumParametersWithHttpInfoAsync(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// To test enum parameters To test enum parameters + /// + /// Thrown when fails to make API call + /// Header parameter enum test (string array) (optional) + /// Header parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (string array) (optional) + /// Query parameter enum test (string) (optional, default to -efg) + /// Query parameter enum test (double) (optional) + /// Query parameter enum test (double) (optional) + /// Form parameter enum test (string array) (optional, default to $) + /// Form parameter enum test (string) (optional, default to -efg) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestEnumParametersWithHttpInfoAsync(List? enumHeaderStringArray = default(List?), string? enumHeaderString = default(string?), List? enumQueryStringArray = default(List?), string? enumQueryString = default(string?), int? enumQueryInteger = default(int?), double? enumQueryDouble = default(double?), List? enumFormStringArray = default(List?), string? enumFormString = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + if (enumQueryStringArray != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "enum_query_string_array", enumQueryStringArray)); + } + if (enumQueryString != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_string", enumQueryString)); + } + if (enumQueryInteger != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_integer", enumQueryInteger)); + } + if (enumQueryDouble != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "enum_query_double", enumQueryDouble)); + } + if (enumHeaderStringArray != null) + { + localVarRequestOptions.HeaderParameters.Add("enum_header_string_array", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderStringArray)); // header parameter + } + if (enumHeaderString != null) + { + localVarRequestOptions.HeaderParameters.Add("enum_header_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumHeaderString)); // header parameter + } + if (enumFormStringArray != null) + { + localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter + } + if (enumFormString != null) + { + localVarRequestOptions.FormParameters.Add("enum_form_string", Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormString)); // form parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestEnumParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestEnumParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// + public void TestGroupParameters(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0) + { + TestGroupParametersWithHttpInfo(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestGroupParametersWithHttpInfo(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)); + if (stringGroup != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)); + } + if (int64Group != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)); + } + localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter + if (booleanGroup != null) + { + localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestGroupParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (bearer_test) required + // bearer authentication required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = this.Client.Delete("/fake", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestGroupParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestGroupParametersAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestGroupParametersWithHttpInfoAsync(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) + /// + /// Thrown when fails to make API call + /// Required String in group parameters + /// Required Boolean in group parameters + /// Required Integer in group parameters + /// String in group parameters (optional) + /// Boolean in group parameters (optional) + /// Integer in group parameters (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestGroupParametersWithHttpInfoAsync(int requiredStringGroup, bool requiredBooleanGroup, long requiredInt64Group, int? stringGroup = default(int?), bool? booleanGroup = default(bool?), long? int64Group = default(long?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_string_group", requiredStringGroup)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "required_int64_group", requiredInt64Group)); + if (stringGroup != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "string_group", stringGroup)); + } + if (int64Group != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "int64_group", int64Group)); + } + localVarRequestOptions.HeaderParameters.Add("required_boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(requiredBooleanGroup)); // header parameter + if (booleanGroup != null) + { + localVarRequestOptions.HeaderParameters.Add("boolean_group", Org.OpenAPITools.Client.ClientUtils.ParameterToString(booleanGroup)); // header parameter + } + + localVarRequestOptions.Operation = "FakeApi.TestGroupParameters"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (bearer_test) required + // bearer authentication required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/fake", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestGroupParameters", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestInlineAdditionalProperties(Dictionary requestBody, int operationIndex = 0) + { + TestInlineAdditionalPropertiesWithHttpInfo(requestBody); + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestInlineAdditionalPropertiesWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestInlineAdditionalProperties"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestInlineAdditionalProperties"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/inline-additionalProperties", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestInlineAdditionalPropertiesAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestInlineAdditionalPropertiesWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test inline additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestInlineAdditionalPropertiesWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestInlineAdditionalProperties"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestInlineAdditionalProperties"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/inline-additionalProperties", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestInlineAdditionalProperties", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestInlineFreeformAdditionalProperties(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0) + { + TestInlineFreeformAdditionalPropertiesWithHttpInfo(testInlineFreeformAdditionalPropertiesRequest); + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestInlineFreeformAdditionalPropertiesWithHttpInfo(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0) + { + // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set + if (testInlineFreeformAdditionalPropertiesRequest == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest; + + localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestInlineFreeformAdditionalPropertiesAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(testInlineFreeformAdditionalPropertiesRequest, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test inline free-form additionalProperties + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestInlineFreeformAdditionalPropertiesWithHttpInfoAsync(TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'testInlineFreeformAdditionalPropertiesRequest' is set + if (testInlineFreeformAdditionalPropertiesRequest == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'testInlineFreeformAdditionalPropertiesRequest' when calling FakeApi->TestInlineFreeformAdditionalProperties"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = testInlineFreeformAdditionalPropertiesRequest; + + localVarRequestOptions.Operation = "FakeApi.TestInlineFreeformAdditionalProperties"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/inline-freeform-additionalProperties", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestInlineFreeformAdditionalProperties", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// + public void TestJsonFormData(string param, string param2, int operationIndex = 0) + { + TestJsonFormDataWithHttpInfo(param, param2); + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo(string param, string param2, int operationIndex = 0) + { + // verify the required parameter 'param' is set + if (param == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter + + localVarRequestOptions.Operation = "FakeApi.TestJsonFormData"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/fake/jsonFormData", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestJsonFormData", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestJsonFormDataAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestJsonFormDataWithHttpInfoAsync(param, param2, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test json serialization of form data + /// + /// Thrown when fails to make API call + /// field1 + /// field2 + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestJsonFormDataWithHttpInfoAsync(string param, string param2, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'param' is set + if (param == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param' when calling FakeApi->TestJsonFormData"); + } + + // verify the required parameter 'param2' is set + if (param2 == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'param2' when calling FakeApi->TestJsonFormData"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.FormParameters.Add("param", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param)); // form parameter + localVarRequestOptions.FormParameters.Add("param2", Org.OpenAPITools.Client.ClientUtils.ParameterToString(param2)); // form parameter + + localVarRequestOptions.Operation = "FakeApi.TestJsonFormData"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/fake/jsonFormData", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestJsonFormData", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// + public void TestQueryParameterCollectionFormat(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) + { + TestQueryParameterCollectionFormatWithHttpInfo(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable); + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestQueryParameterCollectionFormatWithHttpInfo(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0) + { + // verify the required parameter 'pipe' is set + if (pipe == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'http' is set + if (http == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'url' is set + if (url == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'context' is set + if (context == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "pipe", pipe)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } + + localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Put("/fake/test-query-parameters", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestQueryParameterCollectionFormatAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestQueryParameterCollectionFormatWithHttpInfoAsync(pipe, ioutil, http, url, context, requiredNotNullable, requiredNullable, notRequiredNotNullable, notRequiredNullable, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// To test the collection format in query parameters + /// + /// Thrown when fails to make API call + /// + /// + /// + /// + /// + /// + /// + /// (optional) + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestQueryParameterCollectionFormatWithHttpInfoAsync(List pipe, List ioutil, List http, List url, List context, string requiredNotNullable, string requiredNullable, string? notRequiredNotNullable = default(string?), string? notRequiredNullable = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'pipe' is set + if (pipe == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pipe' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'ioutil' is set + if (ioutil == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'ioutil' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'http' is set + if (http == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'http' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'url' is set + if (url == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'url' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'context' is set + if (context == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'context' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNotNullable' is set + if (requiredNotNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNotNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + // verify the required parameter 'requiredNullable' is set + if (requiredNullable == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredNullable' when calling FakeApi->TestQueryParameterCollectionFormat"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "pipe", pipe)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "ioutil", ioutil)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("ssv", "http", http)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "url", url)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("multi", "context", context)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNotNullable", requiredNotNullable)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "requiredNullable", requiredNullable)); + if (notRequiredNotNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNotNullable", notRequiredNotNullable)); + } + if (notRequiredNullable != null) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "notRequiredNullable", notRequiredNullable)); + } + + localVarRequestOptions.Operation = "FakeApi.TestQueryParameterCollectionFormat"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/fake/test-query-parameters", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestQueryParameterCollectionFormat", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// + public void TestStringMapReference(Dictionary requestBody, int operationIndex = 0) + { + TestStringMapReferenceWithHttpInfo(requestBody); + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse TestStringMapReferenceWithHttpInfo(Dictionary requestBody, int operationIndex = 0) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestStringMapReference"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestStringMapReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/stringMap-reference", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestStringMapReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task TestStringMapReferenceAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await TestStringMapReferenceWithHttpInfoAsync(requestBody, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// test referenced string map + /// + /// Thrown when fails to make API call + /// request body + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestStringMapReferenceWithHttpInfoAsync(Dictionary requestBody, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'requestBody' is set + if (requestBody == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requestBody' when calling FakeApi->TestStringMapReference"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = requestBody; + + localVarRequestOptions.Operation = "FakeApi.TestStringMapReference"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/stringMap-reference", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestStringMapReference", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs new file mode 100644 index 000000000000..07c4ad398c66 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -0,0 +1,365 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeClassnameTags123ApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + ModelClient TestClassname(ModelClient modelClient, int operationIndex = 0); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + ApiResponse TestClassnameWithHttpInfo(ModelClient modelClient, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeClassnameTags123ApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + System.Threading.Tasks.Task TestClassnameAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// To test class name in snake case + /// + /// + /// To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + System.Threading.Tasks.Task> TestClassnameWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IFakeClassnameTags123Api : IFakeClassnameTags123ApiSync, IFakeClassnameTags123ApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class FakeClassnameTags123Api : IFakeClassnameTags123Api + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public FakeClassnameTags123Api(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public FakeClassnameTags123Api(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public FakeClassnameTags123Api(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ModelClient + public ModelClient TestClassname(ModelClient modelClient, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = TestClassnameWithHttpInfo(modelClient); + return localVarResponse.Data; + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// ApiResponse of ModelClient + public Org.OpenAPITools.Client.ApiResponse TestClassnameWithHttpInfo(ModelClient modelClient, int operationIndex = 0) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "FakeClassnameTags123Api.TestClassname"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key_query) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); + } + + // make the HTTP request + var localVarResponse = this.Client.Patch("/fake_classname_test", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ModelClient + public async System.Threading.Tasks.Task TestClassnameAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await TestClassnameWithHttpInfoAsync(modelClient, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// To test class name in snake case To test class name in snake case + /// + /// Thrown when fails to make API call + /// client model + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ModelClient) + public async System.Threading.Tasks.Task> TestClassnameWithHttpInfoAsync(ModelClient modelClient, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'modelClient' is set + if (modelClient == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'modelClient' when calling FakeClassnameTags123Api->TestClassname"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = modelClient; + + localVarRequestOptions.Operation = "FakeClassnameTags123Api.TestClassname"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key_query) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PatchAsync("/fake_classname_test", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("TestClassname", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs new file mode 100644 index 000000000000..4692618e20da --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -0,0 +1,2355 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// + void AddPet(Pet pet, int operationIndex = 0); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse AddPetWithHttpInfo(Pet pet, int operationIndex = 0); + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// + void DeletePet(long petId, string? apiKey = default(string?), int operationIndex = 0); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse DeletePetWithHttpInfo(long petId, string? apiKey = default(string?), int operationIndex = 0); + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// List<Pet> + List FindPetsByStatus(List status, int operationIndex = 0); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// ApiResponse of List<Pet> + ApiResponse> FindPetsByStatusWithHttpInfo(List status, int operationIndex = 0); + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// List<Pet> + [Obsolete] + List FindPetsByTags(List tags, int operationIndex = 0); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// ApiResponse of List<Pet> + [Obsolete] + ApiResponse> FindPetsByTagsWithHttpInfo(List tags, int operationIndex = 0); + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Pet + Pet GetPetById(long petId, int operationIndex = 0); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// ApiResponse of Pet + ApiResponse GetPetByIdWithHttpInfo(long petId, int operationIndex = 0); + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// + void UpdatePet(Pet pet, int operationIndex = 0); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse UpdatePetWithHttpInfo(Pet pet, int operationIndex = 0); + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// + void UpdatePetWithForm(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0); + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// ApiResponse + ApiResponse UploadFile(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithHttpInfo(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0); + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// ApiResponse + ApiResponse UploadFileWithRequiredFile(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Add a new pet to the store + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task DeletePetAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Deletes a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Finds Pets by status + /// + /// + /// Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + [Obsolete] + System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Finds Pets by tags + /// + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + [Obsolete] + System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Pet + System.Threading.Tasks.Task GetPetByIdAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Find pet by ID + /// + /// + /// Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task UpdatePetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Update an existing pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Updates a pet in the store with form data + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileWithRequiredFileWithHttpInfoAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApi : IPetApiSync, IPetApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class PetApi : IPetApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public PetApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public PetApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// + public void AddPet(Pet pet, int operationIndex = 0) + { + AddPetWithHttpInfo(pet); + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, int operationIndex = 0) + { + // verify the required parameter 'pet' is set + if (pet == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = pet; + + localVarRequestOptions.Operation = "PetApi.AddPet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "POST", "/pet", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/pet", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await AddPetWithHttpInfoAsync(pet, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Add a new pet to the store + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> AddPetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'pet' is set + if (pet == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->AddPet"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = pet; + + localVarRequestOptions.Operation = "PetApi.AddPet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "POST", "/pet", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("AddPet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// + public void DeletePet(long petId, string? apiKey = default(string?), int operationIndex = 0) + { + DeletePetWithHttpInfo(petId, apiKey); + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeletePetWithHttpInfo(long petId, string? apiKey = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (apiKey != null) + { + localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter + } + + localVarRequestOptions.Operation = "PetApi.DeletePet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = this.Client.Delete("/pet/{petId}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task DeletePetAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await DeletePetWithHttpInfoAsync(petId, apiKey, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a pet + /// + /// Thrown when fails to make API call + /// Pet id to delete + /// (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeletePetWithHttpInfoAsync(long petId, string? apiKey = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (apiKey != null) + { + localVarRequestOptions.HeaderParameters.Add("api_key", Org.OpenAPITools.Client.ClientUtils.ParameterToString(apiKey)); // header parameter + } + + localVarRequestOptions.Operation = "PetApi.DeletePet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeletePet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// List<Pet> + public List FindPetsByStatus(List status, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByStatusWithHttpInfo(status); + return localVarResponse.Data; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// ApiResponse of List<Pet> + public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpInfo(List status, int operationIndex = 0) + { + // verify the required parameter 'status' is set + if (status == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); + + localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByStatus", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/pet/findByStatus", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + public async System.Threading.Tasks.Task> FindPetsByStatusAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByStatusWithHttpInfoAsync(status, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Thrown when fails to make API call + /// Status values that need to be considered for filter (deprecated) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + public async System.Threading.Tasks.Task>> FindPetsByStatusWithHttpInfoAsync(List status, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'status' is set + if (status == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "status", status)); + + localVarRequestOptions.Operation = "PetApi.FindPetsByStatus"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByStatus", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByStatus", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByStatus", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// List<Pet> + [Obsolete] + public List FindPetsByTags(List tags, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = FindPetsByTagsWithHttpInfo(tags); + return localVarResponse.Data; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// ApiResponse of List<Pet> + [Obsolete] + public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo(List tags, int operationIndex = 0) + { + // verify the required parameter 'tags' is set + if (tags == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); + + localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByTags", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/pet/findByTags", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of List<Pet> + [Obsolete] + public async System.Threading.Tasks.Task> FindPetsByTagsAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await FindPetsByTagsWithHttpInfoAsync(tags, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Thrown when fails to make API call + /// Tags to filter by + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (List<Pet>) + [Obsolete] + public async System.Threading.Tasks.Task>> FindPetsByTagsWithHttpInfoAsync(List tags, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'tags' is set + if (tags == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("csv", "tags", tags)); + + localVarRequestOptions.Operation = "PetApi.FindPetsByTags"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "GET", "/pet/findByTags", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/pet/findByTags", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("FindPetsByTags", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Pet + public Pet GetPetById(long petId, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetPetByIdWithHttpInfo(petId); + return localVarResponse.Data; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// ApiResponse of Pet + public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petId, int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + + localVarRequestOptions.Operation = "PetApi.GetPetById"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api-key"))) + { + localVarRequestOptions.HeaderParameters.Add("api-key", this.Configuration.GetApiKeyWithPrefix("api-key")); + } + // authentication (api_key_query) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); + } + + // make the HTTP request + var localVarResponse = this.Client.Get("/pet/{petId}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Pet + public async System.Threading.Tasks.Task GetPetByIdAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetPetByIdWithHttpInfoAsync(petId, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Find pet by ID Returns a single pet + /// + /// Thrown when fails to make API call + /// ID of pet to return + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Pet) + public async System.Threading.Tasks.Task> GetPetByIdWithHttpInfoAsync(long petId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + + localVarRequestOptions.Operation = "PetApi.GetPetById"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api-key"))) + { + localVarRequestOptions.HeaderParameters.Add("api-key", this.Configuration.GetApiKeyWithPrefix("api-key")); + } + // authentication (api_key_query) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query"))) + { + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query"))); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetPetById", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// + public void UpdatePet(Pet pet, int operationIndex = 0) + { + UpdatePetWithHttpInfo(pet); + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet, int operationIndex = 0) + { + // verify the required parameter 'pet' is set + if (pet == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = pet; + + localVarRequestOptions.Operation = "PetApi.UpdatePet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "PUT", "/pet", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = this.Client.Put("/pet", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task UpdatePetAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await UpdatePetWithHttpInfoAsync(pet, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update an existing pet + /// + /// Thrown when fails to make API call + /// Pet object that needs to be added to the store + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdatePetWithHttpInfoAsync(Pet pet, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'pet' is set + if (pet == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'pet' when calling PetApi->UpdatePet"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json", + "application/xml" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = pet; + + localVarRequestOptions.Operation = "PetApi.UpdatePet"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + // authentication (http_signature_test) required + if (this.Configuration.HttpSigningConfiguration != null) + { + var HttpSigningHeaders = this.Configuration.HttpSigningConfiguration.GetHttpSignedHeader(this.Configuration.BasePath, "PUT", "/pet", localVarRequestOptions); + foreach (var headerItem in HttpSigningHeaders) + { + if (localVarRequestOptions.HeaderParameters.ContainsKey(headerItem.Key)) + { + localVarRequestOptions.HeaderParameters[headerItem.Key] = new List() { headerItem.Value }; + } + else + { + localVarRequestOptions.HeaderParameters.Add(headerItem.Key, headerItem.Value); + } + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/pet", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// + public void UpdatePetWithForm(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0) + { + UpdatePetWithFormWithHttpInfo(petId, name, status); + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdatePetWithFormWithHttpInfo(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (name != null) + { + localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter + } + if (status != null) + { + localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter + } + + localVarRequestOptions.Operation = "PetApi.UpdatePetWithForm"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/pet/{petId}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task UpdatePetWithFormAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await UpdatePetWithFormWithHttpInfoAsync(petId, name, status, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates a pet in the store with form data + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be updated + /// Updated name of the pet (optional) + /// Updated status of the pet (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdatePetWithFormWithHttpInfoAsync(long petId, string? name = default(string?), string? status = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/x-www-form-urlencoded" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (name != null) + { + localVarRequestOptions.FormParameters.Add("name", Org.OpenAPITools.Client.ClientUtils.ParameterToString(name)); // form parameter + } + if (status != null) + { + localVarRequestOptions.FormParameters.Add("status", Org.OpenAPITools.Client.ClientUtils.ParameterToString(status)); // form parameter + } + + localVarRequestOptions.Operation = "PetApi.UpdatePetWithForm"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdatePetWithForm", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// ApiResponse + public ApiResponse UploadFile(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithHttpInfo(petId, additionalMetadata, file); + return localVarResponse.Data; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// ApiResponse of ApiResponse + public Org.OpenAPITools.Client.ApiResponse UploadFileWithHttpInfo(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (file != null) + { + localVarRequestOptions.FileParameters.Add("file", file); + } + + localVarRequestOptions.Operation = "PetApi.UploadFile"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileWithHttpInfoAsync(petId, additionalMetadata, file, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileWithHttpInfoAsync(long petId, string? additionalMetadata = default(string?), System.IO.Stream? file = default(System.IO.Stream?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + if (file != null) + { + localVarRequestOptions.FileParameters.Add("file", file); + } + + localVarRequestOptions.Operation = "PetApi.UploadFile"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/pet/{petId}/uploadImage", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFile", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// ApiResponse of ApiResponse + public Org.OpenAPITools.Client.ApiResponse UploadFileWithRequiredFileWithHttpInfo(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0) + { + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); + + localVarRequestOptions.Operation = "PetApi.UploadFileWithRequiredFile"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = this.Client.Post("/fake/{petId}/uploadImageWithRequiredFile", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileWithRequiredFileAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await UploadFileWithRequiredFileWithHttpInfoAsync(petId, requiredFile, additionalMetadata, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileWithRequiredFileWithHttpInfoAsync(long petId, System.IO.Stream requiredFile, string? additionalMetadata = default(string?), int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "multipart/form-data" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("petId", Org.OpenAPITools.Client.ClientUtils.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) + { + localVarRequestOptions.FormParameters.Add("additionalMetadata", Org.OpenAPITools.Client.ClientUtils.ParameterToString(additionalMetadata)); // form parameter + } + localVarRequestOptions.FileParameters.Add("requiredFile", requiredFile); + + localVarRequestOptions.Operation = "PetApi.UploadFileWithRequiredFile"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (petstore_auth) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/fake/{petId}/uploadImageWithRequiredFile", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs new file mode 100644 index 000000000000..50765779d948 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,907 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// + void DeleteOrder(string orderId, int operationIndex = 0); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse DeleteOrderWithHttpInfo(string orderId, int operationIndex = 0); + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Dictionary<string, int> + Dictionary GetInventory(int operationIndex = 0); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Dictionary<string, int> + ApiResponse> GetInventoryWithHttpInfo(int operationIndex = 0); + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Order + Order GetOrderById(long orderId, int operationIndex = 0); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// ApiResponse of Order + ApiResponse GetOrderByIdWithHttpInfo(long orderId, int operationIndex = 0); + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Order + Order PlaceOrder(Order order, int operationIndex = 0); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// ApiResponse of Order + ApiResponse PlaceOrderWithHttpInfo(Order order, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task DeleteOrderAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Delete purchase order by ID + /// + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, int> + System.Threading.Tasks.Task> GetInventoryAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Returns pet inventories by status + /// + /// + /// Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, int>) + System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Order + System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Find purchase order by ID + /// + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Order + System.Threading.Tasks.Task PlaceOrderAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Place an order for a pet + /// + /// + /// + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApi : IStoreApiSync, IStoreApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class StoreApi : IStoreApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public StoreApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public StoreApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// + public void DeleteOrder(string orderId, int operationIndex = 0) + { + 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 + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(string orderId, int operationIndex = 0) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + localVarRequestOptions.Operation = "StoreApi.DeleteOrder"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/store/order/{order_id}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task DeleteOrderAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await DeleteOrderWithHttpInfoAsync(orderId, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// Thrown when fails to make API call + /// ID of the order that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteOrderWithHttpInfoAsync(string orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'orderId' is set + if (orderId == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + localVarRequestOptions.Operation = "StoreApi.DeleteOrder"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/store/order/{order_id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteOrder", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Dictionary<string, int> + public Dictionary GetInventory(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = GetInventoryWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Dictionary<string, int> + public Org.OpenAPITools.Client.ApiResponse> GetInventoryWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "StoreApi.GetInventory"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api-key"))) + { + localVarRequestOptions.HeaderParameters.Add("api-key", this.Configuration.GetApiKeyWithPrefix("api-key")); + } + + // make the HTTP request + var localVarResponse = this.Client.Get>("/store/inventory", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Dictionary<string, int> + public async System.Threading.Tasks.Task> GetInventoryAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse> localVarResponse = await GetInventoryWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Dictionary<string, int>) + public async System.Threading.Tasks.Task>> GetInventoryWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "StoreApi.GetInventory"; + localVarRequestOptions.OperationIndex = operationIndex; + + // authentication (api_key) required + if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api-key"))) + { + localVarRequestOptions.HeaderParameters.Add("api-key", this.Configuration.GetApiKeyWithPrefix("api-key")); + } + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync>("/store/inventory", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetInventory", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Order + public Order GetOrderById(long orderId, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetOrderByIdWithHttpInfo(orderId); + return localVarResponse.Data; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// ApiResponse of Order + public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long orderId, int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + localVarRequestOptions.Operation = "StoreApi.GetOrderById"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/store/order/{order_id}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Order + public async System.Threading.Tasks.Task GetOrderByIdAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetOrderByIdWithHttpInfoAsync(orderId, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions + /// + /// Thrown when fails to make API call + /// ID of pet that needs to be fetched + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + public async System.Threading.Tasks.Task> GetOrderByIdWithHttpInfoAsync(long orderId, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("order_id", Org.OpenAPITools.Client.ClientUtils.ParameterToString(orderId)); // path parameter + + localVarRequestOptions.Operation = "StoreApi.GetOrderById"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/store/order/{order_id}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetOrderById", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Order + public Order PlaceOrder(Order order, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = PlaceOrderWithHttpInfo(order); + return localVarResponse.Data; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// ApiResponse of Order + public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order order, int operationIndex = 0) + { + // verify the required parameter 'order' is set + if (order == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = order; + + localVarRequestOptions.Operation = "StoreApi.PlaceOrder"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/store/order", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of Order + public async System.Threading.Tasks.Task PlaceOrderAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await PlaceOrderWithHttpInfoAsync(order, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Place an order for a pet + /// + /// Thrown when fails to make API call + /// order placed for purchasing the pet + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (Order) + public async System.Threading.Tasks.Task> PlaceOrderWithHttpInfoAsync(Order order, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'order' is set + if (order == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = order; + + localVarRequestOptions.Operation = "StoreApi.PlaceOrder"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/store/order", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("PlaceOrder", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs new file mode 100644 index 000000000000..700610558ef8 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -0,0 +1,1699 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// + void CreateUser(User user, int operationIndex = 0); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse CreateUserWithHttpInfo(User user, int operationIndex = 0); + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// + void CreateUsersWithArrayInput(List user, int operationIndex = 0); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user, int operationIndex = 0); + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// + void CreateUsersWithListInput(List user, int operationIndex = 0); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse CreateUsersWithListInputWithHttpInfo(List user, int operationIndex = 0); + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// + void DeleteUser(string username, int operationIndex = 0); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse DeleteUserWithHttpInfo(string username, int operationIndex = 0); + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// User + User GetUserByName(string username, int operationIndex = 0); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// ApiResponse of User + ApiResponse GetUserByNameWithHttpInfo(string username, int operationIndex = 0); + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// string + string LoginUser(string username, string password, int operationIndex = 0); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// ApiResponse of string + ApiResponse LoginUserWithHttpInfo(string username, string password, int operationIndex = 0); + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// + void LogoutUser(int operationIndex = 0); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse LogoutUserWithHttpInfo(int operationIndex = 0); + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// + void UpdateUser(string username, User user, int operationIndex = 0); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + ApiResponse UpdateUserWithHttpInfo(string username, User user, int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task CreateUserAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Create user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Creates list of users with given input array + /// + /// + /// + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task DeleteUserAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Delete user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of User + System.Threading.Tasks.Task GetUserByNameAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Get user by user name + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (User) + System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + System.Threading.Tasks.Task LoginUserAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Logs user into the system + /// + /// + /// + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task LogoutUserAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Logs out current logged in user session + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + System.Threading.Tasks.Task UpdateUserAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// Updated user + /// + /// + /// This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApi : IUserApiSync, IUserApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class UserApi : IUserApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public UserApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public UserApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// + public void CreateUser(User user, int operationIndex = 0) + { + CreateUserWithHttpInfo(user); + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User user, int operationIndex = 0) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/user", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task CreateUserAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await CreateUserWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// Created user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUserWithHttpInfoAsync(User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUser"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/user", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// + public void CreateUsersWithArrayInput(List user, int operationIndex = 0) + { + CreateUsersWithArrayInputWithHttpInfo(user); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWithHttpInfo(List user, int operationIndex = 0) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUsersWithArrayInput"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/user/createWithArray", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await CreateUsersWithArrayInputWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUsersWithArrayInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithArrayInput"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUsersWithArrayInput"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithArray", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithArrayInput", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// + public void CreateUsersWithListInput(List user, int operationIndex = 0) + { + CreateUsersWithListInputWithHttpInfo(user); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithHttpInfo(List user, int operationIndex = 0) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUsersWithListInput"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Post("/user/createWithList", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task CreateUsersWithListInputAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await CreateUsersWithListInputWithHttpInfoAsync(user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates list of users with given input array + /// + /// Thrown when fails to make API call + /// List of user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> CreateUsersWithListInputWithHttpInfoAsync(List user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->CreateUsersWithListInput"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.CreateUsersWithListInput"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PostAsync("/user/createWithList", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("CreateUsersWithListInput", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// + public void DeleteUser(string username, int operationIndex = 0) + { + DeleteUserWithHttpInfo(username); + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string username, int operationIndex = 0) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + localVarRequestOptions.Operation = "UserApi.DeleteUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Delete("/user/{username}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task DeleteUserAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await DeleteUserWithHttpInfoAsync(username, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// The name that needs to be deleted + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> DeleteUserWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->DeleteUser"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + localVarRequestOptions.Operation = "UserApi.DeleteUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.DeleteAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("DeleteUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// User + public User GetUserByName(string username, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = GetUserByNameWithHttpInfo(username); + return localVarResponse.Data; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// ApiResponse of User + public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(string username, int operationIndex = 0) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + localVarRequestOptions.Operation = "UserApi.GetUserByName"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/user/{username}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of User + public async System.Threading.Tasks.Task GetUserByNameAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await GetUserByNameWithHttpInfoAsync(username, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Get user by user name + /// + /// Thrown when fails to make API call + /// The name that needs to be fetched. Use user1 for testing. + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (User) + public async System.Threading.Tasks.Task> GetUserByNameWithHttpInfoAsync(string username, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->GetUserByName"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + + localVarRequestOptions.Operation = "UserApi.GetUserByName"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("GetUserByName", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// string + public string LoginUser(string username, string password, int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = LoginUserWithHttpInfo(username, password); + return localVarResponse.Data; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// ApiResponse of string + public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string username, string password, int operationIndex = 0) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); + + localVarRequestOptions.Operation = "UserApi.LoginUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/user/login", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of string + public async System.Threading.Tasks.Task LoginUserAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await LoginUserWithHttpInfoAsync(username, password, operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// Logs user into the system + /// + /// Thrown when fails to make API call + /// The user name for login + /// The password for login in clear text + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (string) + public async System.Threading.Tasks.Task> LoginUserWithHttpInfoAsync(string username, string password, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + } + + // verify the required parameter 'password' is set + if (password == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/xml", + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "username", username)); + localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "password", password)); + + localVarRequestOptions.Operation = "UserApi.LoginUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/user/login", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LoginUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// + public void LogoutUser(int operationIndex = 0) + { + LogoutUserWithHttpInfo(); + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "UserApi.LogoutUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/user/logout", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task LogoutUserAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await LogoutUserWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Logs out current logged in user session + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> LogoutUserWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "UserApi.LogoutUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/user/logout", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("LogoutUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// + public void UpdateUser(string username, User user, int operationIndex = 0) + { + UpdateUserWithHttpInfo(username, user); + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// ApiResponse of Object(void) + public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string username, User user, int operationIndex = 0) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + } + + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); + } + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.UpdateUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Put("/user/{username}", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of void + public async System.Threading.Tasks.Task UpdateUserAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + await UpdateUserWithHttpInfoAsync(username, user, operationIndex, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// Thrown when fails to make API call + /// name that need to be deleted + /// Updated user object + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse + public async System.Threading.Tasks.Task> UpdateUserWithHttpInfoAsync(string username, User user, int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + // verify the required parameter 'username' is set + if (username == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + } + + // verify the required parameter 'user' is set + if (user == null) + { + throw new Org.OpenAPITools.Client.ApiException(400, "Missing required parameter 'user' when calling UserApi->UpdateUser"); + } + + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + "application/json" + }; + + // to determine the Accept header + string[] _accepts = new string[] { + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + localVarRequestOptions.PathParameters.Add("username", Org.OpenAPITools.Client.ClientUtils.ParameterToString(username)); // path parameter + localVarRequestOptions.Data = user; + + localVarRequestOptions.Operation = "UserApi.UpdateUser"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.PutAsync("/user/{username}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("UpdateUser", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs new file mode 100644 index 000000000000..332389566469 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -0,0 +1,838 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp; +using RestSharp.Serializers; +using RestSharpMethod = RestSharp.Method; +using FileIO = System.IO.File; +using Polly; +using Org.OpenAPITools.Client.Auth; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer + { + private readonly IReadableConfiguration _configuration; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); + + public T Deserialize(RestResponse response) + { + var result = (T)Deserialize(response, typeof(T)); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(RestResponse response, Type type) + { + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = response.RawBytes; + if (response.Headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? global::System.IO.Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in response.Headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + FileIO.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public ISerializer Serializer => this; + public IDeserializer Deserializer => this; + + public string[] AcceptedContentTypes => ContentType.JsonAccept; + + public SupportsContentType SupportsContentType => contentType => + contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || + contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); + + public ContentType ContentType { get; set; } = ContentType.Json; + + public DataFormat DataFormat => DataFormat.Json; + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(RestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(RestRequest request, RestResponse response); + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = GlobalConfiguration.Instance.BasePath; + } + + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + _baseUrl = basePath; + } + + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.Get; + break; + case HttpMethod.Post: + other = RestSharpMethod.Post; + break; + case HttpMethod.Put: + other = RestSharpMethod.Put; + break; + case HttpMethod.Delete: + other = RestSharpMethod.Delete; + break; + case HttpMethod.Head: + other = RestSharpMethod.Head; + break; + case HttpMethod.Options: + other = RestSharpMethod.Options; + break; + case HttpMethod.Patch: + other = RestSharpMethod.Patch; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + + return other; + } + + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. + /// Here, it is simply mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + RestRequest request = new RestRequest(path, Method(method)); + + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.AddHeader(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + + if (options.Data != null) + { + if (options.Data is Stream stream) + { + var contentType = "application/octet-stream"; + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes[0]; + } + + var bytes = ClientUtils.ReadAsBytes(stream); + request.AddParameter(contentType, bytes, ParameterType.RequestBody); + } + else + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + + request.AddJsonBody(options.Data); + } + } + + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var bytes = ClientUtils.ReadAsBytes(file); + var fileStream = file as FileStream; + if (fileStream != null) + request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); + else + request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); + } + } + } + + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + + return request; + } + + /// + /// Transforms a RestResponse instance into a new ApiResponse instance. + /// At this point, we have a concrete http response from the service. + /// Here, it is simply mapped into the [public] ApiResponse object. + /// + /// The RestSharp response object + /// A new ApiResponse instance. + private ApiResponse ToApiResponse(RestResponse response) + { + T result = response.Data; + string rawContent = response.Content; + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.ContentHeaders != null) + { + foreach (var responseHeader in response.ContentHeaders) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies.Cast()) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + + return transformed; + } + + /// + /// Executes the HTTP request for the current service. + /// Based on functions received it can be async or sync. + /// + /// Local function that executes http request and returns http response. + /// Local function to specify options for the service. + /// The RestSharp request object + /// The RestSharp options object + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// A new ApiResponse instance. + private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; + var clientOptions = new RestClientOptions(baseUrl) + { + ClientCertificates = configuration.ClientCertificates, + Timeout = configuration.Timeout, + Proxy = configuration.Proxy, + UserAgent = configuration.UserAgent, + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback + }; + setOptions(clientOptions); + + if (!string.IsNullOrEmpty(configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(configuration.OAuthClientId) && + !string.IsNullOrEmpty(configuration.OAuthClientSecret) && + configuration.OAuthFlow != null) + { + clientOptions.Authenticator = new OAuthAuthenticator( + configuration.OAuthTokenUrl, + configuration.OAuthClientId, + configuration.OAuthClientSecret, + configuration.OAuthScope, + configuration.OAuthFlow, + SerializerSettings, + configuration); + } + + using (RestClient client = new RestClient(clientOptions, + configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) + { + InterceptRequest(request); + + RestResponse response = await getResponse(client); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + try + { + response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + catch (Exception ex) + { + throw ex.InnerException != null ? ex.InnerException : ex; + } + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + else if (typeof(T).Name == "Byte[]") // for byte response + { + response.Data = (T)(object)response.RawBytes; + } + else if (typeof(T).Name == "String") // for string response + { + response.Data = (T)(object)response.Content; + } + + InterceptResponse(request, response); + + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies.Cast()) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + } + + private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) + { + if (policyResult.Outcome == OutcomeType.Successful) + { + return await client.Deserialize(policyResult.Result, cancellationToken); + } + else + { + return new RestResponse(request) + { + ErrorException = policyResult.FinalException + }; + } + } + + private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + Action setOptions = (clientOptions) => + { + var cookies = new CookieContainer(); + + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + cookies.Add(new Cookie(cookie.Name, cookie.Value)); + } + } + clientOptions.CookieContainer = cookies; + }; + + Func>> getResponse = (client) => + { + if (RetryConfiguration.RetryPolicy != null) + { + var policy = RetryConfiguration.RetryPolicy; + var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); + return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); + } + else + { + return Task.FromResult(client.Execute(request)); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); + } + + private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) + { + Action setOptions = (clientOptions) => + { + //no extra options + }; + + Func>> getResponse = async (client) => + { + if (RetryConfiguration.AsyncRetryPolicy != null) + { + var policy = RetryConfiguration.AsyncRetryPolicy; + var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); + return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); + } + else + { + return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration); + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); + } + #endregion ISynchronousClient + } +} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiException.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiException.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiException.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiResponse.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ApiResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthFlow.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Auth/TokenResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ClientUtils.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ExceptionFactory.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionFactory.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ExceptionFactory.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ExceptionFactory.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/GlobalConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/GlobalConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/GlobalConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/HttpMethod.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/HttpMethod.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/HttpMethod.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/HttpMethod.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs new file mode 100644 index 000000000000..c362a4f50519 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -0,0 +1,806 @@ +/* + * OpenAPI Petstore + * + * 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 + */ + + +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices; +using System.Security; +using System.Security.Cryptography; +using System.Text; +using System.Web; + +namespace Org.OpenAPITools.Client +{ + /// + /// Class for HttpSigning auth related parameter and methods + /// + public class HttpSigningConfiguration + { + /// + /// Initialize the HashAlgorithm and SigningAlgorithm to default value + /// + public HttpSigningConfiguration() + { + HashAlgorithm = HashAlgorithmName.SHA256; + SigningAlgorithm = "PKCS1-v15"; + } + + /// + ///Gets the Api keyId + /// + public string KeyId { get; set; } + + /// + /// Gets the Key file path + /// + public string KeyFilePath { get; set; } + + /// + /// Specify the API key in the form of a string, either configure the KeyString property or configure the KeyFilePath property. + /// + public string KeyString { get; set; } + + /// + /// Gets the key pass phrase for password protected key + /// + public SecureString KeyPassPhrase { get; set; } + + /// + /// Gets the HTTP signing header + /// + public List HttpSigningHeader { get; set; } + + /// + /// Gets the hash algorithm sha256 or sha512 + /// + public HashAlgorithmName HashAlgorithm { get; set; } + + /// + /// Gets the signing algorithm + /// + public string SigningAlgorithm { get; set; } + + /// + /// Gets the Signature validity period in seconds + /// + public int SignatureValidityPeriod { get; set; } + + private enum PrivateKeyType + { + None = 0, + RSA = 1, + ECDSA = 2, + } + + /// + /// Gets the Headers for HttpSigning + /// + /// Base path + /// HTTP method + /// Path + /// Request options + /// Http signed headers + public Dictionary GetHttpSignedHeader(string basePath,string method, string path, RequestOptions requestOptions) + { + const string HEADER_REQUEST_TARGET = "(request-target)"; + //The time when the HTTP signature expires. The API server should reject HTTP requests + //that have expired. + const string HEADER_EXPIRES = "(expires)"; + //The 'Date' header. + const string HEADER_DATE = "Date"; + //The 'Host' header. + const string HEADER_HOST = "Host"; + //The time when the HTTP signature was generated. + const string HEADER_CREATED = "(created)"; + //When the 'Digest' header is included in the HTTP signature, the client automatically + //computes the digest of the HTTP request body, per RFC 3230. + const string HEADER_DIGEST = "Digest"; + //The 'Authorization' header is automatically generated by the client. It includes + //the list of signed headers and a base64-encoded signature. + const string HEADER_AUTHORIZATION = "Authorization"; + + //Read the api key from the file + if(File.Exists(KeyFilePath)) + { + this.KeyString = ReadApiKeyFromFile(KeyFilePath); + } + else if(string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided. Supply it using either KeyFilePath or KeyString"); + } + + //Hash table to store singed headers + var HttpSignedRequestHeader = new Dictionary(); + var HttpSignatureHeader = new Dictionary(); + + if (HttpSigningHeader.Count == 0) + { + HttpSigningHeader.Add("(created)"); + } + + if (requestOptions.PathParameters != null) + { + foreach (var pathParam in requestOptions.PathParameters) + { + var tempPath = path.Replace(pathParam.Key, "0"); + path = string.Format(tempPath, pathParam.Value); + } + } + + var httpValues = HttpUtility.ParseQueryString(string.Empty); + foreach (var parameter in requestOptions.QueryParameters) + { +#if (NETCOREAPP) + if (parameter.Value.Count > 1) + { // array + foreach (var value in parameter.Value) + { + httpValues.Add(HttpUtility.UrlEncode(parameter.Key) + "[]", value); + } + } + else + { + httpValues.Add(HttpUtility.UrlEncode(parameter.Key), parameter.Value[0]); + } +#else + if (parameter.Value.Count > 1) + { // array + foreach (var value in parameter.Value) + { + httpValues.Add(parameter.Key + "[]", value); + } + } + else + { + httpValues.Add(parameter.Key, parameter.Value[0]); + } +#endif + } + var uriBuilder = new UriBuilder(string.Concat(basePath, path)); + uriBuilder.Query = httpValues.ToString().Replace("+", "%20"); + + var dateTime = DateTime.Now; + string Digest = string.Empty; + + //get the body + string requestBody = string.Empty; + if (requestOptions.Data != null) + { + var serializerSettings = new JsonSerializerSettings(); + requestBody = JsonConvert.SerializeObject(requestOptions.Data, serializerSettings); + } + + if (HashAlgorithm == HashAlgorithmName.SHA256) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + Digest = string.Format("SHA-256={0}", Convert.ToBase64String(bodyDigest)); + } + else if (HashAlgorithm == HashAlgorithmName.SHA512) + { + var bodyDigest = GetStringHash(HashAlgorithm, requestBody); + Digest = string.Format("SHA-512={0}", Convert.ToBase64String(bodyDigest)); + } + else + { + throw new Exception(string.Format("{0} not supported", HashAlgorithm)); + } + + foreach (var header in HttpSigningHeader) + { + if (header.Equals(HEADER_REQUEST_TARGET)) + { + var targetUrl = string.Format("{0} {1}{2}", method.ToLower(), uriBuilder.Path, uriBuilder.Query); + HttpSignatureHeader.Add(header.ToLower(), targetUrl); + } + else if (header.Equals(HEADER_EXPIRES)) + { + var expireDateTime = dateTime.AddSeconds(SignatureValidityPeriod); + HttpSignatureHeader.Add(header.ToLower(), GetUnixTime(expireDateTime).ToString()); + } + else if (header.Equals(HEADER_DATE)) + { + var utcDateTime = dateTime.ToUniversalTime().ToString("r"); + HttpSignatureHeader.Add(header.ToLower(), utcDateTime); + HttpSignedRequestHeader.Add(HEADER_DATE, utcDateTime); + } + else if (header.Equals(HEADER_HOST)) + { + HttpSignatureHeader.Add(header.ToLower(), uriBuilder.Host); + HttpSignedRequestHeader.Add(HEADER_HOST, uriBuilder.Host); + } + else if (header.Equals(HEADER_CREATED)) + { + HttpSignatureHeader.Add(header.ToLower(), GetUnixTime(dateTime).ToString()); + } + else if (header.Equals(HEADER_DIGEST)) + { + HttpSignedRequestHeader.Add(HEADER_DIGEST, Digest); + HttpSignatureHeader.Add(header.ToLower(), Digest); + } + else + { + bool isHeaderFound = false; + foreach (var item in requestOptions.HeaderParameters) + { + if (string.Equals(item.Key, header, StringComparison.OrdinalIgnoreCase)) + { + HttpSignatureHeader.Add(header.ToLower(), item.Value.ToString()); + isHeaderFound = true; + break; + } + } + if (!isHeaderFound) + { + throw new Exception(string.Format("Cannot sign HTTP request.Request does not contain the {0} header.",header)); + } + } + + } + var headersKeysString = string.Join(" ", HttpSignatureHeader.Keys); + var headerValuesList = new List(); + + foreach (var keyVal in HttpSignatureHeader) + { + headerValuesList.Add(string.Format("{0}: {1}", keyVal.Key, keyVal.Value)); + } + //Concatenate headers value separated by new line + var headerValuesString = string.Join("\n", headerValuesList); + var signatureStringHash = GetStringHash(HashAlgorithm, headerValuesString); + string headerSignatureStr = null; + var keyType = GetKeyType(KeyString); + + if (keyType == PrivateKeyType.RSA) + { + headerSignatureStr = GetRSASignature(signatureStringHash); + } + else if (keyType == PrivateKeyType.ECDSA) + { + headerSignatureStr = GetECDSASignature(signatureStringHash); + } + else + { + throw new Exception(string.Format("Private key type {0} not supported", keyType)); + } + const string cryptographicScheme = "hs2019"; + var authorizationHeaderValue = string.Format("Signature keyId=\"{0}\",algorithm=\"{1}\"", + KeyId, cryptographicScheme); + + if (HttpSignatureHeader.ContainsKey(HEADER_CREATED)) + { + authorizationHeaderValue += string.Format(",created={0}", HttpSignatureHeader[HEADER_CREATED]); + } + + if (HttpSignatureHeader.ContainsKey(HEADER_EXPIRES)) + { + authorizationHeaderValue += string.Format(",expires={0}", HttpSignatureHeader[HEADER_EXPIRES]); + } + + authorizationHeaderValue += string.Format(",headers=\"{0}\",signature=\"{1}\"", + headersKeysString, headerSignatureStr); + HttpSignedRequestHeader.Add(HEADER_AUTHORIZATION, authorizationHeaderValue); + return HttpSignedRequestHeader; + } + + private byte[] GetStringHash(HashAlgorithmName hashAlgorithmName, string stringToBeHashed) + { + HashAlgorithm? hashAlgorithm = null; + + if (hashAlgorithmName == HashAlgorithmName.SHA1) + hashAlgorithm = SHA1.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA256) + hashAlgorithm = SHA256.Create(); + + if (hashAlgorithmName == HashAlgorithmName.SHA512) + hashAlgorithm = SHA512.Create(); + + if (hashAlgorithmName == HashAlgorithmName.MD5) + hashAlgorithm = MD5.Create(); + + if (hashAlgorithm == null) + throw new NullReferenceException($"{ nameof(hashAlgorithm) } was null."); + + byte[] bytes = Encoding.UTF8.GetBytes(stringToBeHashed); + byte[] stringHash = hashAlgorithm.ComputeHash(bytes); + return stringHash; + } + + private int GetUnixTime(DateTime date2) + { + DateTime date1 = new DateTime(1970, 01, 01); + TimeSpan timeSpan = date2 - date1; + return (int)timeSpan.TotalSeconds; + } + + private string GetRSASignature(byte[] stringToSign) + { + if (string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + RSA rsa = GetRSAProviderFromPemFile(KeyString, KeyPassPhrase); + if (SigningAlgorithm == "RSASSA-PSS") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pss); + return Convert.ToBase64String(signedbytes); + } + else if (SigningAlgorithm == "PKCS1-v15") + { + var signedbytes = rsa.SignHash(stringToSign, HashAlgorithm, RSASignaturePadding.Pkcs1); + return Convert.ToBase64String(signedbytes); + } + else + { + return string.Empty; + } + } + + /// + /// Gets the ECDSA signature + /// + /// + /// ECDSA signature + private string GetECDSASignature(byte[] dataToSign) + { + if (!File.Exists(KeyFilePath) && string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + var keyStr = KeyString; + const string ecKeyHeader = "-----BEGIN EC PRIVATE KEY-----"; + const string ecKeyFooter = "-----END EC PRIVATE KEY-----"; + var ecKeyBase64String = keyStr.Replace(ecKeyHeader, "").Replace(ecKeyFooter, "").Trim(); + var keyBytes = System.Convert.FromBase64String(ecKeyBase64String); + var ecdsa = ECDsa.Create(); + + var byteCount = 0; + if (KeyPassPhrase != null) + { + IntPtr unmanagedString = IntPtr.Zero; + try + { + // convert secure string to byte array + unmanagedString = Marshal.SecureStringToGlobalAllocUnicode(KeyPassPhrase); + ecdsa.ImportEncryptedPkcs8PrivateKey(Encoding.UTF8.GetBytes(Marshal.PtrToStringUni(unmanagedString)), keyBytes, out byteCount); + } + finally + { + if (unmanagedString != IntPtr.Zero) + { + Marshal.ZeroFreeBSTR(unmanagedString); + } + } + } + else + ecdsa.ImportPkcs8PrivateKey(keyBytes, out byteCount); + + var derBytes = ecdsa.SignHash(dataToSign, DSASignatureFormat.Rfc3279DerSequence); + var signedString = System.Convert.ToBase64String(derBytes); + + return signedString; + } + + /// + /// Convert ANS1 format to DER format. Not recommended to use because it generate invalid signature occasionally. + /// + /// + /// + private byte[] ConvertToECDSAANS1Format(byte[] signedBytes) + { + var derBytes = new List(); + byte derLength = 68; //default length for ECDSA code signing bit 0x44 + byte rbytesLength = 32; //R length 0x20 + byte sbytesLength = 32; //S length 0x20 + var rBytes = new List(); + var sBytes = new List(); + for (int i = 0; i < 32; i++) + { + rBytes.Add(signedBytes[i]); + } + for (int i = 32; i < 64; i++) + { + sBytes.Add(signedBytes[i]); + } + + if (rBytes[0] > 0x7F) + { + derLength++; + rbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(rBytes); + rBytes.Clear(); + rBytes.Add(0x00); + rBytes.AddRange(tempBytes); + } + + if (sBytes[0] > 0x7F) + { + derLength++; + sbytesLength++; + var tempBytes = new List(); + tempBytes.AddRange(sBytes); + sBytes.Clear(); + sBytes.Add(0x00); + sBytes.AddRange(tempBytes); + + } + + derBytes.Add(48); //start of the sequence 0x30 + derBytes.Add(derLength); //total length r length, type and r bytes + + derBytes.Add(2); //tag for integer + derBytes.Add(rbytesLength); //length of r + derBytes.AddRange(rBytes); + + derBytes.Add(2); //tag for integer + derBytes.Add(sbytesLength); //length of s + derBytes.AddRange(sBytes); + return derBytes.ToArray(); + } + + private RSACryptoServiceProvider GetRSAProviderFromPemFile(string keyString, SecureString keyPassPhrase = null) + { + if (string.IsNullOrEmpty(KeyString)) + { + throw new Exception("No API key has been provided."); + } + + const string pempubheader = "-----BEGIN PUBLIC KEY-----"; + const string pempubfooter = "-----END PUBLIC KEY-----"; + bool isPrivateKeyFile = true; + byte[] pemkey = null; + string pemstr = keyString; + + if (pemstr.StartsWith(pempubheader) && pemstr.EndsWith(pempubfooter)) + { + isPrivateKeyFile = false; + } + + if (isPrivateKeyFile) + { + pemkey = ConvertPrivateKeyToBytes(pemstr, keyPassPhrase); + if (pemkey == null) + { + return null; + } + return DecodeRSAPrivateKey(pemkey); + } + return null; + } + + private byte[] ConvertPrivateKeyToBytes(string instr, SecureString keyPassPhrase = null) + { + const string pemprivheader = "-----BEGIN RSA PRIVATE KEY-----"; + const string pemprivfooter = "-----END RSA PRIVATE KEY-----"; + string pemstr = instr.Trim(); + byte[] binkey; + + if (!pemstr.StartsWith(pemprivheader) || !pemstr.EndsWith(pemprivfooter)) + { + return null; + } + + StringBuilder sb = new StringBuilder(pemstr); + sb.Replace(pemprivheader, ""); + sb.Replace(pemprivfooter, ""); + string pvkstr = sb.ToString().Trim(); + + try + { // if there are no PEM encryption info lines, this is an UNencrypted PEM private key + binkey = Convert.FromBase64String(pvkstr); + return binkey; + } + catch (global::System.FormatException) + { + StringReader str = new StringReader(pvkstr); + + //-------- read PEM encryption info. lines and extract salt ----- + if (!str.ReadLine().StartsWith("Proc-Type: 4,ENCRYPTED")) + { + return null; + } + string saltline = str.ReadLine(); + if (!saltline.StartsWith("DEK-Info: DES-EDE3-CBC,")) + { + return null; + } + string saltstr = saltline.Substring(saltline.IndexOf(",") + 1).Trim(); + byte[] salt = new byte[saltstr.Length / 2]; + for (int i = 0; i < salt.Length; i++) + salt[i] = Convert.ToByte(saltstr.Substring(i * 2, 2), 16); + if (str.ReadLine() != "") + { + return null; + } + + //------ remaining b64 data is encrypted RSA key ---- + string encryptedstr = str.ReadToEnd(); + + try + { //should have b64 encrypted RSA key now + binkey = Convert.FromBase64String(encryptedstr); + } + catch (global::System.FormatException) + { //data is not in base64 format + return null; + } + + byte[] deskey = GetEncryptedKey(salt, keyPassPhrase, 1, 2); // count=1 (for OpenSSL implementation); 2 iterations to get at least 24 bytes + if (deskey == null) + { + return null; + } + + //------ Decrypt the encrypted 3des-encrypted RSA private key ------ + byte[] rsakey = DecryptKey(binkey, deskey, salt); //OpenSSL uses salt value in PEM header also as 3DES IV + return rsakey; + } + } + + private RSACryptoServiceProvider DecodeRSAPrivateKey(byte[] privkey) + { + byte[] bytesModulus, bytesE, bytesD, bytesP, bytesQ, bytesDP, bytesDQ, bytesIQ; + + // --------- Set up stream to decode the asn.1 encoded RSA private key ------ + MemoryStream mem = new MemoryStream(privkey); + BinaryReader binr = new BinaryReader(mem); //wrap Memory Stream with BinaryReader for easy reading + byte bt = 0; + ushort twobytes = 0; + int elems = 0; + try + { + twobytes = binr.ReadUInt16(); + if (twobytes == 0x8130) //data read as little endian order (actual data order for Sequence is 30 81) + { + binr.ReadByte(); //advance 1 byte + } + else if (twobytes == 0x8230) + { + binr.ReadInt16(); //advance 2 bytes + } + else + { + return null; + } + + twobytes = binr.ReadUInt16(); + if (twobytes != 0x0102) //version number + { + return null; + } + bt = binr.ReadByte(); + if (bt != 0x00) + { + return null; + } + + //------ all private key components are Integer sequences ---- + elems = GetIntegerSize(binr); + bytesModulus = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesE = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesD = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesDP = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesDQ = binr.ReadBytes(elems); + + elems = GetIntegerSize(binr); + bytesIQ = binr.ReadBytes(elems); + + // ------- create RSACryptoServiceProvider instance and initialize with public key ----- + RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); + RSAParameters RSAparams = new RSAParameters(); + RSAparams.Modulus = bytesModulus; + RSAparams.Exponent = bytesE; + RSAparams.D = bytesD; + RSAparams.P = bytesP; + RSAparams.Q = bytesQ; + RSAparams.DP = bytesDP; + RSAparams.DQ = bytesDQ; + RSAparams.InverseQ = bytesIQ; + RSA.ImportParameters(RSAparams); + return RSA; + } + catch (Exception) + { + return null; + } + finally + { + binr.Close(); + } + } + + private int GetIntegerSize(BinaryReader binr) + { + byte bt = 0; + byte lowbyte = 0x00; + byte highbyte = 0x00; + int count = 0; + bt = binr.ReadByte(); + if (bt != 0x02) //expect integer + { + return 0; + } + bt = binr.ReadByte(); + + if (bt == 0x81) + { + count = binr.ReadByte(); // data size in next byte + } + else if (bt == 0x82) + { + highbyte = binr.ReadByte(); // data size in next 2 bytes + lowbyte = binr.ReadByte(); + byte[] modint = { lowbyte, highbyte, 0x00, 0x00 }; + count = BitConverter.ToInt32(modint, 0); + } + else + { + count = bt; // we already have the data size + } + while (binr.ReadByte() == 0x00) + { + //remove high order zeros in data + count -= 1; + } + binr.BaseStream.Seek(-1, SeekOrigin.Current); + //last ReadByte wasn't a removed zero, so back up a byte + return count; + } + + private byte[] GetEncryptedKey(byte[] salt, SecureString secpswd, int count, int miter) + { + IntPtr unmanagedPswd = IntPtr.Zero; + const int HASHLENGTH = 16; //MD5 bytes + byte[] keymaterial = new byte[HASHLENGTH * miter]; //to store concatenated Mi hashed results + + byte[] psbytes = new byte[secpswd.Length]; + unmanagedPswd = Marshal.SecureStringToGlobalAllocAnsi(secpswd); + Marshal.Copy(unmanagedPswd, psbytes, 0, psbytes.Length); + Marshal.ZeroFreeGlobalAllocAnsi(unmanagedPswd); + + // --- concatenate salt and pswd bytes into fixed data array --- + byte[] data00 = new byte[psbytes.Length + salt.Length]; + Array.Copy(psbytes, data00, psbytes.Length); //copy the pswd bytes + Array.Copy(salt, 0, data00, psbytes.Length, salt.Length); //concatenate the salt bytes + + // ---- do multi-hashing and concatenate results D1, D2 ... into keymaterial bytes ---- + MD5 md5 = MD5.Create(); + byte[] result = null; + byte[] hashtarget = new byte[HASHLENGTH + data00.Length]; //fixed length initial hashtarget + + for (int j = 0; j < miter; j++) + { + // ---- Now hash consecutively for count times ------ + if (j == 0) + { + result = data00; //initialize + } + else + { + Array.Copy(result, hashtarget, result.Length); + Array.Copy(data00, 0, hashtarget, result.Length, data00.Length); + result = hashtarget; + } + + for (int i = 0; i < count; i++) + { + result = md5.ComputeHash(result); + } + Array.Copy(result, 0, keymaterial, j * HASHLENGTH, result.Length); //concatenate to keymaterial + } + byte[] deskey = new byte[24]; + Array.Copy(keymaterial, deskey, deskey.Length); + + Array.Clear(psbytes, 0, psbytes.Length); + Array.Clear(data00, 0, data00.Length); + Array.Clear(result, 0, result.Length); + Array.Clear(hashtarget, 0, hashtarget.Length); + Array.Clear(keymaterial, 0, keymaterial.Length); + return deskey; + } + + private byte[] DecryptKey(byte[] cipherData, byte[] desKey, byte[] IV) + { + MemoryStream memst = new MemoryStream(); + TripleDES alg = TripleDES.Create(); + alg.Key = desKey; + alg.IV = IV; + try + { + CryptoStream cs = new CryptoStream(memst, alg.CreateDecryptor(), CryptoStreamMode.Write); + cs.Write(cipherData, 0, cipherData.Length); + cs.Close(); + } + catch (Exception) + { + return null; + } + byte[] decryptedData = memst.ToArray(); + return decryptedData; + } + + /// + /// Detect the key type from the pem file. + /// + /// api key in string format + /// Private Key Type + private PrivateKeyType GetKeyType(string keyString) + { + string[] key = null; + + if (string.IsNullOrEmpty(keyString)) + { + throw new Exception("No API key has been provided."); + } + + const string ecPrivateKeyHeader = "BEGIN EC PRIVATE KEY"; + const string ecPrivateKeyFooter = "END EC PRIVATE KEY"; + const string rsaPrivateKeyHeader = "BEGIN RSA PRIVATE KEY"; + const string rsaPrivateFooter = "END RSA PRIVATE KEY"; + //var pkcs8Header = "BEGIN PRIVATE KEY"; + //var pkcs8Footer = "END PRIVATE KEY"; + PrivateKeyType keyType; + key = KeyString.TrimEnd().Split('\n'); + + if (key[0].Contains(rsaPrivateKeyHeader) && + key[key.Length - 1].ToString().Contains(rsaPrivateFooter)) + { + keyType = PrivateKeyType.RSA; + } + else if (key[0].Contains(ecPrivateKeyHeader) && + key[key.Length - 1].ToString().Contains(ecPrivateKeyFooter)) + { + keyType = PrivateKeyType.ECDSA; + } + else + { + throw new Exception("The key file path does not exist or key is invalid or key is not supported"); + } + return keyType; + } + + /// + /// Read the api key form the api key file path and stored it in KeyString property. + /// + /// api key file path + private string ReadApiKeyFromFile(string apiKeyFilePath) + { + string apiKeyString = null; + + if(File.Exists(apiKeyFilePath)) + { + apiKeyString = File.ReadAllText(apiKeyFilePath); + } + else + { + throw new Exception("Provided API key file path does not exists."); + } + return apiKeyString; + } + } +} diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IApiAccessor.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/IApiAccessor.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IApiAccessor.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/IApiAccessor.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IAsynchronousClient.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/IAsynchronousClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IAsynchronousClient.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/IAsynchronousClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ISynchronousClient.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ISynchronousClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ISynchronousClient.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/ISynchronousClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Multimap.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Multimap.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Multimap.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/Multimap.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/RequestOptions.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/RequestOptions.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/RequestOptions.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/RequestOptions.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/RetryConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/RetryConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/RetryConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Client/RetryConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Activity.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Activity.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Animal.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Animal.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Animal.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ApiResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Apple.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Apple.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Apple.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/AppleReq.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ArrayTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Banana.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Banana.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/BananaReq.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/BasquePig.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Capitalization.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Cat.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Cat.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Category.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Category.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ChildCat.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ClassModel.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/DanishPig.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/DateOnlyClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/DeprecatedObject.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Dog.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Dog.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Dog.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Drawing.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Drawing.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumArrays.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/EnumClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EnumTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/EquilateralTriangle.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/File.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/File.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/File.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Foo.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Foo.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Foo.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/FormatTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Fruit.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Fruit.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/FruitReq.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/FruitReq.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/FruitReq.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/GmFruit.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/GrandparentAnimal.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/GrandparentAnimal.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/GrandparentAnimal.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/HealthCheckResult.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/HealthCheckResult.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/HealthCheckResult.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/List.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/List.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/List.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/LiteralStringClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Mammal.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Mammal.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Mammal.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MapTest.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MapTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixLog.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixLog.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixLog.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixLog.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOf.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedAnyOfContent.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOf.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedOneOfContent.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/MixedSubId.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Model200Response.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ModelClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Name.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Name.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NullableClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NullableGuidClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NullableShape.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/NumberOnly.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OneOfString.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Order.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Order.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterComposite.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnum.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnum.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnum.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnumInteger.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnumInteger.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnumInteger.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnumTest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/OuterEnumTest.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/OuterEnumTest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ParentPet.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ParentPet.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ParentPet.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Pet.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Pet.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Pig.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Pig.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Pig.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/PolymorphicProperty.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Quadrilateral.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/RequiredClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Return.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Return.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHash.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ScaleneTriangle.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Shape.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Shape.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Shape.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ShapeInterface.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ShapeOrNull.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/SpecialModelName.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Tag.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Tag.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Triangle.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Triangle.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Triangle.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/TriangleInterface.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/User.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/User.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/User.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Whale.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Whale.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/Zebra.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/Zebra.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs rename to samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..9c6388725ca5 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,36 @@ + + + + false + net8.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + annotations + false + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.gitignore b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.gitignore new file mode 100644 index 000000000000..1ee53850b84c --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.openapi-generator-ignore b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.openapi-generator-ignore new file mode 100644 index 000000000000..7484ee590a38 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/.openapi-generator/FILES b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.openapi-generator/FILES similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/.openapi-generator/FILES rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.openapi-generator/FILES diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.openapi-generator/VERSION b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.openapi-generator/VERSION new file mode 100644 index 000000000000..884119126398 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0-SNAPSHOT diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/Org.OpenAPITools.sln b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/Org.OpenAPITools.sln similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/Org.OpenAPITools.sln rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/Org.OpenAPITools.sln diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/README.md b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/README.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/README.md rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/README.md diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/api/openapi.yaml new file mode 100644 index 000000000000..a84e041a00fa --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/api/openapi.yaml @@ -0,0 +1,35 @@ +openapi: 3.0.0 +info: + description: Thic spec contains endpoints with dates in different formats + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Dates + version: 1.0.0 +servers: +- url: / +paths: + /now: + get: + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/_now_get_200_response' + description: now dates +components: + schemas: + _now_get_200_response: + example: + today: 2000-01-23 + now: 2000-01-23T04:56:07.000+00:00 + properties: + today: + format: date + type: string + now: + format: date-time + type: string + type: object + diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/appveyor.yml b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/appveyor.yml new file mode 100644 index 000000000000..f76f63cee506 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/appveyor.yml @@ -0,0 +1,9 @@ +# auto-generated by OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) +# +image: Visual Studio 2019 +clone_depth: 1 +build_script: +- dotnet build -c Release +- dotnet test -c Release +after_build: +- dotnet pack .\src\Org.OpenAPITools\Org.OpenAPITools.csproj -o ../../output -c Release --no-build diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/docs/DefaultApi.md b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/docs/DefaultApi.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/docs/DefaultApi.md rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/docs/DefaultApi.md diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/docs/NowGet200Response.md b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/docs/NowGet200Response.md similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/docs/NowGet200Response.md rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/docs/NowGet200Response.md diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/git_push.sh b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/git_push.sh similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/git_push.sh rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/git_push.sh diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Model/NowGet200ResponseTests.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Model/NowGet200ResponseTests.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools.Test/Model/NowGet200ResponseTests.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Model/NowGet200ResponseTests.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj new file mode 100644 index 000000000000..64ebed26518e --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -0,0 +1,20 @@ + + + + Org.OpenAPITools.Test + Org.OpenAPITools.Test + net8.0 + false + annotations + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs new file mode 100644 index 000000000000..40964553f7f7 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -0,0 +1,327 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Net; +using System.Net.Mime; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApiSync : IApiAccessor + { + #region Synchronous Operations + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// NowGet200Response + NowGet200Response NowGet(int operationIndex = 0); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of NowGet200Response + ApiResponse NowGetWithHttpInfo(int operationIndex = 0); + #endregion Synchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApiAsync : IApiAccessor + { + #region Asynchronous Operations + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of NowGet200Response + System.Threading.Tasks.Task NowGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + + /// + /// + /// + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (NowGet200Response) + System.Threading.Tasks.Task> NowGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)); + #endregion Asynchronous Operations + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IDefaultApi : IDefaultApiSync, IDefaultApiAsync + { + + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public partial class DefaultApi : IDefaultApi + { + private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null; + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi() : this((string)null) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// + public DefaultApi(string basePath) + { + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + new Org.OpenAPITools.Client.Configuration { BasePath = basePath } + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using Configuration object + /// + /// An instance of Configuration + /// + public DefaultApi(Org.OpenAPITools.Client.Configuration configuration) + { + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Configuration = Org.OpenAPITools.Client.Configuration.MergeConfigurations( + Org.OpenAPITools.Client.GlobalConfiguration.Instance, + configuration + ); + this.Client = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + this.AsynchronousClient = new Org.OpenAPITools.Client.ApiClient(this.Configuration.BasePath); + ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// Initializes a new instance of the class + /// using a Configuration object and client instance. + /// + /// The client interface for synchronous API access. + /// The client interface for asynchronous API access. + /// The configuration object. + public DefaultApi(Org.OpenAPITools.Client.ISynchronousClient client, Org.OpenAPITools.Client.IAsynchronousClient asyncClient, Org.OpenAPITools.Client.IReadableConfiguration configuration) + { + if (client == null) throw new ArgumentNullException("client"); + if (asyncClient == null) throw new ArgumentNullException("asyncClient"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + this.Client = client; + this.AsynchronousClient = asyncClient; + this.Configuration = configuration; + this.ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory; + } + + /// + /// The client for accessing this underlying API asynchronously. + /// + public Org.OpenAPITools.Client.IAsynchronousClient AsynchronousClient { get; set; } + + /// + /// The client for accessing this underlying API synchronously. + /// + public Org.OpenAPITools.Client.ISynchronousClient Client { get; set; } + + /// + /// Gets the base path of the API client. + /// + /// The base path + public string GetBasePath() + { + return this.Configuration.BasePath; + } + + /// + /// Gets or sets the configuration object + /// + /// An instance of the Configuration + public Org.OpenAPITools.Client.IReadableConfiguration Configuration { get; set; } + + /// + /// Provides a factory method hook for the creation of exceptions. + /// + public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory + { + get + { + if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1) + { + throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported."); + } + return _exceptionFactory; + } + set { _exceptionFactory = value; } + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// NowGet200Response + public NowGet200Response NowGet(int operationIndex = 0) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = NowGetWithHttpInfo(); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// ApiResponse of NowGet200Response + public Org.OpenAPITools.Client.ApiResponse NowGetWithHttpInfo(int operationIndex = 0) + { + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.NowGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = this.Client.Get("/now", localVarRequestOptions, this.Configuration); + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("NowGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of NowGet200Response + public async System.Threading.Tasks.Task NowGetAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + Org.OpenAPITools.Client.ApiResponse localVarResponse = await NowGetWithHttpInfoAsync(operationIndex, cancellationToken).ConfigureAwait(false); + return localVarResponse.Data; + } + + /// + /// + /// + /// Thrown when fails to make API call + /// Index associated with the operation. + /// Cancellation Token to cancel the request. + /// Task of ApiResponse (NowGet200Response) + public async System.Threading.Tasks.Task> NowGetWithHttpInfoAsync(int operationIndex = 0, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken)) + { + + Org.OpenAPITools.Client.RequestOptions localVarRequestOptions = new Org.OpenAPITools.Client.RequestOptions(); + + string[] _contentTypes = new string[] { + }; + + // to determine the Accept header + string[] _accepts = new string[] { + "application/json" + }; + + var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + if (localVarContentType != null) + { + localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); + } + + var localVarAccept = Org.OpenAPITools.Client.ClientUtils.SelectHeaderAccept(_accepts); + if (localVarAccept != null) + { + localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept); + } + + + localVarRequestOptions.Operation = "DefaultApi.NowGet"; + localVarRequestOptions.OperationIndex = operationIndex; + + + // make the HTTP request + var localVarResponse = await this.AsynchronousClient.GetAsync("/now", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false); + + if (this.ExceptionFactory != null) + { + Exception _exception = this.ExceptionFactory("NowGet", localVarResponse); + if (_exception != null) + { + throw _exception; + } + } + + return localVarResponse; + } + + } +} diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs new file mode 100644 index 000000000000..ea3384d5c5f8 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiClient.cs @@ -0,0 +1,822 @@ +/* + * OpenAPI Dates + * + * Thic spec contains endpoints with dates in different formats + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Net; +using System.Reflection; +using System.Runtime.Serialization; +using System.Runtime.Serialization.Formatters; +using System.Text; +using System.Threading; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using RestSharp; +using RestSharp.Serializers; +using RestSharpMethod = RestSharp.Method; +using FileIO = System.IO.File; +using Polly; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Client +{ + /// + /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. + /// + internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer + { + private readonly IReadableConfiguration _configuration; + private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + public CustomJsonCodec(IReadableConfiguration configuration) + { + _configuration = configuration; + } + + public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) + { + _serializerSettings = serializerSettings; + _configuration = configuration; + } + + /// + /// Serialize the object into a JSON string. + /// + /// Object to be serialized. + /// A JSON string. + public string Serialize(object obj) + { + if (obj != null && obj is AbstractOpenAPISchema) + { + // the object to be serialized is an oneOf/anyOf schema + return ((AbstractOpenAPISchema)obj).ToJson(); + } + else + { + return JsonConvert.SerializeObject(obj, _serializerSettings); + } + } + + public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); + + public T Deserialize(RestResponse response) + { + var result = (T)Deserialize(response, typeof(T)); + return result; + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// The HTTP response. + /// Object type. + /// Object representation of the JSON string. + internal object Deserialize(RestResponse response, Type type) + { + if (type == typeof(byte[])) // return byte array + { + return response.RawBytes; + } + + // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) + if (type == typeof(Stream)) + { + var bytes = response.RawBytes; + if (response.Headers != null) + { + var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) + ? global::System.IO.Path.GetTempPath() + : _configuration.TempFolderPath; + var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); + foreach (var header in response.Headers) + { + var match = regex.Match(header.ToString()); + if (match.Success) + { + string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); + FileIO.WriteAllBytes(fileName, bytes); + return new FileStream(fileName, FileMode.Open); + } + } + } + var stream = new MemoryStream(bytes); + return stream; + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); + } + + if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return Convert.ChangeType(response.Content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + public ISerializer Serializer => this; + public IDeserializer Deserializer => this; + + public string[] AcceptedContentTypes => ContentType.JsonAccept; + + public SupportsContentType SupportsContentType => contentType => + contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || + contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); + + public ContentType ContentType { get; set; } = ContentType.Json; + + public DataFormat DataFormat => DataFormat.Json; + } + /// + /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), + /// encapsulating general REST accessor use cases. + /// + public partial class ApiClient : ISynchronousClient, IAsynchronousClient + { + private readonly string _baseUrl; + + /// + /// Specifies the settings on a object. + /// These settings can be adjusted to accommodate custom serialization rules. + /// + public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings + { + // OpenAPI generated types generally hide default constructors. + ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new CamelCaseNamingStrategy + { + OverrideSpecifiedNames = false + } + } + }; + + /// + /// Allows for extending request processing for generated code. + /// + /// The RestSharp request object + partial void InterceptRequest(RestRequest request); + + /// + /// Allows for extending response processing for generated code. + /// + /// The RestSharp request object + /// The RestSharp response object + partial void InterceptResponse(RestRequest request, RestResponse response); + + /// + /// Initializes a new instance of the , defaulting to the global configurations' base url. + /// + public ApiClient() + { + _baseUrl = GlobalConfiguration.Instance.BasePath; + } + + /// + /// Initializes a new instance of the + /// + /// The target service's base path in URL format. + /// + public ApiClient(string basePath) + { + if (string.IsNullOrEmpty(basePath)) + throw new ArgumentException("basePath cannot be empty"); + + _baseUrl = basePath; + } + + /// + /// Constructs the RestSharp version of an http method + /// + /// Swagger Client Custom HttpMethod + /// RestSharp's HttpMethod instance. + /// + private RestSharpMethod Method(HttpMethod method) + { + RestSharpMethod other; + switch (method) + { + case HttpMethod.Get: + other = RestSharpMethod.Get; + break; + case HttpMethod.Post: + other = RestSharpMethod.Post; + break; + case HttpMethod.Put: + other = RestSharpMethod.Put; + break; + case HttpMethod.Delete: + other = RestSharpMethod.Delete; + break; + case HttpMethod.Head: + other = RestSharpMethod.Head; + break; + case HttpMethod.Options: + other = RestSharpMethod.Options; + break; + case HttpMethod.Patch: + other = RestSharpMethod.Patch; + break; + default: + throw new ArgumentOutOfRangeException("method", method, null); + } + + return other; + } + + /// + /// Provides all logic for constructing a new RestSharp . + /// At this point, all information for querying the service is known. + /// Here, it is simply mapped into the RestSharp request. + /// + /// The http verb. + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// [private] A new RestRequest instance. + /// + private RestRequest NewRequest( + HttpMethod method, + string path, + RequestOptions options, + IReadableConfiguration configuration) + { + if (path == null) throw new ArgumentNullException("path"); + if (options == null) throw new ArgumentNullException("options"); + if (configuration == null) throw new ArgumentNullException("configuration"); + + RestRequest request = new RestRequest(path, Method(method)); + + if (options.PathParameters != null) + { + foreach (var pathParam in options.PathParameters) + { + request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); + } + } + + if (options.QueryParameters != null) + { + foreach (var queryParam in options.QueryParameters) + { + foreach (var value in queryParam.Value) + { + request.AddQueryParameter(queryParam.Key, value); + } + } + } + + if (configuration.DefaultHeaders != null) + { + foreach (var headerParam in configuration.DefaultHeaders) + { + request.AddHeader(headerParam.Key, headerParam.Value); + } + } + + if (options.HeaderParameters != null) + { + foreach (var headerParam in options.HeaderParameters) + { + foreach (var value in headerParam.Value) + { + request.AddHeader(headerParam.Key, value); + } + } + } + + if (options.FormParameters != null) + { + foreach (var formParam in options.FormParameters) + { + request.AddParameter(formParam.Key, formParam.Value); + } + } + + if (options.Data != null) + { + if (options.Data is Stream stream) + { + var contentType = "application/octet-stream"; + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + contentType = contentTypes[0]; + } + + var bytes = ClientUtils.ReadAsBytes(stream); + request.AddParameter(contentType, bytes, ParameterType.RequestBody); + } + else + { + if (options.HeaderParameters != null) + { + var contentTypes = options.HeaderParameters["Content-Type"]; + if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) + { + request.RequestFormat = DataFormat.Json; + } + else + { + // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. + } + } + else + { + // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. + request.RequestFormat = DataFormat.Json; + } + + request.AddJsonBody(options.Data); + } + } + + if (options.FileParameters != null) + { + foreach (var fileParam in options.FileParameters) + { + foreach (var file in fileParam.Value) + { + var bytes = ClientUtils.ReadAsBytes(file); + var fileStream = file as FileStream; + if (fileStream != null) + request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); + else + request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); + } + } + } + + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + + return request; + } + + /// + /// Transforms a RestResponse instance into a new ApiResponse instance. + /// At this point, we have a concrete http response from the service. + /// Here, it is simply mapped into the [public] ApiResponse object. + /// + /// The RestSharp response object + /// A new ApiResponse instance. + private ApiResponse ToApiResponse(RestResponse response) + { + T result = response.Data; + string rawContent = response.Content; + + var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) + { + ErrorText = response.ErrorMessage, + Cookies = new List() + }; + + if (response.Headers != null) + { + foreach (var responseHeader in response.Headers) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.ContentHeaders != null) + { + foreach (var responseHeader in response.ContentHeaders) + { + transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); + } + } + + if (response.Cookies != null) + { + foreach (var responseCookies in response.Cookies.Cast()) + { + transformed.Cookies.Add( + new Cookie( + responseCookies.Name, + responseCookies.Value, + responseCookies.Path, + responseCookies.Domain) + ); + } + } + + return transformed; + } + + /// + /// Executes the HTTP request for the current service. + /// Based on functions received it can be async or sync. + /// + /// Local function that executes http request and returns http response. + /// Local function to specify options for the service. + /// The RestSharp request object + /// The RestSharp options object + /// A per-request configuration object. + /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. + /// A new ApiResponse instance. + private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; + var clientOptions = new RestClientOptions(baseUrl) + { + ClientCertificates = configuration.ClientCertificates, + Timeout = configuration.Timeout, + Proxy = configuration.Proxy, + UserAgent = configuration.UserAgent, + UseDefaultCredentials = configuration.UseDefaultCredentials, + RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback + }; + setOptions(clientOptions); + + using (RestClient client = new RestClient(clientOptions, + configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) + { + InterceptRequest(request); + + RestResponse response = await getResponse(client); + + // if the response type is oneOf/anyOf, call FromJSON to deserialize the data + if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) + { + try + { + response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); + } + catch (Exception ex) + { + throw ex.InnerException != null ? ex.InnerException : ex; + } + } + else if (typeof(T).Name == "Stream") // for binary response + { + response.Data = (T)(object)new MemoryStream(response.RawBytes); + } + else if (typeof(T).Name == "Byte[]") // for byte response + { + response.Data = (T)(object)response.RawBytes; + } + else if (typeof(T).Name == "String") // for string response + { + response.Data = (T)(object)response.Content; + } + + InterceptResponse(request, response); + + var result = ToApiResponse(response); + if (response.ErrorMessage != null) + { + result.ErrorText = response.ErrorMessage; + } + + if (response.Cookies != null && response.Cookies.Count > 0) + { + if (result.Cookies == null) result.Cookies = new List(); + foreach (var restResponseCookie in response.Cookies.Cast()) + { + var cookie = new Cookie( + restResponseCookie.Name, + restResponseCookie.Value, + restResponseCookie.Path, + restResponseCookie.Domain + ) + { + Comment = restResponseCookie.Comment, + CommentUri = restResponseCookie.CommentUri, + Discard = restResponseCookie.Discard, + Expired = restResponseCookie.Expired, + Expires = restResponseCookie.Expires, + HttpOnly = restResponseCookie.HttpOnly, + Port = restResponseCookie.Port, + Secure = restResponseCookie.Secure, + Version = restResponseCookie.Version + }; + + result.Cookies.Add(cookie); + } + } + return result; + } + } + + private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) + { + if (policyResult.Outcome == OutcomeType.Successful) + { + return await client.Deserialize(policyResult.Result, cancellationToken); + } + else + { + return new RestResponse(request) + { + ErrorException = policyResult.FinalException + }; + } + } + + private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) + { + Action setOptions = (clientOptions) => + { + var cookies = new CookieContainer(); + + if (options.Cookies != null && options.Cookies.Count > 0) + { + foreach (var cookie in options.Cookies) + { + cookies.Add(new Cookie(cookie.Name, cookie.Value)); + } + } + clientOptions.CookieContainer = cookies; + }; + + Func>> getResponse = (client) => + { + if (RetryConfiguration.RetryPolicy != null) + { + var policy = RetryConfiguration.RetryPolicy; + var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); + return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); + } + else + { + return Task.FromResult(client.Execute(request)); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); + } + + private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default(CancellationToken)) + { + Action setOptions = (clientOptions) => + { + //no extra options + }; + + Func>> getResponse = async (client) => + { + if (RetryConfiguration.AsyncRetryPolicy != null) + { + var policy = RetryConfiguration.AsyncRetryPolicy; + var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); + return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken); + } + else + { + return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); + } + }; + + return ExecClientAsync(getResponse, setOptions, request, options, configuration); + } + + #region IAsynchronousClient + /// + /// Make a HTTP GET request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP POST request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PUT request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP DELETE request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP HEAD request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP OPTION request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); + } + + /// + /// Make a HTTP PATCH request (async). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// Token that enables callers to cancel the request. + /// A Task containing ApiResponse + public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) + { + var config = configuration ?? GlobalConfiguration.Instance; + return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); + } + #endregion IAsynchronousClient + + #region ISynchronousClient + /// + /// Make a HTTP GET request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); + } + + /// + /// Make a HTTP POST request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); + } + + /// + /// Make a HTTP PUT request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); + } + + /// + /// Make a HTTP DELETE request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); + } + + /// + /// Make a HTTP HEAD request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); + } + + /// + /// Make a HTTP OPTION request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); + } + + /// + /// Make a HTTP PATCH request (synchronous). + /// + /// The target path (or resource). + /// The additional request options. + /// A per-request configuration object. It is assumed that any merge with + /// GlobalConfiguration has been done before calling this method. + /// A Task containing ApiResponse + public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) + { + var config = configuration ?? GlobalConfiguration.Instance; + return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); + } + #endregion ISynchronousClient + } +} diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiException.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiException.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiException.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ApiResponse.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ClientUtils.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Configuration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionFactory.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionFactory.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionFactory.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ExceptionFactory.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/GlobalConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/GlobalConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/GlobalConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/HttpMethod.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HttpMethod.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/HttpMethod.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/HttpMethod.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/IApiAccessor.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/IApiAccessor.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/IApiAccessor.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/IApiAccessor.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/IAsynchronousClient.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/IAsynchronousClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/IAsynchronousClient.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/IAsynchronousClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/IReadableConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/IReadableConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/IReadableConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ISynchronousClient.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ISynchronousClient.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/ISynchronousClient.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/ISynchronousClient.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/Multimap.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Multimap.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/Multimap.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/Multimap.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RequestOptions.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RequestOptions.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RequestOptions.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RequestOptions.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RetryConfiguration.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RetryConfiguration.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Client/RetryConfiguration.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Client/RetryConfiguration.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/AbstractOpenAPISchema.cs diff --git a/samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs similarity index 100% rename from samples/client/petstore/csharp/restsharp/net7/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs rename to samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Model/NowGet200Response.cs diff --git a/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj new file mode 100644 index 000000000000..ccb09c252b62 --- /dev/null +++ b/samples/client/petstore/csharp/restsharp/net8/UseDateTimeForDate/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -0,0 +1,35 @@ + + + + false + net8.0 + Org.OpenAPITools + Org.OpenAPITools + Library + OpenAPI + OpenAPI + OpenAPI Library + A library generated from a OpenAPI doc + No Copyright + Org.OpenAPITools + 1.0.0 + bin\$(Configuration)\$(TargetFramework)\Org.OpenAPITools.xml + https://github.com/GIT_USER_ID/GIT_REPO_ID.git + git + Minor update + annotations + false + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 9ccd159a44f9..1060a9cbc232 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -244,6 +244,7 @@ public Org.OpenAPITools.Client.ApiResponse Call123TestSpecialTagsWi }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs index 54f3d2e41a93..ddcafaaeb043 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -399,6 +399,7 @@ public Org.OpenAPITools.Client.ApiResponse FooGetWithHttp }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -532,6 +533,7 @@ public Org.OpenAPITools.Client.ApiResponse GetCountryWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -667,6 +669,7 @@ public Org.OpenAPITools.Client.ApiResponse> HelloWithHttpInfo(int ope }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -793,6 +796,7 @@ public Org.OpenAPITools.Client.ApiResponse>> RolesRe }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -919,6 +923,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1374,6 +1375,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1508,6 +1510,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1642,6 +1645,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1778,6 +1782,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1913,6 +1918,7 @@ public Org.OpenAPITools.Client.ApiResponse> GetArrayOfEnumsWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2039,6 +2045,7 @@ public Org.OpenAPITools.Client.ApiResponse GetMixedAnyOfWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2165,6 +2172,7 @@ public Org.OpenAPITools.Client.ApiResponse GetMixedOneOfWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2298,6 +2306,7 @@ public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesRefer }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2440,6 +2449,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyWithFileSchemaWithHtt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2590,6 +2600,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyWithQueryParamsWithHt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2744,6 +2755,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2920,6 +2932,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3200,6 +3213,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3237,7 +3251,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI } if (enumFormStringArray != null) { - localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter + localVarRequestOptions.FormParameters.Add("enum_form_string_array", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter } if (enumFormString != null) { @@ -3415,6 +3429,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3600,6 +3615,7 @@ public Org.OpenAPITools.Client.ApiResponse TestInlineAdditionalPropertie }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3742,6 +3758,7 @@ public Org.OpenAPITools.Client.ApiResponse TestInlineFreeformAdditionalP }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3892,6 +3909,7 @@ public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo( }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -4095,6 +4113,7 @@ public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo( }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -4316,6 +4335,7 @@ public Org.OpenAPITools.Client.ApiResponse TestStringMapReferenceWithHtt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index b0e5066eef8f..07c4ad398c66 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -244,6 +244,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClassnameWithHttpInf }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs index 086ecc412983..91056b351adc 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs @@ -641,6 +641,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -843,6 +844,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1022,6 +1024,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpIn }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1234,6 +1237,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1440,6 +1444,7 @@ public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1599,6 +1604,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1804,6 +1810,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1992,6 +1999,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2189,6 +2197,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/StoreApi.cs index 57193a85d293..50765779d948 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/StoreApi.cs @@ -378,6 +378,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -512,6 +513,7 @@ public Org.OpenAPITools.Client.ApiResponse> GetInventory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -651,6 +653,7 @@ public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -792,6 +795,7 @@ public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order o }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/UserApi.cs index 174d0572e677..700610558ef8 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/UserApi.cs @@ -567,6 +567,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User u }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -709,6 +710,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWith }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -851,6 +853,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -992,6 +995,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1135,6 +1139,7 @@ public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1289,6 +1294,7 @@ public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1434,6 +1440,7 @@ public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo(int op }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1573,6 +1580,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs index a0a43ea74aeb..30158fdf49b7 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs @@ -385,6 +385,14 @@ private RestRequest NewRequest( } } + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + return request; } diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..c370847420c1 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -356,7 +356,7 @@ private string GetECDSASignature(byte[] dataToSign) } /// - /// Convert ANS1 format to DER format. Not recommended to use because it generate inavlid signature occationally. + /// Convert ANS1 format to DER format. Not recommended to use because it generate invalid signature occasionally. /// /// /// diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 9ccd159a44f9..1060a9cbc232 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -244,6 +244,7 @@ public Org.OpenAPITools.Client.ApiResponse Call123TestSpecialTagsWi }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs index 54f3d2e41a93..ddcafaaeb043 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/DefaultApi.cs @@ -399,6 +399,7 @@ public Org.OpenAPITools.Client.ApiResponse FooGetWithHttp }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -532,6 +533,7 @@ public Org.OpenAPITools.Client.ApiResponse GetCountryWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -667,6 +669,7 @@ public Org.OpenAPITools.Client.ApiResponse> HelloWithHttpInfo(int ope }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -793,6 +796,7 @@ public Org.OpenAPITools.Client.ApiResponse>> RolesRe }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -919,6 +923,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1374,6 +1375,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1508,6 +1510,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1642,6 +1645,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1778,6 +1782,7 @@ public Org.OpenAPITools.Client.ApiResponse FakeHealthGetWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1913,6 +1918,7 @@ public Org.OpenAPITools.Client.ApiResponse> GetArrayOfEnumsWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2039,6 +2045,7 @@ public Org.OpenAPITools.Client.ApiResponse GetMixedAnyOfWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2165,6 +2172,7 @@ public Org.OpenAPITools.Client.ApiResponse GetMixedOneOfWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2298,6 +2306,7 @@ public Org.OpenAPITools.Client.ApiResponse TestAdditionalPropertiesRefer }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2440,6 +2449,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyWithFileSchemaWithHtt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2590,6 +2600,7 @@ public Org.OpenAPITools.Client.ApiResponse TestBodyWithQueryParamsWithHt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2744,6 +2755,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2920,6 +2932,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3200,6 +3213,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3237,7 +3251,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI } if (enumFormStringArray != null) { - localVarRequestOptions.FormParameters.Add("enum_form_string_array", Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter + localVarRequestOptions.FormParameters.Add("enum_form_string_array", localVarMultipartFormData ? Org.OpenAPITools.Client.ClientUtils.ParameterToString(enumFormStringArray) : Org.OpenAPITools.Client.ClientUtils.Serialize(enumFormStringArray)); // form parameter } if (enumFormString != null) { @@ -3415,6 +3429,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClientModelWithHttpI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3600,6 +3615,7 @@ public Org.OpenAPITools.Client.ApiResponse TestInlineAdditionalPropertie }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3742,6 +3758,7 @@ public Org.OpenAPITools.Client.ApiResponse TestInlineFreeformAdditionalP }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -3892,6 +3909,7 @@ public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo( }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -4095,6 +4113,7 @@ public Org.OpenAPITools.Client.ApiResponse TestJsonFormDataWithHttpInfo( }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -4316,6 +4335,7 @@ public Org.OpenAPITools.Client.ApiResponse TestStringMapReferenceWithHtt }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs index b0e5066eef8f..07c4ad398c66 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/FakeClassnameTags123Api.cs @@ -244,6 +244,7 @@ public Org.OpenAPITools.Client.ApiResponse TestClassnameWithHttpInf }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 8db5fd36849d..7e74501d82f4 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -641,6 +641,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -843,6 +844,7 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1022,6 +1024,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByStatusWithHttpIn }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1234,6 +1237,7 @@ public Org.OpenAPITools.Client.ApiResponse> FindPetsByTagsWithHttpInfo }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1440,6 +1444,7 @@ public Org.OpenAPITools.Client.ApiResponse GetPetByIdWithHttpInfo(long petI }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1599,6 +1604,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1804,6 +1810,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1992,6 +1999,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -2189,6 +2197,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdatePetWithHttpInfo(Pet pet }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs index e8882b0fc2e4..af79df6916fe 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/StoreApi.cs @@ -378,6 +378,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteOrderWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -512,6 +513,7 @@ public Org.OpenAPITools.Client.ApiResponse> GetInventory }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -651,6 +653,7 @@ public Org.OpenAPITools.Client.ApiResponse GetOrderByIdWithHttpInfo(long }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -792,6 +795,7 @@ public Org.OpenAPITools.Client.ApiResponse PlaceOrderWithHttpInfo(Order o }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs index 174d0572e677..700610558ef8 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Api/UserApi.cs @@ -567,6 +567,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUserWithHttpInfo(User u }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -709,6 +710,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithArrayInputWith }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -851,6 +853,7 @@ public Org.OpenAPITools.Client.ApiResponse CreateUsersWithListInputWithH }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -992,6 +995,7 @@ public Org.OpenAPITools.Client.ApiResponse DeleteUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1135,6 +1139,7 @@ public Org.OpenAPITools.Client.ApiResponse GetUserByNameWithHttpInfo(strin }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1289,6 +1294,7 @@ public Org.OpenAPITools.Client.ApiResponse LoginUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1434,6 +1440,7 @@ public Org.OpenAPITools.Client.ApiResponse LogoutUserWithHttpInfo(int op }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); @@ -1573,6 +1580,7 @@ public Org.OpenAPITools.Client.ApiResponse UpdateUserWithHttpInfo(string }; var localVarContentType = Org.OpenAPITools.Client.ClientUtils.SelectHeaderContentType(_contentTypes); + var localVarMultipartFormData = localVarContentType == "multipart/form-data"; if (localVarContentType != null) { localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index a0a43ea74aeb..30158fdf49b7 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -385,6 +385,14 @@ private RestRequest NewRequest( } } + if (options.HeaderParameters != null) + { + if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) + { + request.AlwaysMultipartFormData = true; + } + } + return request; } diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..c370847420c1 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -356,7 +356,7 @@ private string GetECDSASignature(byte[] dataToSign) } /// - /// Convert ANS1 format to DER format. Not recommended to use because it generate inavlid signature occationally. + /// Convert ANS1 format to DER format. Not recommended to use because it generate invalid signature occasionally. /// /// /// diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs index a419d35bed48..c370847420c1 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Client/HttpSigningConfiguration.cs @@ -356,7 +356,7 @@ private string GetECDSASignature(byte[] dataToSign) } /// - /// Convert ANS1 format to DER format. Not recommended to use because it generate inavlid signature occationally. + /// Convert ANS1 format to DER format. Not recommended to use because it generate invalid signature occasionally. /// /// /// diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/pom.xml b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/pom.xml index a6a61b273cb0..a5df70c97604 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson-with-xml/pom.xml @@ -157,7 +157,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 3.2.7 2.17.1 2.17.1 diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/pom.xml b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/pom.xml index 16079576ce67..e79da281f43c 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-jackson/pom.xml @@ -152,7 +152,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 3.2.7 2.17.1 2.17.1 diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0-mutiny/pom.xml b/samples/client/petstore/java/microprofile-rest-client-3.0-mutiny/pom.xml index 5804a8d6e32b..d930a9f96dc9 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0-mutiny/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client-3.0-mutiny/pom.xml @@ -160,7 +160,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 3.2.7 2.17.1 2.1.0 diff --git a/samples/client/petstore/java/microprofile-rest-client-3.0/pom.xml b/samples/client/petstore/java/microprofile-rest-client-3.0/pom.xml index d62c69aa7957..7b03483c49eb 100644 --- a/samples/client/petstore/java/microprofile-rest-client-3.0/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client-3.0/pom.xml @@ -155,7 +155,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 3.2.7 2.17.1 2.1.0 diff --git a/samples/client/petstore/java/microprofile-rest-client-mutiny/pom.xml b/samples/client/petstore/java/microprofile-rest-client-mutiny/pom.xml index d9ca684ed950..57273ef43a84 100644 --- a/samples/client/petstore/java/microprofile-rest-client-mutiny/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client-mutiny/pom.xml @@ -160,7 +160,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 3.2.7 2.17.1 1.2.2 diff --git a/samples/client/petstore/java/microprofile-rest-client-outer-enum/pom.xml b/samples/client/petstore/java/microprofile-rest-client-outer-enum/pom.xml index d5fb59988d9a..cc21c05b3882 100644 --- a/samples/client/petstore/java/microprofile-rest-client-outer-enum/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client-outer-enum/pom.xml @@ -155,7 +155,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 3.2.7 2.17.1 1.2.2 diff --git a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/pom.xml b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/pom.xml index ec0b6c7eb2bf..3e6d548f51ae 100644 --- a/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client-with-useSingleRequestParameter/pom.xml @@ -155,7 +155,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 3.2.7 2.17.1 2.1.0 diff --git a/samples/client/petstore/java/microprofile-rest-client/pom.xml b/samples/client/petstore/java/microprofile-rest-client/pom.xml index f3bb0cf3c400..59af12cd31c9 100644 --- a/samples/client/petstore/java/microprofile-rest-client/pom.xml +++ b/samples/client/petstore/java/microprofile-rest-client/pom.xml @@ -155,7 +155,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 3.2.7 2.17.1 1.2.2 diff --git a/samples/client/petstore/javascript-es6/src/ApiClient.js b/samples/client/petstore/javascript-es6/src/ApiClient.js index 22d36a30f7f8..fb8ff7535e0a 100644 --- a/samples/client/petstore/javascript-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-es6/src/ApiClient.js @@ -52,15 +52,6 @@ class ApiClient { 'bearer_test': {type: 'bearer'}, // JWT } - /** - * The default HTTP headers to be included for all API calls. - * @type {Array.} - * @default {} - */ - this.defaultHeaders = { - 'User-Agent': 'OpenAPI-Generator/1.0.0/Javascript' - }; - /** * The default HTTP timeout for all API calls. * @type {Number} @@ -76,7 +67,7 @@ class ApiClient { */ this.cache = true; - /** + /** * If set to true, the client will save the cookies from each server * response, and return them in the next request. * @default false diff --git a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js index fc801fb55ee2..50de83950806 100644 --- a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js @@ -52,7 +52,7 @@ class ApiClient { 'bearer_test': {type: 'bearer'}, // JWT } - /** + /** * The default HTTP headers to be included for all API calls. * @type {Array.} * @default {} @@ -76,7 +76,7 @@ class ApiClient { */ this.cache = true; - /** + /** * If set to true, the client will save the cookies from each server * response, and return them in the next request. * @default false diff --git a/samples/client/petstore/jaxrs-cxf-client-jackson/pom.xml b/samples/client/petstore/jaxrs-cxf-client-jackson/pom.xml index cc13daea0bfb..52fe25f92ee0 100644 --- a/samples/client/petstore/jaxrs-cxf-client-jackson/pom.xml +++ b/samples/client/petstore/jaxrs-cxf-client-jackson/pom.xml @@ -197,7 +197,7 @@ for this project used jakarta.validation-api --> 1.5.18 9.2.9.v20150224 4.13.2 - 1.4.14 + 1.5.13 3.5.9 2.17.1 1.3.5 diff --git a/samples/client/petstore/jaxrs-cxf-client/pom.xml b/samples/client/petstore/jaxrs-cxf-client/pom.xml index edf9249f8cd0..1521434254ca 100644 --- a/samples/client/petstore/jaxrs-cxf-client/pom.xml +++ b/samples/client/petstore/jaxrs-cxf-client/pom.xml @@ -197,7 +197,7 @@ for this project used jakarta.validation-api --> 1.5.18 9.2.9.v20150224 4.13.2 - 1.4.14 + 1.5.13 3.5.9 2.17.1 1.3.5 diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php index 0bbfa21ae735..08e9ac3c352c 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/AnotherFakeApi.php @@ -307,7 +307,7 @@ function ($response) { * @return PromiseInterface */ public function call123TestSpecialTagsAsyncWithHttpInfo( - $client, + \OpenAPI\Client\Model\Client $client, string $contentType = self::contentTypes['call123TestSpecialTags'][0] ): PromiseInterface { @@ -360,7 +360,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function call123TestSpecialTagsRequest( - $client, + \OpenAPI\Client\Model\Client $client, string $contentType = self::contentTypes['call123TestSpecialTags'][0] ): Request { diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php index 2ae29d84e293..e489439ba148 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeApi.php @@ -678,9 +678,9 @@ function ($response) { * @return PromiseInterface */ public function fakeEnumEndpointAsyncWithHttpInfo( - $enum_class, - $enum_class_array, - $enum_class_map, + \OpenAPI\Client\Model\EnumClass $enum_class, + array $enum_class_array, + array $enum_class_map, string $contentType = self::contentTypes['fakeEnumEndpoint'][0] ): PromiseInterface { @@ -735,9 +735,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function fakeEnumEndpointRequest( - $enum_class, - $enum_class_array, - $enum_class_map, + \OpenAPI\Client\Model\EnumClass $enum_class, + array $enum_class_array, + array $enum_class_map, string $contentType = self::contentTypes['fakeEnumEndpoint'][0] ): Request { @@ -1274,9 +1274,9 @@ function ($response) { * @return PromiseInterface */ public function fakeHttpSignatureTestAsyncWithHttpInfo( - $pet, - $query_1 = null, - $header_1 = null, + \OpenAPI\Client\Model\Pet $pet, + ?string $query_1 = null, + ?string $header_1 = null, string $contentType = self::contentTypes['fakeHttpSignatureTest'][0] ): PromiseInterface { @@ -1318,9 +1318,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function fakeHttpSignatureTestRequest( - $pet, - $query_1 = null, - $header_1 = null, + \OpenAPI\Client\Model\Pet $pet, + ?string $query_1 = null, + ?string $header_1 = null, string $contentType = self::contentTypes['fakeHttpSignatureTest'][0] ): Request { @@ -1596,7 +1596,7 @@ function ($response) { * @return PromiseInterface */ public function fakeOuterBooleanSerializeAsyncWithHttpInfo( - $body = null, + ?bool $body = null, string $contentType = self::contentTypes['fakeOuterBooleanSerialize'][0] ): PromiseInterface { @@ -1649,7 +1649,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function fakeOuterBooleanSerializeRequest( - $body = null, + ?bool $body = null, string $contentType = self::contentTypes['fakeOuterBooleanSerialize'][0] ): Request { @@ -1904,7 +1904,7 @@ function ($response) { * @return PromiseInterface */ public function fakeOuterCompositeSerializeAsyncWithHttpInfo( - $outer_composite = null, + ?\OpenAPI\Client\Model\OuterComposite $outer_composite = null, string $contentType = self::contentTypes['fakeOuterCompositeSerialize'][0] ): PromiseInterface { @@ -1957,7 +1957,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function fakeOuterCompositeSerializeRequest( - $outer_composite = null, + ?\OpenAPI\Client\Model\OuterComposite $outer_composite = null, string $contentType = self::contentTypes['fakeOuterCompositeSerialize'][0] ): Request { @@ -2212,7 +2212,7 @@ function ($response) { * @return PromiseInterface */ public function fakeOuterNumberSerializeAsyncWithHttpInfo( - $body = null, + ?float $body = null, string $contentType = self::contentTypes['fakeOuterNumberSerialize'][0] ): PromiseInterface { @@ -2265,7 +2265,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function fakeOuterNumberSerializeRequest( - $body = null, + ?float $body = null, string $contentType = self::contentTypes['fakeOuterNumberSerialize'][0] ): Request { @@ -2520,7 +2520,7 @@ function ($response) { * @return PromiseInterface */ public function fakeOuterStringSerializeAsyncWithHttpInfo( - $body = null, + ?string $body = null, string $contentType = self::contentTypes['fakeOuterStringSerialize'][0] ): PromiseInterface { @@ -2573,7 +2573,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function fakeOuterStringSerializeRequest( - $body = null, + ?string $body = null, string $contentType = self::contentTypes['fakeOuterStringSerialize'][0] ): Request { @@ -2828,7 +2828,7 @@ function ($response) { * @return PromiseInterface */ public function fakePropertyEnumIntegerSerializeAsyncWithHttpInfo( - $outer_object_with_enum_property, + \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property, string $contentType = self::contentTypes['fakePropertyEnumIntegerSerialize'][0] ): PromiseInterface { @@ -2881,7 +2881,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function fakePropertyEnumIntegerSerializeRequest( - $outer_object_with_enum_property, + \OpenAPI\Client\Model\OuterObjectWithEnumProperty $outer_object_with_enum_property, string $contentType = self::contentTypes['fakePropertyEnumIntegerSerialize'][0] ): Request { @@ -3072,7 +3072,7 @@ function ($response) { * @return PromiseInterface */ public function testAdditionalPropertiesReferenceAsyncWithHttpInfo( - $request_body, + array $request_body, string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0] ): PromiseInterface { @@ -3112,7 +3112,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testAdditionalPropertiesReferenceRequest( - $request_body, + array $request_body, string $contentType = self::contentTypes['testAdditionalPropertiesReference'][0] ): Request { @@ -3207,7 +3207,7 @@ public function testAdditionalPropertiesReferenceRequest( * @return void */ public function testBodyWithBinary( - \SplFileObject $body, + ?\SplFileObject $body, string $contentType = self::contentTypes['testBodyWithBinary'][0] ): void { @@ -3225,7 +3225,7 @@ public function testBodyWithBinary( * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function testBodyWithBinaryWithHttpInfo( - \SplFileObject $body, + ?\SplFileObject $body, string $contentType = self::contentTypes['testBodyWithBinary'][0] ): array { @@ -3273,7 +3273,7 @@ public function testBodyWithBinaryWithHttpInfo( * @return PromiseInterface */ public function testBodyWithBinaryAsync( - \SplFileObject $body, + ?\SplFileObject $body, string $contentType = self::contentTypes['testBodyWithBinary'][0] ): PromiseInterface { @@ -3295,7 +3295,7 @@ function ($response) { * @return PromiseInterface */ public function testBodyWithBinaryAsyncWithHttpInfo( - $body, + ?\SplFileObject $body, string $contentType = self::contentTypes['testBodyWithBinary'][0] ): PromiseInterface { @@ -3335,7 +3335,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testBodyWithBinaryRequest( - $body, + ?\SplFileObject $body, string $contentType = self::contentTypes['testBodyWithBinary'][0] ): Request { @@ -3518,7 +3518,7 @@ function ($response) { * @return PromiseInterface */ public function testBodyWithFileSchemaAsyncWithHttpInfo( - $file_schema_test_class, + \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class, string $contentType = self::contentTypes['testBodyWithFileSchema'][0] ): PromiseInterface { @@ -3558,7 +3558,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testBodyWithFileSchemaRequest( - $file_schema_test_class, + \OpenAPI\Client\Model\FileSchemaTestClass $file_schema_test_class, string $contentType = self::contentTypes['testBodyWithFileSchema'][0] ): Request { @@ -3748,8 +3748,8 @@ function ($response) { * @return PromiseInterface */ public function testBodyWithQueryParamsAsyncWithHttpInfo( - $query, - $user, + string $query, + \OpenAPI\Client\Model\User $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0] ): PromiseInterface { @@ -3790,8 +3790,8 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testBodyWithQueryParamsRequest( - $query, - $user, + string $query, + \OpenAPI\Client\Model\User $user, string $contentType = self::contentTypes['testBodyWithQueryParams'][0] ): Request { @@ -4076,7 +4076,7 @@ function ($response) { * @return PromiseInterface */ public function testClientModelAsyncWithHttpInfo( - $client, + \OpenAPI\Client\Model\Client $client, string $contentType = self::contentTypes['testClientModel'][0] ): PromiseInterface { @@ -4129,7 +4129,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testClientModelRequest( - $client, + \OpenAPI\Client\Model\Client $client, string $contentType = self::contentTypes['testClientModel'][0] ): Request { @@ -4411,20 +4411,20 @@ function ($response) { * @return PromiseInterface */ public function testEndpointParametersAsyncWithHttpInfo( - $number, - $double, - $pattern_without_delimiter, - $byte, - $integer = null, - $int32 = null, - $int64 = null, - $float = null, - $string = null, - $binary = null, - $date = null, - $date_time = null, - $password = null, - $callback = null, + float $number, + float $double, + string $pattern_without_delimiter, + string $byte, + ?int $integer = null, + ?int $int32 = null, + ?int $int64 = null, + ?float $float = null, + ?string $string = null, + ?\SplFileObject $binary = null, + ?\DateTime $date = null, + ?\DateTime $date_time = null, + ?string $password = null, + ?string $callback = null, string $contentType = self::contentTypes['testEndpointParameters'][0] ): PromiseInterface { @@ -4477,20 +4477,20 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEndpointParametersRequest( - $number, - $double, - $pattern_without_delimiter, - $byte, - $integer = null, - $int32 = null, - $int64 = null, - $float = null, - $string = null, - $binary = null, - $date = null, - $date_time = null, - $password = null, - $callback = null, + float $number, + float $double, + string $pattern_without_delimiter, + string $byte, + ?int $integer = null, + ?int $int32 = null, + ?int $int64 = null, + ?float $float = null, + ?string $string = null, + ?\SplFileObject $binary = null, + ?\DateTime $date = null, + ?\DateTime $date_time = null, + ?string $password = null, + ?string $callback = null, string $contentType = self::contentTypes['testEndpointParameters'][0] ): Request { @@ -4728,14 +4728,14 @@ public function testEndpointParametersRequest( * @return void */ public function testEnumParameters( - ?array $enum_header_string_array = ['$'], + array $enum_header_string_array = ['$'], ?string $enum_header_string = '-efg', - ?array $enum_query_string_array = ['$'], + array $enum_query_string_array = ['$'], ?string $enum_query_string = '-efg', ?int $enum_query_integer = null, ?float $enum_query_double = null, - ?array $enum_query_model_array = null, - ?array $enum_form_string_array = ['$'], + array $enum_query_model_array = null, + array $enum_form_string_array = ['$'], ?string $enum_form_string = '-efg', string $contentType = self::contentTypes['testEnumParameters'][0] ): void @@ -4764,14 +4764,14 @@ public function testEnumParameters( * @return array of null, HTTP status code, HTTP response headers (array of strings) */ public function testEnumParametersWithHttpInfo( - ?array $enum_header_string_array = ['$'], + array $enum_header_string_array = ['$'], ?string $enum_header_string = '-efg', - ?array $enum_query_string_array = ['$'], + array $enum_query_string_array = ['$'], ?string $enum_query_string = '-efg', ?int $enum_query_integer = null, ?float $enum_query_double = null, - ?array $enum_query_model_array = null, - ?array $enum_form_string_array = ['$'], + array $enum_query_model_array = null, + array $enum_form_string_array = ['$'], ?string $enum_form_string = '-efg', string $contentType = self::contentTypes['testEnumParameters'][0] ): array @@ -4830,14 +4830,14 @@ public function testEnumParametersWithHttpInfo( * @return PromiseInterface */ public function testEnumParametersAsync( - ?array $enum_header_string_array = ['$'], + array $enum_header_string_array = ['$'], ?string $enum_header_string = '-efg', - ?array $enum_query_string_array = ['$'], + array $enum_query_string_array = ['$'], ?string $enum_query_string = '-efg', ?int $enum_query_integer = null, ?float $enum_query_double = null, - ?array $enum_query_model_array = null, - ?array $enum_form_string_array = ['$'], + array $enum_query_model_array = null, + array $enum_form_string_array = ['$'], ?string $enum_form_string = '-efg', string $contentType = self::contentTypes['testEnumParameters'][0] ): PromiseInterface @@ -4870,15 +4870,15 @@ function ($response) { * @return PromiseInterface */ public function testEnumParametersAsyncWithHttpInfo( - $enum_header_string_array = ['$'], - $enum_header_string = '-efg', - $enum_query_string_array = ['$'], - $enum_query_string = '-efg', - $enum_query_integer = null, - $enum_query_double = null, - $enum_query_model_array = null, - $enum_form_string_array = ['$'], - $enum_form_string = '-efg', + array $enum_header_string_array = ['$'], + ?string $enum_header_string = '-efg', + array $enum_query_string_array = ['$'], + ?string $enum_query_string = '-efg', + ?int $enum_query_integer = null, + ?float $enum_query_double = null, + array $enum_query_model_array = null, + array $enum_form_string_array = ['$'], + ?string $enum_form_string = '-efg', string $contentType = self::contentTypes['testEnumParameters'][0] ): PromiseInterface { @@ -4926,15 +4926,15 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testEnumParametersRequest( - $enum_header_string_array = ['$'], - $enum_header_string = '-efg', - $enum_query_string_array = ['$'], - $enum_query_string = '-efg', - $enum_query_integer = null, - $enum_query_double = null, - $enum_query_model_array = null, - $enum_form_string_array = ['$'], - $enum_form_string = '-efg', + array $enum_header_string_array = ['$'], + ?string $enum_header_string = '-efg', + array $enum_query_string_array = ['$'], + ?string $enum_query_string = '-efg', + ?int $enum_query_integer = null, + ?float $enum_query_double = null, + array $enum_query_model_array = null, + array $enum_form_string_array = ['$'], + ?string $enum_form_string = '-efg', string $contentType = self::contentTypes['testEnumParameters'][0] ): Request { @@ -5511,7 +5511,7 @@ function ($response) { * @return PromiseInterface */ public function testInlineAdditionalPropertiesAsyncWithHttpInfo( - $request_body, + array $request_body, string $contentType = self::contentTypes['testInlineAdditionalProperties'][0] ): PromiseInterface { @@ -5551,7 +5551,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testInlineAdditionalPropertiesRequest( - $request_body, + array $request_body, string $contentType = self::contentTypes['testInlineAdditionalProperties'][0] ): Request { @@ -5742,7 +5742,7 @@ function ($response) { * @return PromiseInterface */ public function testInlineFreeformAdditionalPropertiesAsyncWithHttpInfo( - $test_inline_freeform_additional_properties_request, + \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request, string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0] ): PromiseInterface { @@ -5782,7 +5782,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testInlineFreeformAdditionalPropertiesRequest( - $test_inline_freeform_additional_properties_request, + \OpenAPI\Client\Model\TestInlineFreeformAdditionalPropertiesRequest $test_inline_freeform_additional_properties_request, string $contentType = self::contentTypes['testInlineFreeformAdditionalProperties'][0] ): Request { @@ -5980,8 +5980,8 @@ function ($response) { * @return PromiseInterface */ public function testJsonFormDataAsyncWithHttpInfo( - $param, - $param2, + string $param, + string $param2, string $contentType = self::contentTypes['testJsonFormData'][0] ): PromiseInterface { @@ -6022,8 +6022,8 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testJsonFormDataRequest( - $param, - $param2, + string $param, + string $param2, string $contentType = self::contentTypes['testJsonFormData'][0] ): Request { @@ -6222,7 +6222,7 @@ function ($response) { * @return PromiseInterface */ public function testNullableAsyncWithHttpInfo( - $child_with_nullable, + \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable, string $contentType = self::contentTypes['testNullable'][0] ): PromiseInterface { @@ -6262,7 +6262,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testNullableRequest( - $child_with_nullable, + \OpenAPI\Client\Model\ChildWithNullable $child_with_nullable, string $contentType = self::contentTypes['testNullable'][0] ): Request { @@ -6369,7 +6369,7 @@ public function testQueryParameterCollectionFormat( array $url, array $context, string $allow_empty, - ?array $language = null, + array $language = null, string $contentType = self::contentTypes['testQueryParameterCollectionFormat'][0] ): void { @@ -6399,7 +6399,7 @@ public function testQueryParameterCollectionFormatWithHttpInfo( array $url, array $context, string $allow_empty, - ?array $language = null, + array $language = null, string $contentType = self::contentTypes['testQueryParameterCollectionFormat'][0] ): array { @@ -6459,7 +6459,7 @@ public function testQueryParameterCollectionFormatAsync( array $url, array $context, string $allow_empty, - ?array $language = null, + array $language = null, string $contentType = self::contentTypes['testQueryParameterCollectionFormat'][0] ): PromiseInterface { @@ -6487,13 +6487,13 @@ function ($response) { * @return PromiseInterface */ public function testQueryParameterCollectionFormatAsyncWithHttpInfo( - $pipe, - $ioutil, - $http, - $url, - $context, - $allow_empty, - $language = null, + array $pipe, + array $ioutil, + array $http, + array $url, + array $context, + string $allow_empty, + array $language = null, string $contentType = self::contentTypes['testQueryParameterCollectionFormat'][0] ): PromiseInterface { @@ -6539,13 +6539,13 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testQueryParameterCollectionFormatRequest( - $pipe, - $ioutil, - $http, - $url, - $context, - $allow_empty, - $language = null, + array $pipe, + array $ioutil, + array $http, + array $url, + array $context, + string $allow_empty, + array $language = null, string $contentType = self::contentTypes['testQueryParameterCollectionFormat'][0] ): Request { @@ -6828,7 +6828,7 @@ function ($response) { * @return PromiseInterface */ public function testStringMapReferenceAsyncWithHttpInfo( - $request_body, + array $request_body, string $contentType = self::contentTypes['testStringMapReference'][0] ): PromiseInterface { @@ -6868,7 +6868,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testStringMapReferenceRequest( - $request_body, + array $request_body, string $contentType = self::contentTypes['testStringMapReference'][0] ): Request { diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php index d6134dd9da28..9ba8235e4ecd 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/FakeClassnameTags123Api.php @@ -307,7 +307,7 @@ function ($response) { * @return PromiseInterface */ public function testClassnameAsyncWithHttpInfo( - $client, + \OpenAPI\Client\Model\Client $client, string $contentType = self::contentTypes['testClassname'][0] ): PromiseInterface { @@ -360,7 +360,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function testClassnameRequest( - $client, + \OpenAPI\Client\Model\Client $client, string $contentType = self::contentTypes['testClassname'][0] ): Request { diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php index ae7f2413d83d..88fd747f47bf 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/PetApi.php @@ -333,7 +333,7 @@ function ($response) { * @return PromiseInterface */ public function addPetAsyncWithHttpInfo( - $pet, + \OpenAPI\Client\Model\Pet $pet, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['addPet'][0] @@ -393,7 +393,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function addPetRequest( - $pet, + \OpenAPI\Client\Model\Pet $pet, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['addPet'][0] @@ -649,8 +649,8 @@ function ($response) { * @return PromiseInterface */ public function deletePetAsyncWithHttpInfo( - $pet_id, - $api_key = null, + int $pet_id, + ?string $api_key = null, string $contentType = self::contentTypes['deletePet'][0] ): PromiseInterface { @@ -691,8 +691,8 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function deletePetRequest( - $pet_id, - $api_key = null, + int $pet_id, + ?string $api_key = null, string $contentType = self::contentTypes['deletePet'][0] ): Request { @@ -971,7 +971,7 @@ function ($response) { * @return PromiseInterface */ public function findPetsByStatusAsyncWithHttpInfo( - $status, + array $status, string $contentType = self::contentTypes['findPetsByStatus'][0] ): PromiseInterface { @@ -1024,7 +1024,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function findPetsByStatusRequest( - $status, + array $status, string $contentType = self::contentTypes['findPetsByStatus'][0] ): Request { @@ -1303,7 +1303,7 @@ function ($response) { * @deprecated */ public function findPetsByTagsAsyncWithHttpInfo( - $tags, + array $tags, string $contentType = self::contentTypes['findPetsByTags'][0] ): PromiseInterface { @@ -1357,7 +1357,7 @@ function ($exception) { * @deprecated */ public function findPetsByTagsRequest( - $tags, + array $tags, string $contentType = self::contentTypes['findPetsByTags'][0] ): Request { @@ -1632,7 +1632,7 @@ function ($response) { * @return PromiseInterface */ public function getPetByIdAsyncWithHttpInfo( - $pet_id, + int $pet_id, string $contentType = self::contentTypes['getPetById'][0] ): PromiseInterface { @@ -1685,7 +1685,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function getPetByIdRequest( - $pet_id, + int $pet_id, string $contentType = self::contentTypes['getPetById'][0] ): Request { @@ -1960,7 +1960,7 @@ function ($response) { * @return PromiseInterface */ public function updatePetAsyncWithHttpInfo( - $pet, + \OpenAPI\Client\Model\Pet $pet, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['updatePet'][0] @@ -2020,7 +2020,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function updatePetRequest( - $pet, + \OpenAPI\Client\Model\Pet $pet, ?int $hostIndex = null, array $variables = [], string $contentType = self::contentTypes['updatePet'][0] @@ -2283,9 +2283,9 @@ function ($response) { * @return PromiseInterface */ public function updatePetWithFormAsyncWithHttpInfo( - $pet_id, - $name = null, - $status = null, + int $pet_id, + ?string $name = null, + ?string $status = null, string $contentType = self::contentTypes['updatePetWithForm'][0] ): PromiseInterface { @@ -2327,9 +2327,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function updatePetWithFormRequest( - $pet_id, - $name = null, - $status = null, + int $pet_id, + ?string $name = null, + ?string $status = null, string $contentType = self::contentTypes['updatePetWithForm'][0] ): Request { @@ -2627,9 +2627,9 @@ function ($response) { * @return PromiseInterface */ public function uploadFileAsyncWithHttpInfo( - $pet_id, - $additional_metadata = null, - $file = null, + int $pet_id, + ?string $additional_metadata = null, + ?\SplFileObject $file = null, string $contentType = self::contentTypes['uploadFile'][0] ): PromiseInterface { @@ -2684,9 +2684,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function uploadFileRequest( - $pet_id, - $additional_metadata = null, - $file = null, + int $pet_id, + ?string $additional_metadata = null, + ?\SplFileObject $file = null, string $contentType = self::contentTypes['uploadFile'][0] ): Request { @@ -2994,9 +2994,9 @@ function ($response) { * @return PromiseInterface */ public function uploadFileWithRequiredFileAsyncWithHttpInfo( - $pet_id, - $required_file, - $additional_metadata = null, + int $pet_id, + \SplFileObject $required_file, + ?string $additional_metadata = null, string $contentType = self::contentTypes['uploadFileWithRequiredFile'][0] ): PromiseInterface { @@ -3051,9 +3051,9 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function uploadFileWithRequiredFileRequest( - $pet_id, - $required_file, - $additional_metadata = null, + int $pet_id, + \SplFileObject $required_file, + ?string $additional_metadata = null, string $contentType = self::contentTypes['uploadFileWithRequiredFile'][0] ): Request { diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php index 99afa3b09938..892670b58247 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/StoreApi.php @@ -238,7 +238,7 @@ function ($response) { * @return PromiseInterface */ public function deleteOrderAsyncWithHttpInfo( - $order_id, + string $order_id, string $contentType = self::contentTypes['deleteOrder'][0] ): PromiseInterface { @@ -278,7 +278,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function deleteOrderRequest( - $order_id, + string $order_id, string $contentType = self::contentTypes['deleteOrder'][0] ): Request { @@ -851,7 +851,7 @@ function ($response) { * @return PromiseInterface */ public function getOrderByIdAsyncWithHttpInfo( - $order_id, + int $order_id, string $contentType = self::contentTypes['getOrderById'][0] ): PromiseInterface { @@ -904,7 +904,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function getOrderByIdRequest( - $order_id, + int $order_id, string $contentType = self::contentTypes['getOrderById'][0] ): Request { @@ -1180,7 +1180,7 @@ function ($response) { * @return PromiseInterface */ public function placeOrderAsyncWithHttpInfo( - $order, + \OpenAPI\Client\Model\Order $order, string $contentType = self::contentTypes['placeOrder'][0] ): PromiseInterface { @@ -1233,7 +1233,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function placeOrderRequest( - $order, + \OpenAPI\Client\Model\Order $order, string $contentType = self::contentTypes['placeOrder'][0] ): Request { diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php index 8181e112fdec..e7eb2ab78a33 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Api/UserApi.php @@ -250,7 +250,7 @@ function ($response) { * @return PromiseInterface */ public function createUserAsyncWithHttpInfo( - $user, + \OpenAPI\Client\Model\User $user, string $contentType = self::contentTypes['createUser'][0] ): PromiseInterface { @@ -290,7 +290,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function createUserRequest( - $user, + \OpenAPI\Client\Model\User $user, string $contentType = self::contentTypes['createUser'][0] ): Request { @@ -481,7 +481,7 @@ function ($response) { * @return PromiseInterface */ public function createUsersWithArrayInputAsyncWithHttpInfo( - $user, + array $user, string $contentType = self::contentTypes['createUsersWithArrayInput'][0] ): PromiseInterface { @@ -521,7 +521,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function createUsersWithArrayInputRequest( - $user, + array $user, string $contentType = self::contentTypes['createUsersWithArrayInput'][0] ): Request { @@ -712,7 +712,7 @@ function ($response) { * @return PromiseInterface */ public function createUsersWithListInputAsyncWithHttpInfo( - $user, + array $user, string $contentType = self::contentTypes['createUsersWithListInput'][0] ): PromiseInterface { @@ -752,7 +752,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function createUsersWithListInputRequest( - $user, + array $user, string $contentType = self::contentTypes['createUsersWithListInput'][0] ): Request { @@ -943,7 +943,7 @@ function ($response) { * @return PromiseInterface */ public function deleteUserAsyncWithHttpInfo( - $username, + string $username, string $contentType = self::contentTypes['deleteUser'][0] ): PromiseInterface { @@ -983,7 +983,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function deleteUserRequest( - $username, + string $username, string $contentType = self::contentTypes['deleteUser'][0] ): Request { @@ -1253,7 +1253,7 @@ function ($response) { * @return PromiseInterface */ public function getUserByNameAsyncWithHttpInfo( - $username, + string $username, string $contentType = self::contentTypes['getUserByName'][0] ): PromiseInterface { @@ -1306,7 +1306,7 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function getUserByNameRequest( - $username, + string $username, string $contentType = self::contentTypes['getUserByName'][0] ): Request { @@ -1583,8 +1583,8 @@ function ($response) { * @return PromiseInterface */ public function loginUserAsyncWithHttpInfo( - $username, - $password, + string $username, + string $password, string $contentType = self::contentTypes['loginUser'][0] ): PromiseInterface { @@ -1638,8 +1638,8 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function loginUserRequest( - $username, - $password, + string $username, + string $password, string $contentType = self::contentTypes['loginUser'][0] ): Request { @@ -2062,8 +2062,8 @@ function ($response) { * @return PromiseInterface */ public function updateUserAsyncWithHttpInfo( - $username, - $user, + string $username, + \OpenAPI\Client\Model\User $user, string $contentType = self::contentTypes['updateUser'][0] ): PromiseInterface { @@ -2104,8 +2104,8 @@ function ($exception) { * @return \GuzzleHttp\Psr7\Request */ public function updateUserRequest( - $username, - $user, + string $username, + \OpenAPI\Client\Model\User $user, string $contentType = self::contentTypes['updateUser'][0] ): Request { diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/Animal.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/Animal.php index 3d9221bf7214..ff8d05b36e6d 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/Animal.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/Animal.php @@ -233,6 +233,8 @@ public function getModelName(): string return self::$openAPIModelName; } + public const CLASS_NAME_CAT = 'CAT'; + public const CLASS_NAME_DOG = 'DOG'; /** * Associative array for storing property values @@ -248,11 +250,11 @@ public function getModelName(): string */ public function __construct(array $data = null) { - $this->setIfExists('class_name', $data ?? [], null); - $this->setIfExists('color', $data ?? [], 'red'); - // Initialize discriminator property with the model name. $this->container['class_name'] = static::$openAPIModelName; + + $this->setIfExists('class_name', $data ?? [], null); + $this->setIfExists('color', $data ?? [], 'red'); } /** diff --git a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ParentWithNullable.php b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ParentWithNullable.php index 21bb921932d4..bab081d0f9ee 100644 --- a/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ParentWithNullable.php +++ b/samples/client/petstore/php-nextgen/OpenAPIClient-php/src/Model/ParentWithNullable.php @@ -261,11 +261,11 @@ public function getTypeAllowableValues() */ public function __construct(array $data = null) { - $this->setIfExists('type', $data ?? [], null); - $this->setIfExists('nullable_property', $data ?? [], null); - // Initialize discriminator property with the model name. $this->container['type'] = static::$openAPIModelName; + + $this->setIfExists('type', $data ?? [], null); + $this->setIfExists('nullable_property', $data ?? [], null); } /** diff --git a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php index a6a9a0b85529..6e88ddff3bca 100644 --- a/samples/client/petstore/php/psr-18/lib/Api/PetApi.php +++ b/samples/client/petstore/php/psr-18/lib/Api/PetApi.php @@ -177,7 +177,7 @@ public function getConfig() * * Add a new pet to the store * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -198,7 +198,7 @@ public function addPet($pet) * * Add a new pet to the store * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -253,7 +253,7 @@ public function addPetWithHttpInfo($pet) * * Add a new pet to the store * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -278,7 +278,7 @@ function ($response) { * * Add a new pet to the store * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -318,7 +318,7 @@ function (HttpException $exception) { /** * Create request for operation 'addPet' * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1413,7 +1413,7 @@ public function getPetByIdRequest($pet_id) * * Update an existing pet * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1434,7 +1434,7 @@ public function updatePet($pet) * * Update an existing pet * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1489,7 +1489,7 @@ public function updatePetWithHttpInfo($pet) * * Update an existing pet * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1514,7 +1514,7 @@ function ($response) { * * Update an existing pet * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 @@ -1554,7 +1554,7 @@ function (HttpException $exception) { /** * Create request for operation 'updatePet' * - * This oepration contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. * URL: http://petstore.swagger.io/v2 * URL: http://path-server-test.petstore.local/v2 * URL: http://{server}.swagger.io:{port}/v2 diff --git a/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/PetAPI.swift b/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/PetAPI.swift index 94a82a25ec63..b299369a8996 100644 --- a/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/PetAPI.swift +++ b/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/PetAPI.swift @@ -273,7 +273,7 @@ open class PetAPI { /// - GET /pet/{petId} /// - Returns a single pet /// - API Key: - /// - type: apiKey api_key + /// - type: apiKey api_key (HEADER) /// - name: api_key /// - parameter petId: (path) ID of pet to return /// - returns: AnyPublisher diff --git a/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/StoreAPI.swift b/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/StoreAPI.swift index e0bd1eb56eb3..6277f998447b 100644 --- a/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/StoreAPI.swift @@ -88,7 +88,7 @@ open class StoreAPI { /// - GET /store/inventory /// - Returns a map of status codes to quantities /// - API Key: - /// - type: apiKey api_key + /// - type: apiKey api_key (HEADER) /// - name: api_key /// - returns: AnyPublisher<[String: Int], Error> open func getInventory() -> AnyPublisher<[String: Int], Error> { diff --git a/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/UserAPI.swift b/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/UserAPI.swift index cd0e6b0611f3..071f6d3fdcf2 100644 --- a/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/UserAPI.swift +++ b/samples/client/petstore/swift-combine/client/PetstoreOpenAPI/Sources/APIs/UserAPI.swift @@ -32,7 +32,7 @@ open class UserAPI { /// - POST /user /// - This can only be done by the logged in user. /// - API Key: - /// - type: apiKey api_key + /// - type: apiKey api_key (HEADER) /// - name: api_key /// - parameter user: (body) Created user object /// - returns: AnyPublisher @@ -68,7 +68,7 @@ open class UserAPI { /// - POST /user/createWithArray /// - /// - API Key: - /// - type: apiKey api_key + /// - type: apiKey api_key (HEADER) /// - name: api_key /// - parameter user: (body) List of user object /// - returns: AnyPublisher @@ -104,7 +104,7 @@ open class UserAPI { /// - POST /user/createWithList /// - /// - API Key: - /// - type: apiKey api_key + /// - type: apiKey api_key (HEADER) /// - name: api_key /// - parameter user: (body) List of user object /// - returns: AnyPublisher @@ -155,7 +155,7 @@ open class UserAPI { /// - DELETE /user/{username} /// - This can only be done by the logged in user. /// - API Key: - /// - type: apiKey api_key + /// - type: apiKey api_key (HEADER) /// - name: api_key /// - parameter username: (path) The name that needs to be deleted /// - returns: AnyPublisher @@ -309,7 +309,7 @@ open class UserAPI { /// - GET /user/logout /// - /// - API Key: - /// - type: apiKey api_key + /// - type: apiKey api_key (HEADER) /// - name: api_key /// - returns: AnyPublisher open func logoutUser() -> AnyPublisher { @@ -357,7 +357,7 @@ open class UserAPI { /// - PUT /user/{username} /// - This can only be done by the logged in user. /// - API Key: - /// - type: apiKey api_key + /// - type: apiKey api_key (HEADER) /// - name: api_key /// - parameter username: (path) name that need to be deleted /// - parameter user: (body) Updated user object diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 1d15c6b37743..989ee57e466f 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -12,13 +12,13 @@ import AnyCodable public struct FormatTest: Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index f36abb2bcd60..768534cc53d9 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -12,13 +12,13 @@ import AnyCodable public struct FormatTest: Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 6fa4d0e20eb9..aa6558b927bb 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index f36abb2bcd60..768534cc53d9 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -12,13 +12,13 @@ import AnyCodable public struct FormatTest: Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 6fa4d0e20eb9..aa6558b927bb 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 48248f47cf3a..5cea4969d1fb 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -12,13 +12,13 @@ import AnyCodable public struct FormatTest: Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 899d354127a6..0127ee2bbd03 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -17,7 +17,7 @@ public struct Pet: Codable, JSONEncodable, Hashable { case pending = "pending" case sold = "sold" } - static let photoUrlsRule = ArrayRule(minItems: nil, maxItems: nil, uniqueItems: true) + public static let photoUrlsRule = ArrayRule(minItems: nil, maxItems: nil, uniqueItems: true) public var id: Int64? public var category: Category? public var name: String diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 6fa4d0e20eb9..aa6558b927bb 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 0e1f9058cb3c..9b5c9083ae4a 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -12,13 +12,13 @@ import AnyCodable @objcMembers public class FormatTest: NSObject, Codable, JSONEncodable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var integerNum: NSNumber? { get { diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 6fa4d0e20eb9..aa6558b927bb 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 6fa4d0e20eb9..aa6558b927bb 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index f36abb2bcd60..768534cc53d9 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -12,13 +12,13 @@ import AnyCodable public struct FormatTest: Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 6fa4d0e20eb9..aa6558b927bb 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 7b62c973d425..0517ea824b4f 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -12,13 +12,13 @@ import AnyCodable internal struct FormatTest: Codable, JSONEncodable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + internal static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + internal static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + internal static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + internal static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + internal static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + internal static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + internal static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) internal private(set) var integer: Int? internal private(set) var int32: Int? internal private(set) var int64: Int64? diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index a76ea20537dd..8d45a2bbb69f 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift index ced1069dd454..7591b5218353 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ internal struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. internal static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ internal struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. internal static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index f36abb2bcd60..768534cc53d9 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -12,13 +12,13 @@ import AnyCodable public struct FormatTest: Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 6fa4d0e20eb9..aa6558b927bb 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift index a4d90bfe6f70..3857b3575b27 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -17,13 +17,13 @@ extension PetstoreClientAPI { public final class FormatTest: Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift index 6fa4d0e20eb9..aa6558b927bb 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Validation.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Validation.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift index 5eb857cb6a95..d7a57ed42503 100644 --- a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift +++ b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift @@ -12,8 +12,8 @@ import AnyCodable public struct Banana: Codable, JSONEncodable, Hashable { - static let countRule = NumericRule(minimum: 10, exclusiveMinimum: true, maximum: 100, exclusiveMaximum: true, multipleOf: 5) - static let idsRule = ArrayRule(minItems: 1, maxItems: 10, uniqueItems: false) + public static let countRule = NumericRule(minimum: 10, exclusiveMinimum: true, maximum: 100, exclusiveMaximum: true, multipleOf: 5) + public static let idsRule = ArrayRule(minItems: 1, maxItems: 10, uniqueItems: false) public var count: Int? public var ids: [Int]? diff --git a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 6fa4d0e20eb9..aa6558b927bb 100644 --- a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -611,12 +611,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Validation.swift b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Validation.swift +++ b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift index ea3dde72f1e0..7cb3629e5f4a 100644 --- a/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -13,13 +13,13 @@ import Vapor public final class FormatTest: Content, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift index 7a30afd16d2b..5c6053b5fef6 100644 --- a/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -18,7 +18,7 @@ public final class Pet: Content, Hashable { case pending = "pending" case sold = "sold" } - static let photoUrlsRule = ArrayRule(minItems: nil, maxItems: nil, uniqueItems: true) + public static let photoUrlsRule = ArrayRule(minItems: nil, maxItems: nil, uniqueItems: true) public var id: Int64? public var category: Category? public var name: String diff --git a/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Validation.swift b/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Validation.swift index 6a0d4c9da1ab..3bf4ec03fea4 100644 --- a/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Validation.swift +++ b/samples/client/petstore/swift5/vaporLibrary/Sources/PetstoreClient/Validation.swift @@ -77,11 +77,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -109,11 +109,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FormatTest.swift index 6be7a8c54836..3d80f272cc87 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift index dd542567ad80..578959cee5d3 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FormatTest.swift index 54a1e5640a6e..3bfc12535c31 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 54a1e5640a6e..3bfc12535c31 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FormatTest.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FormatTest.swift index 54a1e5640a6e..3bfc12535c31 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FormatTest.swift index b02ae5156498..0adfc5510036 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift index 0518f378e107..b565e632a3e2 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Models/Pet.swift @@ -14,7 +14,7 @@ public struct Pet: Sendable, Codable, JSONEncodable, Hashable { case pending = "pending" case sold = "sold" } - static let photoUrlsRule = ArrayRule(minItems: nil, maxItems: nil, uniqueItems: true) + public static let photoUrlsRule = ArrayRule(minItems: nil, maxItems: nil, uniqueItems: true) public var id: Int64? public var category: Category? public var name: String diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift index b8e49bf4478d..601d5f418adf 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation @objcMembers public class FormatTest: NSObject, Codable, JSONEncodable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var integerNum: NSNumber? { get { diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 54a1e5640a6e..3bfc12535c31 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index cf58e2a66eda..99cdd86d4468 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index f9a3750d668f..104b74903650 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ internal struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. internal static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ internal struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. internal static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index e0bce4b50066..6cc1faba0224 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation internal struct FormatTest: Sendable, Codable, JSONEncodable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + internal static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + internal static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + internal static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + internal static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + internal static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + internal static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + internal static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) internal private(set) var integer: Int? internal private(set) var int32: Int? internal private(set) var int64: Int64? diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index 54a1e5640a6e..3bfc12535c31 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -9,13 +9,13 @@ import Foundation public struct FormatTest: Sendable, Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift index 52bc27014622..e45cfbe07d9f 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -14,13 +14,13 @@ extension PetstoreClientAPI { public final class FormatTest: @unchecked Sendable, Codable, JSONEncodable, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public private(set) var integer: Int? public private(set) var int32: Int? public private(set) var int64: Int64? diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 043a2d5d8e21..a583e24501bf 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -636,12 +636,24 @@ private class FormURLEncoding: ParameterEncoding { var urlRequest = urlRequest var requestBodyComponents = URLComponents() - requestBodyComponents.queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + let queryItems = APIHelper.mapValuesToQueryItems(parameters ?? [:]) + + /// `httpBody` needs to be percent encoded + /// -> https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST + /// "application/x-www-form-urlencoded: [...] Non-alphanumeric characters in both keys and values are percent-encoded" + let percentEncodedQueryItems = queryItems?.compactMap { queryItem in + return URLQueryItem( + name: queryItem.name.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.name, + value: queryItem.value?.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? queryItem.value) + } + requestBodyComponents.queryItems = percentEncodedQueryItems if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { urlRequest.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type") } + /// We can't use `requestBodyComponents.percentEncodedQuery` since this does NOT percent encode the `+` sign + /// that is why we do the percent encoding manually for each key/value pair urlRequest.httpBody = requestBodyComponents.query?.data(using: .utf8) return urlRequest diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift index e38a08efb19f..5013d8f8d068 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Models/Banana.swift @@ -9,8 +9,8 @@ import Foundation public struct Banana: Sendable, Codable, JSONEncodable, Hashable { - static let countRule = NumericRule(minimum: 10, exclusiveMinimum: true, maximum: 100, exclusiveMaximum: true, multipleOf: 5) - static let idsRule = ArrayRule(minItems: 1, maxItems: 10, uniqueItems: false) + public static let countRule = NumericRule(minimum: 10, exclusiveMinimum: true, maximum: 100, exclusiveMaximum: true, multipleOf: 5) + public static let idsRule = ArrayRule(minItems: 1, maxItems: 10, uniqueItems: false) public var count: Int? public var ids: [Int]? diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift index f2824965ddfb..d4c743d96074 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Infrastructure/Validation.swift @@ -78,11 +78,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } @@ -110,11 +110,11 @@ public struct Validator { /// - Throws: `ValidationError` if the numeric is invalid against the rule. public static func validate(_ numeric: T, against rule: NumericRule) throws -> T { var error = ValidationError(kinds: []) - if let minium = rule.minimum { - if !rule.exclusiveMinimum, minium > numeric { + if let minimum = rule.minimum { + if !rule.exclusiveMinimum, minimum > numeric { error.kinds.insert(.minimum) } - if rule.exclusiveMinimum, minium >= numeric { + if rule.exclusiveMinimum, minimum >= numeric { error.kinds.insert(.minimum) } } diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift index c1389aed7188..570ef7166630 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/FormatTest.swift @@ -10,13 +10,13 @@ import Vapor public final class FormatTest: Content, Hashable { - static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) - static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) - static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) - static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) - static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) - static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") - static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) + public static let integerRule = NumericRule(minimum: 10, exclusiveMinimum: false, maximum: 100, exclusiveMaximum: false, multipleOf: nil) + public static let int32Rule = NumericRule(minimum: 20, exclusiveMinimum: false, maximum: 200, exclusiveMaximum: false, multipleOf: nil) + public static let numberRule = NumericRule(minimum: 32.1, exclusiveMinimum: false, maximum: 543.2, exclusiveMaximum: false, multipleOf: nil) + public static let floatRule = NumericRule(minimum: 54.3, exclusiveMinimum: false, maximum: 987.6, exclusiveMaximum: false, multipleOf: nil) + public static let doubleRule = NumericRule(minimum: 67.8, exclusiveMinimum: false, maximum: 123.4, exclusiveMaximum: false, multipleOf: nil) + public static let stringRule = StringRule(minLength: nil, maxLength: nil, pattern: "/[a-z]/i") + public static let passwordRule = StringRule(minLength: 10, maxLength: 64, pattern: nil) public var integer: Int? public var int32: Int? public var int64: Int64? diff --git a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift index 063415378890..04cffcaa7fc0 100644 --- a/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift +++ b/samples/client/petstore/swift6/vaporLibrary/Sources/PetstoreClient/Models/Pet.swift @@ -15,7 +15,7 @@ public final class Pet: Content, Hashable { case pending = "pending" case sold = "sold" } - static let photoUrlsRule = ArrayRule(minItems: nil, maxItems: nil, uniqueItems: true) + public static let photoUrlsRule = ArrayRule(minItems: nil, maxItems: nil, uniqueItems: true) public var id: Int64? public var category: Category? public var name: String diff --git a/samples/client/petstore/xojo/client-synchronous/README.md b/samples/client/petstore/xojo/client-synchronous/README.md index bee48ad16c90..8608f65af8cc 100644 --- a/samples/client/petstore/xojo/client-synchronous/README.md +++ b/samples/client/petstore/xojo/client-synchronous/README.md @@ -25,7 +25,7 @@ This project depends on [Xoson](https://github.com/Topheee/xoson) `v2.2.0` (and git clone 'https://github.com/Topheee/xoson.git' ``` -Open the `Xoson.xojo_project` from the cloned git repository with Xojo and copy the `Xoson` module to your project. Similarily, open the `XojoOpenAPIClientSynchronous.xojo_project` file with Xojo and copy `XojoOpenAPIClientSynchronous` to your project. +Open the `Xoson.xojo_project` from the cloned git repository with Xojo and copy the `Xoson` module to your project. Similarly, open the `XojoOpenAPIClientSynchronous.xojo_project` file with Xojo and copy `XojoOpenAPIClientSynchronous` to your project. > Since Xojo currently has no package manager, you need to manually copy both the `Xoson` and the `XojoOpenAPIClientSynchronous` modules to your Xojo project. diff --git a/samples/client/petstore/xojo/client/README.md b/samples/client/petstore/xojo/client/README.md index 2a06c1f97cae..ef4929c29883 100644 --- a/samples/client/petstore/xojo/client/README.md +++ b/samples/client/petstore/xojo/client/README.md @@ -25,7 +25,7 @@ This project depends on [Xoson](https://github.com/Topheee/xoson) `v2.2.0` (and git clone 'https://github.com/Topheee/xoson.git' ``` -Open the `Xoson.xojo_project` from the cloned git repository with Xojo and copy the `Xoson` module to your project. Similarily, open the `OpenAPIClient.xojo_project` file with Xojo and copy `OpenAPIClient` to your project. +Open the `Xoson.xojo_project` from the cloned git repository with Xojo and copy the `Xoson` module to your project. Similarly, open the `OpenAPIClient.xojo_project` file with Xojo and copy `OpenAPIClient` to your project. > Since Xojo currently has no package manager, you need to manually copy both the `Xoson` and the `OpenAPIClient` modules to your Xojo project. diff --git a/samples/client/petstore/zapier/authentication.js b/samples/client/petstore/zapier/authentication.js index 8294e5fc99a6..8a1bf2e76b5e 100644 --- a/samples/client/petstore/zapier/authentication.js +++ b/samples/client/petstore/zapier/authentication.js @@ -1,4 +1,4 @@ module.exports = { - // TODO: autentication logic + // TODO: authentication logic // https://platform.zapier.com/cli_tutorials/getting-started#adding-authentication }; \ No newline at end of file diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py index 0cb484becbdb..195e150623d2 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py @@ -150,6 +150,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -188,6 +195,16 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_another_fake_api.py index 89c28d0ff7e8..93d3c4088940 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_another_fake_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_another_fake_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = AnotherFakeApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_call_123_test_special_tags(self) -> None: """Test case for call_123_test_special_tags diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_default_api.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_default_api.py index a0e95f5d9ebd..763eed825053 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_default_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_default_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = DefaultApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_foo_get(self) -> None: """Test case for foo_get diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_test.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_test.py index e83daf724588..5f2f59e6c62b 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_enum_test.py @@ -42,6 +42,8 @@ def make_instance(self, include_optional) -> EnumTest: enum_number = 1.1, enum_number_vendor_ext = 42, enum_string_vendor_ext = 'FOO', + enum_string_single_member = 'abc', + enum_integer_single_member = 100, outer_enum = 'placed', outer_enum_integer = 2, outer_enum_default_value = 'placed', diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_fake_api.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_fake_api.py index 902c6faa7224..048479d824ed 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_fake_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_fake_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = FakeApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_fake_any_type_request_body(self) -> None: """Test case for fake_any_type_request_body @@ -267,6 +267,13 @@ async def test_test_string_map_reference(self) -> None: """ pass + async def test_upload_file_with_additional_properties(self) -> None: + """Test case for upload_file_with_additional_properties + + uploads a file and additional properties using multipart/form-data + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_fake_classname_tags123_api.py index db43948df4d5..12a8629dc308 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_fake_classname_tags123_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = FakeClassnameTags123Api() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_test_classname(self) -> None: """Test case for test_classname diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_import_test_datetime_api.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_import_test_datetime_api.py index c8effe2e53a9..73069b626123 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_import_test_datetime_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_import_test_datetime_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = ImportTestDatetimeApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_import_test_return_datetime(self) -> None: """Test case for import_test_return_datetime diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_pet_api.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_pet_api.py index 278abd0f0c42..19c138fee2c1 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_pet_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_pet_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = PetApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_add_pet(self) -> None: """Test case for add_pet diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_store_api.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_store_api.py index 166821bab54e..5cbcd18b75fb 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_store_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_store_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = StoreApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_delete_order(self) -> None: """Test case for delete_order diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_user_api.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_user_api.py index ba67311e3932..e091d190dea4 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_user_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_user_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = UserApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_create_user(self) -> None: """Test case for create_user diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py index 4066eae53a86..8a2d152a8eda 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_another_fake_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = AnotherFakeApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_call_123_test_special_tags(self) -> None: """Test case for call_123_test_special_tags diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py index 1485ea799f79..d95ab045e08e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_default_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = DefaultApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_foo_get(self) -> None: """Test case for foo_get diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py index 3c57cd467c8c..a9f432cf9ce8 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_enum_test.py @@ -43,6 +43,8 @@ def make_instance(self, include_optional) -> EnumTest: enum_number = 1.1, enum_number_vendor_ext = 42, enum_string_vendor_ext = 'FOO', + enum_string_single_member = 'abc', + enum_integer_single_member = 100, outer_enum = 'placed', outer_enum_integer = 2, outer_enum_default_value = 'placed', diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py index dcaf7fb84f15..257a83ba918a 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = FakeApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_fake_any_type_request_body(self) -> None: """Test case for fake_any_type_request_body @@ -267,6 +267,13 @@ async def test_test_string_map_reference(self) -> None: """ pass + async def test_upload_file_with_additional_properties(self) -> None: + """Test case for upload_file_with_additional_properties + + uploads a file and additional properties using multipart/form-data # noqa: E501 + """ + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py index 0b3fcb004d96..24acad38d43a 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_fake_classname_tags123_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = FakeClassnameTags123Api() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_test_classname(self) -> None: """Test case for test_classname diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_import_test_datetime_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_import_test_datetime_api.py index ba6b500f4eb8..f573836f1717 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_import_test_datetime_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_import_test_datetime_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = ImportTestDatetimeApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_import_test_return_datetime(self) -> None: """Test case for import_test_return_datetime diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py index 35c72b2892bc..32b548703a8e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pet_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = PetApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_add_pet(self) -> None: """Test case for add_pet diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py index 8c2ba9c1e5c8..4f1f78442c9c 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_store_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = StoreApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_delete_order(self) -> None: """Test case for delete_order diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py index 769d7e00f8e0..12c80839d250 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_user_api.py @@ -24,7 +24,7 @@ async def asyncSetUp(self) -> None: self.api = UserApi() async def asyncTearDown(self) -> None: - pass + await self.api.api_client.close() async def test_create_user(self) -> None: """Test case for create_user diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py index c2c9c7c58069..a1669f0664d2 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_any_type.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501 -from petstore_api.rest import ApiException class TestAdditionalPropertiesAnyType(unittest.TestCase): """AdditionalPropertiesAnyType unit test stubs""" @@ -28,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AdditionalPropertiesAnyType: """Test AdditionalPropertiesAnyType include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesAnyType` """ - model = petstore_api.models.additional_properties_any_type.AdditionalPropertiesAnyType() # noqa: E501 - if include_optional : + model = AdditionalPropertiesAnyType() # noqa: E501 + if include_optional: return AdditionalPropertiesAnyType( name = '' ) - else : + else: return AdditionalPropertiesAnyType( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py index e3b48bedd571..d1dc12c44584 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_class.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.additional_properties_class import AdditionalPropertiesClass # noqa: E501 -from petstore_api.rest import ApiException class TestAdditionalPropertiesClass(unittest.TestCase): """AdditionalPropertiesClass unit test stubs""" @@ -28,26 +26,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AdditionalPropertiesClass: """Test AdditionalPropertiesClass include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesClass` """ - model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501 - if include_optional : + model = AdditionalPropertiesClass() # noqa: E501 + if include_optional: return AdditionalPropertiesClass( map_property = { 'key' : '' - }, + }, map_of_map_property = { 'key' : { 'key' : '' } } ) - else : + else: return AdditionalPropertiesClass( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py index b68a8fda5790..9bfa2a0cde83 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_object.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.additional_properties_object import AdditionalPropertiesObject # noqa: E501 -from petstore_api.rest import ApiException class TestAdditionalPropertiesObject(unittest.TestCase): """AdditionalPropertiesObject unit test stubs""" @@ -28,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AdditionalPropertiesObject: """Test AdditionalPropertiesObject include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesObject` """ - model = petstore_api.models.additional_properties_object.AdditionalPropertiesObject() # noqa: E501 - if include_optional : + model = AdditionalPropertiesObject() # noqa: E501 + if include_optional: return AdditionalPropertiesObject( name = '' ) - else : + else: return AdditionalPropertiesObject( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py index d5166dfe1342..88df1cc92955 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_additional_properties_with_description_only.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly # noqa: E501 -from petstore_api.rest import ApiException class TestAdditionalPropertiesWithDescriptionOnly(unittest.TestCase): """AdditionalPropertiesWithDescriptionOnly unit test stubs""" @@ -28,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AdditionalPropertiesWithDescriptionOnly: """Test AdditionalPropertiesWithDescriptionOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesWithDescriptionOnly` """ - model = petstore_api.models.additional_properties_with_description_only.AdditionalPropertiesWithDescriptionOnly() # noqa: E501 - if include_optional : + model = AdditionalPropertiesWithDescriptionOnly() # noqa: E501 + if include_optional: return AdditionalPropertiesWithDescriptionOnly( name = '' ) - else : + else: return AdditionalPropertiesWithDescriptionOnly( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py index ee761ef82d0a..920ad3782e15 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_all_of_with_single_ref.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef # noqa: E501 -from petstore_api.rest import ApiException class TestAllOfWithSingleRef(unittest.TestCase): """AllOfWithSingleRef unit test stubs""" @@ -28,25 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AllOfWithSingleRef: """Test AllOfWithSingleRef include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.all_of_with_single_ref.AllOfWithSingleRef() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `AllOfWithSingleRef` + """ + model = AllOfWithSingleRef() # noqa: E501 + if include_optional: return AllOfWithSingleRef( - username = '', - single_ref_type = None + username = '', + single_ref_type = 'admin' ) - else : + else: return AllOfWithSingleRef( ) + """ def testAllOfWithSingleRef(self): """Test AllOfWithSingleRef""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py index d209151de678..b0b62a0bb2b3 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_animal.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.animal import Animal # noqa: E501 -from petstore_api.rest import ApiException class TestAnimal(unittest.TestCase): """Animal unit test stubs""" @@ -28,26 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Animal: """Test Animal include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.animal.Animal() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Animal` + """ + model = Animal() # noqa: E501 + if include_optional: return Animal( - class_name = '', + class_name = '', color = 'red' ) - else : + else: return Animal( class_name = '', ) + """ def testAnimal(self): """Test Animal""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py index d95798cfc5a4..29a8cab199e7 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_another_fake_api.py @@ -3,32 +3,30 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501 -from petstore_api.rest import ApiException class TestAnotherFakeApi(unittest.TestCase): """AnotherFakeApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.another_fake_api.AnotherFakeApi() # noqa: E501 + def setUp(self) -> None: + self.api = AnotherFakeApi() - def tearDown(self): - pass + def tearDown(self) -> None: + self.api.api_client.close() - def test_call_123_test_special_tags(self): + def test_call_123_test_special_tags(self) -> None: """Test case for call_123_test_special_tags To test special tags # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py index 2a97cfef7526..f99dfd0020b1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_color.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.any_of_color import AnyOfColor # noqa: E501 -from petstore_api.rest import ApiException class TestAnyOfColor(unittest.TestCase): """AnyOfColor unit test stubs""" @@ -28,18 +26,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AnyOfColor: """Test AnyOfColor include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AnyOfColor` """ - model = petstore_api.models.any_of_color.AnyOfColor() # noqa: E501 - if include_optional : + model = AnyOfColor() # noqa: E501 + if include_optional: return AnyOfColor( ) - else : + else: return AnyOfColor( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py index f041e5f9d6f7..c3e4760182c5 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_any_of_pig.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.any_of_pig import AnyOfPig # noqa: E501 -from petstore_api.rest import ApiException class TestAnyOfPig(unittest.TestCase): """AnyOfPig unit test stubs""" @@ -28,6 +26,28 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional) -> AnyOfPig: + """Test AnyOfPig + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `AnyOfPig` + """ + model = AnyOfPig() # noqa: E501 + if include_optional: + return AnyOfPig( + class_name = '', + color = '', + size = 56 + ) + else: + return AnyOfPig( + class_name = '', + color = '', + size = 56, + ) + """ + def testAnyOfPig(self): """Test AnyOfPig""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py index 95efd33bce57..9882aa1b9005 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_api_response.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.api_response import ApiResponse # noqa: E501 -from petstore_api.rest import ApiException class TestApiResponse(unittest.TestCase): """ApiResponse unit test stubs""" @@ -28,26 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ApiResponse: """Test ApiResponse include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.api_response.ApiResponse() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ApiResponse` + """ + model = ApiResponse() # noqa: E501 + if include_optional: return ApiResponse( - code = 56, - type = '', + code = 56, + type = '', message = '' ) - else : + else: return ApiResponse( ) + """ def testApiResponse(self): """Test ApiResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py index 1072a19255de..7c0809b0b233 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_model.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel # noqa: E501 -from petstore_api.rest import ApiException class TestArrayOfArrayOfModel(unittest.TestCase): """ArrayOfArrayOfModel unit test stubs""" @@ -28,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ArrayOfArrayOfModel: """Test ArrayOfArrayOfModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ArrayOfArrayOfModel` """ - model = petstore_api.models.array_of_array_of_model.ArrayOfArrayOfModel() # noqa: E501 - if include_optional : + model = ArrayOfArrayOfModel() # noqa: E501 + if include_optional: return ArrayOfArrayOfModel( - shop_id_to_org_online_lip_map = [ + another_property = [ [ petstore_api.models.tag.Tag( id = 56, @@ -46,7 +44,7 @@ def make_instance(self, include_optional): ] ] ) - else : + else: return ArrayOfArrayOfModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py index 001b4e565737..22160c2bd055 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_array_of_number_only.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly # noqa: E501 -from petstore_api.rest import ApiException class TestArrayOfArrayOfNumberOnly(unittest.TestCase): """ArrayOfArrayOfNumberOnly unit test stubs""" @@ -28,13 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ArrayOfArrayOfNumberOnly: """Test ArrayOfArrayOfNumberOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.array_of_array_of_number_only.ArrayOfArrayOfNumberOnly() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ArrayOfArrayOfNumberOnly` + """ + model = ArrayOfArrayOfNumberOnly() # noqa: E501 + if include_optional: return ArrayOfArrayOfNumberOnly( array_array_number = [ [ @@ -42,14 +42,15 @@ def make_instance(self, include_optional): ] ] ) - else : + else: return ArrayOfArrayOfNumberOnly( ) + """ def testArrayOfArrayOfNumberOnly(self): """Test ArrayOfArrayOfNumberOnly""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py index a35703ae0dac..ade32f4f8f21 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_of_number_only.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.array_of_number_only import ArrayOfNumberOnly # noqa: E501 -from petstore_api.rest import ApiException class TestArrayOfNumberOnly(unittest.TestCase): """ArrayOfNumberOnly unit test stubs""" @@ -28,26 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ArrayOfNumberOnly: """Test ArrayOfNumberOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.array_of_number_only.ArrayOfNumberOnly() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ArrayOfNumberOnly` + """ + model = ArrayOfNumberOnly() # noqa: E501 + if include_optional: return ArrayOfNumberOnly( array_number = [ 1.337 ] ) - else : + else: return ArrayOfNumberOnly( ) + """ def testArrayOfNumberOnly(self): """Test ArrayOfNumberOnly""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py index 8327e415adcd..6858000a8b03 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_array_test.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.array_test import ArrayTest # noqa: E501 -from petstore_api.rest import ApiException class TestArrayTest(unittest.TestCase): """ArrayTest unit test stubs""" @@ -28,22 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ArrayTest: """Test ArrayTest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.array_test.ArrayTest() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ArrayTest` + """ + model = ArrayTest() # noqa: E501 + if include_optional: return ArrayTest( array_of_string = [ '' - ], + ], + array_of_nullable_float = [ + 1.337 + ], array_array_of_integer = [ [ 56 ] - ], + ], array_array_of_model = [ [ petstore_api.models.read_only_first.ReadOnlyFirst( @@ -52,14 +55,15 @@ def make_instance(self, include_optional): ] ] ) - else : + else: return ArrayTest( ) + """ def testArrayTest(self): """Test ArrayTest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py index 26e2a845a95c..42f62fa31115 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_basque_pig.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.basque_pig import BasquePig # noqa: E501 -from petstore_api.rest import ApiException class TestBasquePig(unittest.TestCase): """BasquePig unit test stubs""" @@ -28,27 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BasquePig: """Test BasquePig include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.basque_pig.BasquePig() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `BasquePig` + """ + model = BasquePig() # noqa: E501 + if include_optional: return BasquePig( - class_name = '', + class_name = '', color = '' ) - else : + else: return BasquePig( class_name = '', color = '', ) + """ def testBasquePig(self): """Test BasquePig""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py index c7a9721dbc00..17b75e51e363 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_capitalization.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.capitalization import Capitalization # noqa: E501 -from petstore_api.rest import ApiException class TestCapitalization(unittest.TestCase): """Capitalization unit test stubs""" @@ -28,29 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Capitalization: """Test Capitalization include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.capitalization.Capitalization() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Capitalization` + """ + model = Capitalization() # noqa: E501 + if include_optional: return Capitalization( - small_camel = '', - capital_camel = '', - small_snake = '', - capital_snake = '', - sca_eth_flow_points = '', + small_camel = '', + capital_camel = '', + small_snake = '', + capital_snake = '', + sca_eth_flow_points = '', att_name = '' ) - else : + else: return Capitalization( ) + """ def testCapitalization(self): """Test Capitalization""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py index e04566b1aafd..58e743f44c86 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_cat.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.cat import Cat # noqa: E501 -from petstore_api.rest import ApiException class TestCat(unittest.TestCase): """Cat unit test stubs""" @@ -28,6 +26,23 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional) -> Cat: + """Test Cat + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `Cat` + """ + model = Cat() # noqa: E501 + if include_optional: + return Cat( + declawed = True + ) + else: + return Cat( + ) + """ + def testCat(self): """Test Cat""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py index 14848fcebcd2..2a287246f81a 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_category.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.category import Category # noqa: E501 -from petstore_api.rest import ApiException class TestCategory(unittest.TestCase): """Category unit test stubs""" @@ -28,21 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Category: """Test Category include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.category.Category() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Category` + """ + model = Category() # noqa: E501 + if include_optional: return Category( - id = 56, + id = 56, name = 'default-name' ) - else : + else: return Category( name = 'default-name', ) + """ def testCategory(self): """Test Category""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_all_of_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_all_of_ref.py index f72aa632ba8f..aaa48641b37d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_all_of_ref.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_all_of_ref.py @@ -36,16 +36,10 @@ def make_instance(self, include_optional) -> CircularAllOfRef: model = CircularAllOfRef() # noqa: E501 if include_optional: return CircularAllOfRef( + name = '', second_circular_all_of_ref = [ - petstore_api.models.second_circular_all_of_ref.SecondCircularAllOfRef( - circular_all_of_ref = [ - petstore_api.models.circular_all_of_ref.CircularAllOfRef( - second_circular_all_of_ref = [ - petstore_api.models.second_circular_all_of_ref.SecondCircularAllOfRef() - ], ) - ], ) - ], - name = '' + petstore_api.models.second_circular_all_of_ref.SecondCircularAllOfRef() + ] ) else: return CircularAllOfRef( diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py index f734d3fc0ff6..f23f02000225 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_circular_reference_model.py @@ -3,23 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.circular_reference_model import CircularReferenceModel # noqa: E501 -from petstore_api.rest import ApiException class TestCircularReferenceModel(unittest.TestCase): """CircularReferenceModel unit test stubs""" @@ -30,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CircularReferenceModel: """Test CircularReferenceModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CircularReferenceModel` """ - model = petstore_api.models.circular_reference_model.CircularReferenceModel() # noqa: E501 - if include_optional : + model = CircularReferenceModel() # noqa: E501 + if include_optional: return CircularReferenceModel( - size = 56, + size = 56, nested = petstore_api.models.first_ref.FirstRef( category = '', self_ref = petstore_api.models.second_ref.SecondRef( @@ -50,7 +46,7 @@ def make_instance(self, include_optional): nested = petstore_api.models.first_ref.FirstRef( category = '', ), ), ), ) ) - else : + else: return CircularReferenceModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py index 511843f2dcfd..6b78a1941820 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_class_model.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.class_model import ClassModel # noqa: E501 -from petstore_api.rest import ApiException class TestClassModel(unittest.TestCase): """ClassModel unit test stubs""" @@ -28,24 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ClassModel: """Test ClassModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.class_model.ClassModel() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ClassModel` + """ + model = ClassModel() # noqa: E501 + if include_optional: return ClassModel( - _class = '' + var_class = '' ) - else : + else: return ClassModel( ) + """ def testClassModel(self): """Test ClassModel""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py index 9209bb2c3f03..9d109601e811 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_client.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.client import Client # noqa: E501 -from petstore_api.rest import ApiException class TestClient(unittest.TestCase): """Client unit test stubs""" @@ -28,24 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Client: """Test Client include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.client.Client() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Client` + """ + model = Client() # noqa: E501 + if include_optional: return Client( client = '' ) - else : + else: return Client( ) + """ def testClient(self): """Test Client""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py index 9a7aabfea253..21f53552b360 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_color.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.color import Color # noqa: E501 -from petstore_api.rest import ApiException class TestColor(unittest.TestCase): """Color unit test stubs""" @@ -28,18 +26,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Color: """Test Color include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Color` """ - model = petstore_api.models.color.Color() # noqa: E501 - if include_optional : + model = Color() # noqa: E501 + if include_optional: return Color( ) - else : + else: return Color( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py index 66b3e088cbbf..af6b9ef7b311 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.creature import Creature # noqa: E501 -from petstore_api.rest import ApiException class TestCreature(unittest.TestCase): """Creature unit test stubs""" @@ -28,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Creature: """Test Creature include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Creature` """ - model = petstore_api.models.creature.Creature() # noqa: E501 - if include_optional : + model = Creature() # noqa: E501 + if include_optional: return Creature( info = petstore_api.models.creature_info.CreatureInfo( - name = '', ), + name = '', ), type = '' ) - else : + else: return Creature( info = petstore_api.models.creature_info.CreatureInfo( name = '', ), diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py index 0a85d5ffe7b2..a95dfd3d922b 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_creature_info.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.creature_info import CreatureInfo # noqa: E501 -from petstore_api.rest import ApiException class TestCreatureInfo(unittest.TestCase): """CreatureInfo unit test stubs""" @@ -28,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CreatureInfo: """Test CreatureInfo include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CreatureInfo` """ - model = petstore_api.models.creature_info.CreatureInfo() # noqa: E501 - if include_optional : + model = CreatureInfo() # noqa: E501 + if include_optional: return CreatureInfo( name = '' ) - else : + else: return CreatureInfo( name = '', ) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py index 0d850ae94f41..bbd0ffcb5f01 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_danish_pig.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.danish_pig import DanishPig # noqa: E501 -from petstore_api.rest import ApiException class TestDanishPig(unittest.TestCase): """DanishPig unit test stubs""" @@ -28,27 +26,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DanishPig: """Test DanishPig include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.danish_pig.DanishPig() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `DanishPig` + """ + model = DanishPig() # noqa: E501 + if include_optional: return DanishPig( - class_name = '', + class_name = '', size = 56 ) - else : + else: return DanishPig( class_name = '', size = 56, ) + """ def testDanishPig(self): """Test DanishPig""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py index 50e7c57bd0bf..204864309763 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_default_api.py @@ -3,32 +3,30 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api from petstore_api.api.default_api import DefaultApi # noqa: E501 -from petstore_api.rest import ApiException class TestDefaultApi(unittest.TestCase): """DefaultApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.default_api.DefaultApi() # noqa: E501 + def setUp(self) -> None: + self.api = DefaultApi() - def tearDown(self): - pass + def tearDown(self) -> None: + self.api.api_client.close() - def test_foo_get(self): + def test_foo_get(self) -> None: """Test case for foo_get """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py index 50257271cd72..ba3a63c719de 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_deprecated_object.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.deprecated_object import DeprecatedObject # noqa: E501 -from petstore_api.rest import ApiException class TestDeprecatedObject(unittest.TestCase): """DeprecatedObject unit test stubs""" @@ -28,24 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeprecatedObject: """Test DeprecatedObject include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.deprecated_object.DeprecatedObject() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `DeprecatedObject` + """ + model = DeprecatedObject() # noqa: E501 + if include_optional: return DeprecatedObject( name = '' ) - else : + else: return DeprecatedObject( ) + """ def testDeprecatedObject(self): """Test DeprecatedObject""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py index af75161287e1..d8a51df906c0 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dog.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.dog import Dog # noqa: E501 -from petstore_api.rest import ApiException class TestDog(unittest.TestCase): """Dog unit test stubs""" @@ -28,6 +26,23 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional) -> Dog: + """Test Dog + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `Dog` + """ + model = Dog() # noqa: E501 + if include_optional: + return Dog( + breed = '' + ) + else: + return Dog( + ) + """ + def testDog(self): """Test Dog""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py index d6562c58bc2d..45459b666b16 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_dummy_model.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.dummy_model import DummyModel # noqa: E501 -from petstore_api.rest import ApiException class TestDummyModel(unittest.TestCase): """DummyModel unit test stubs""" @@ -28,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DummyModel: """Test DummyModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DummyModel` """ - model = petstore_api.models.dummy_model.DummyModel() # noqa: E501 - if include_optional : + model = DummyModel() # noqa: E501 + if include_optional: return DummyModel( - category = '', + category = '', self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( size = 56, nested = petstore_api.models.dummy_model.Dummy-Model( category = '', ), ) ) - else : + else: return DummyModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py index 52cc98601bc0..21e4cf531c4e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_arrays.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.enum_arrays import EnumArrays # noqa: E501 -from petstore_api.rest import ApiException class TestEnumArrays(unittest.TestCase): """EnumArrays unit test stubs""" @@ -28,22 +26,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> EnumArrays: """Test EnumArrays include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.enum_arrays.EnumArrays() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `EnumArrays` + """ + model = EnumArrays() # noqa: E501 + if include_optional: return EnumArrays( - just_symbol = '>=', + just_symbol = '>=', array_enum = [ 'fish' ] ) - else : + else: return EnumArrays( ) + """ def testEnumArrays(self): """Test EnumArrays""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py index 9d7a81272cd2..92822bcdd970 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_class.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.enum_class import EnumClass # noqa: E501 -from petstore_api.rest import ApiException class TestEnumClass(unittest.TestCase): """EnumClass unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py index 9dbe9eb44fb8..9cbeacbe344d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string1.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.enum_string1 import EnumString1 # noqa: E501 -from petstore_api.rest import ApiException class TestEnumString1(unittest.TestCase): """EnumString1 unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py index 4ec0ffcd86c7..409c7f257a58 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_string2.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.enum_string2 import EnumString2 # noqa: E501 -from petstore_api.rest import ApiException class TestEnumString2(unittest.TestCase): """EnumString2 unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py index afb342ae9341..a9f432cf9ce8 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_enum_test.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.enum_test import EnumTest # noqa: E501 -from petstore_api.rest import ApiException class TestEnumTest(unittest.TestCase): """EnumTest unit test stubs""" @@ -28,27 +26,35 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> EnumTest: """Test EnumTest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.enum_test.EnumTest() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `EnumTest` + """ + model = EnumTest() # noqa: E501 + if include_optional: return EnumTest( - enum_string = 'UPPER', - enum_string_required = 'UPPER', - enum_integer = 1, - enum_number = 1.1, - outer_enum = 'placed', - outer_enum_integer = 2, - outer_enum_default_value = 'placed', - outer_enum_integer_default_value = 0 + enum_string = 'UPPER', + enum_string_required = 'UPPER', + enum_integer_default = 1, + enum_integer = 1, + enum_number = 1.1, + enum_number_vendor_ext = 42, + enum_string_vendor_ext = 'FOO', + enum_string_single_member = 'abc', + enum_integer_single_member = 100, + outer_enum = 'placed', + outer_enum_integer = 2, + outer_enum_default_value = 'placed', + outer_enum_integer_default_value = -1 ) - else : + else: return EnumTest( enum_string_required = 'UPPER', ) + """ def testEnumTest(self): """Test EnumTest""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py index cf074093f90d..dfe53c4b9e31 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_api.py @@ -3,144 +3,277 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -try: - from unittest.mock import patch -except ImportError: - from mock import patch -import petstore_api from petstore_api.api.fake_api import FakeApi # noqa: E501 class TestFakeApi(unittest.TestCase): """FakeApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.fake_api.FakeApi() # noqa: E501 + def setUp(self) -> None: + self.api = FakeApi() + + def tearDown(self) -> None: + self.api.api_client.close() + + def test_fake_any_type_request_body(self) -> None: + """Test case for fake_any_type_request_body - def tearDown(self): + test any type request body # noqa: E501 + """ pass - def test_fake_health_get(self): + def test_fake_enum_ref_query_parameter(self) -> None: + """Test case for fake_enum_ref_query_parameter + + test enum reference query parameter # noqa: E501 + """ + pass + + def test_fake_health_get(self) -> None: """Test case for fake_health_get Health check endpoint # noqa: E501 """ pass - def test_fake_http_signature_test(self): + def test_fake_http_signature_test(self) -> None: """Test case for fake_http_signature_test test http signature authentication # noqa: E501 """ pass - def test_fake_outer_boolean_serialize(self): + def test_fake_outer_boolean_serialize(self) -> None: """Test case for fake_outer_boolean_serialize """ pass - def test_fake_outer_composite_serialize(self): + def test_fake_outer_composite_serialize(self) -> None: """Test case for fake_outer_composite_serialize """ pass - def test_fake_outer_number_serialize(self): + def test_fake_outer_number_serialize(self) -> None: """Test case for fake_outer_number_serialize """ pass - def test_fake_outer_string_serialize(self): + def test_fake_outer_string_serialize(self) -> None: """Test case for fake_outer_string_serialize """ pass - def test_test_body_with_file_schema(self): + def test_fake_property_enum_integer_serialize(self) -> None: + """Test case for fake_property_enum_integer_serialize + + """ + pass + + def test_fake_ref_enum_string(self) -> None: + """Test case for fake_ref_enum_string + + test ref to enum string # noqa: E501 + """ + pass + + def test_fake_return_boolean(self) -> None: + """Test case for fake_return_boolean + + test returning boolean # noqa: E501 + """ + pass + + def test_fake_return_byte_like_json(self) -> None: + """Test case for fake_return_byte_like_json + + test byte like json # noqa: E501 + """ + pass + + def test_fake_return_enum(self) -> None: + """Test case for fake_return_enum + + test returning enum # noqa: E501 + """ + pass + + def test_fake_return_enum_like_json(self) -> None: + """Test case for fake_return_enum_like_json + + test enum like json # noqa: E501 + """ + pass + + def test_fake_return_float(self) -> None: + """Test case for fake_return_float + + test returning float # noqa: E501 + """ + pass + + def test_fake_return_int(self) -> None: + """Test case for fake_return_int + + test returning int # noqa: E501 + """ + pass + + def test_fake_return_list_of_objects(self) -> None: + """Test case for fake_return_list_of_objects + + test returning list of objects # noqa: E501 + """ + pass + + def test_fake_return_str_like_json(self) -> None: + """Test case for fake_return_str_like_json + + test str like json # noqa: E501 + """ + pass + + def test_fake_return_string(self) -> None: + """Test case for fake_return_string + + test returning string # noqa: E501 + """ + pass + + def test_fake_uuid_example(self) -> None: + """Test case for fake_uuid_example + + test uuid example # noqa: E501 + """ + pass + + def test_test_additional_properties_reference(self) -> None: + """Test case for test_additional_properties_reference + + test referenced additionalProperties # noqa: E501 + """ + pass + + def test_test_body_with_binary(self) -> None: + """Test case for test_body_with_binary + + """ + pass + + def test_test_body_with_file_schema(self) -> None: """Test case for test_body_with_file_schema """ pass - def test_test_body_with_query_params(self): + def test_test_body_with_query_params(self) -> None: """Test case for test_body_with_query_params """ pass - def test_test_client_model(self): + def test_test_client_model(self) -> None: """Test case for test_client_model To test \"client\" model # noqa: E501 """ pass - def test_test_endpoint_parameters(self): + def test_test_date_time_query_parameter(self) -> None: + """Test case for test_date_time_query_parameter + + """ + pass + + def test_test_empty_and_non_empty_responses(self) -> None: + """Test case for test_empty_and_non_empty_responses + + test empty and non-empty responses # noqa: E501 + """ + pass + + def test_test_endpoint_parameters(self) -> None: """Test case for test_endpoint_parameters Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 """ pass - def test_test_enum_parameters(self): - """Test case for test_enum_parameters + def test_test_error_responses_with_model(self) -> None: + """Test case for test_error_responses_with_model - To test enum parameters # noqa: E501 + test error responses with model # noqa: E501 """ pass - def test_test_group_parameters(self): + def test_test_group_parameters(self) -> None: """Test case for test_group_parameters Fake endpoint to test group parameters (optional) # noqa: E501 """ pass - def test_test_inline_additional_properties(self): + def test_test_inline_additional_properties(self) -> None: """Test case for test_inline_additional_properties test inline additionalProperties # noqa: E501 """ pass - def test_test_json_form_data(self): + def test_test_inline_freeform_additional_properties(self) -> None: + """Test case for test_inline_freeform_additional_properties + + test inline free-form additionalProperties # noqa: E501 + """ + pass + + def test_test_json_form_data(self) -> None: """Test case for test_json_form_data test json serialization of form data # noqa: E501 """ pass - def test_test_query_parameter_collection_format(self): + def test_test_object_for_multipart_requests(self) -> None: + """Test case for test_object_for_multipart_requests + + """ + pass + + def test_test_query_parameter_collection_format(self) -> None: """Test case for test_query_parameter_collection_format """ pass - def test_headers_parameter(self): - """Test case for the _headers are passed by the user + def test_test_string_map_reference(self) -> None: + """Test case for test_string_map_reference + + test referenced string map # noqa: E501 + """ + pass + + def test_upload_file_with_additional_properties(self) -> None: + """Test case for upload_file_with_additional_properties - To test any optional parameter # noqa: E501 + uploads a file and additional properties using multipart/form-data # noqa: E501 """ - api = petstore_api.api.PetApi() - with patch("petstore_api.api_client.ApiClient.call_api") as mock_method: - value_headers = {"Header1": "value1"} - api.find_pets_by_status(["available"], _headers=value_headers) - args, _ = mock_method.call_args - self.assertEqual(args, ('/pet/findByStatus', 'GET', {}, [('status', ['available'])], {'Accept': 'application/json', 'Header1': 'value1'}) -) + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py index 25088624aea3..54023ca230fd 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_fake_classname_tags123_api.py @@ -21,10 +21,10 @@ class TestFakeClassnameTags123Api(unittest.TestCase): """FakeClassnameTags123Api unit test stubs""" def setUp(self) -> None: - self.api = FakeClassnameTags123Api() # noqa: E501 + self.api = FakeClassnameTags123Api() def tearDown(self) -> None: - pass + self.api.api_client.close() def test_test_classname(self) -> None: """Test case for test_classname diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_field.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_field.py index c972d91444a5..cb5e8e25dd24 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_field.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_field.py @@ -36,7 +36,7 @@ def make_instance(self, include_optional) -> Field: model = Field() # noqa: E501 if include_optional: return Field( - dummy = '' + field = '' ) else: return Field( diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py index 3c9b91972d91..0896f1869db5 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.file import File # noqa: E501 -from petstore_api.rest import ApiException class TestFile(unittest.TestCase): """File unit test stubs""" @@ -28,24 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> File: """Test File include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.file.File() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `File` + """ + model = File() # noqa: E501 + if include_optional: return File( source_uri = '' ) - else : + else: return File( ) + """ def testFile(self): """Test File""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py index 2834ddc05413..72963bf91d52 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_file_schema_test_class.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.file_schema_test_class import FileSchemaTestClass # noqa: E501 -from petstore_api.rest import ApiException class TestFileSchemaTestClass(unittest.TestCase): """FileSchemaTestClass unit test stubs""" @@ -28,29 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FileSchemaTestClass: """Test FileSchemaTestClass include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.file_schema_test_class.FileSchemaTestClass() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `FileSchemaTestClass` + """ + model = FileSchemaTestClass() # noqa: E501 + if include_optional: return FileSchemaTestClass( file = petstore_api.models.file.File( - source_uri = '', ), + source_uri = '', ), files = [ petstore_api.models.file.File( source_uri = '', ) ] ) - else : + else: return FileSchemaTestClass( ) + """ def testFileSchemaTestClass(self): """Test FileSchemaTestClass""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py index bcec1c0334bf..a99fc7cfc796 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_first_ref.py @@ -3,23 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.first_ref import FirstRef # noqa: E501 -from petstore_api.rest import ApiException class TestFirstRef(unittest.TestCase): """FirstRef unit test stubs""" @@ -30,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FirstRef: """Test FirstRef include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FirstRef` """ - model = petstore_api.models.first_ref.FirstRef() # noqa: E501 - if include_optional : + model = FirstRef() # noqa: E501 + if include_optional: return FirstRef( - category = '', + category = '', self_ref = petstore_api.models.second_ref.SecondRef( category = '', circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( @@ -48,7 +44,7 @@ def make_instance(self, include_optional): nested = petstore_api.models.first_ref.FirstRef( category = '', ), ), ) ) - else : + else: return FirstRef( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py index f592b1c37018..f92679671c7a 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.foo import Foo # noqa: E501 -from petstore_api.rest import ApiException class TestFoo(unittest.TestCase): """Foo unit test stubs""" @@ -28,24 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Foo: """Test Foo include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.foo.Foo() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Foo` + """ + model = Foo() # noqa: E501 + if include_optional: return Foo( bar = 'bar' ) - else : + else: return Foo( ) + """ def testFoo(self): """Test Foo""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py index d2cadc258d8e..3a024f8e6c70 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_foo_get_default_response.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.foo_get_default_response import FooGetDefaultResponse # noqa: E501 -from petstore_api.rest import ApiException class TestFooGetDefaultResponse(unittest.TestCase): """FooGetDefaultResponse unit test stubs""" @@ -28,25 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FooGetDefaultResponse: """Test FooGetDefaultResponse include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.foo_get_default_response.FooGetDefaultResponse() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `FooGetDefaultResponse` + """ + model = FooGetDefaultResponse() # noqa: E501 + if include_optional: return FooGetDefaultResponse( string = petstore_api.models.foo.Foo( bar = 'bar', ) ) - else : + else: return FooGetDefaultResponse( ) + """ def testFooGetDefaultResponse(self): """Test FooGetDefaultResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py index 4d9f9bb87479..72c8965d4914 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_format_test.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.format_test import FormatTest # noqa: E501 -from petstore_api.rest import ApiException class TestFormatTest(unittest.TestCase): """FormatTest unit test stubs""" @@ -28,45 +26,46 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FormatTest: """Test FormatTest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.format_test.FormatTest() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `FormatTest` + """ + model = FormatTest() # noqa: E501 + if include_optional: return FormatTest( - integer = 10, - int32 = 20, - int64 = 56, - number = 132.1, - # TODO: pydantic v2: the "float" property aliases the "float" type in the pydantic v2 generator - # float = 54.3, - double = 67.8, - decimal = 1, - string = 'a', - byte = bytes("someting", 'utf-8'), - binary = bytes(b'blah'), - date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', - password = '0123456789', - pattern_with_digits = '0480728880', + integer = 10, + int32 = 20, + int64 = 56, + number = 32.1, + float = 54.3, + double = 67.8, + decimal = 1, + string = 'a', + string_with_double_quote_pattern = 'this is \"something\"', + byte = 'YQ==', + binary = bytes(b'blah'), + var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', + password = '0123456789', + pattern_with_digits = '0480728880', pattern_with_digits_and_delimiter = 'image_480' ) - else : + else: return FormatTest( - number = 122.1, - byte = bytes("someting", 'utf-8'), - date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + number = 32.1, + var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), password = '0123456789', ) + """ def testFormatTest(self): """Test FormatTest""" - inst_req_only = self.make_instance(include_optional=False) - # TODO - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py index 2a8d2df6a0f8..f106dda48d7e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_has_only_read_only.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.has_only_read_only import HasOnlyReadOnly # noqa: E501 -from petstore_api.rest import ApiException class TestHasOnlyReadOnly(unittest.TestCase): """HasOnlyReadOnly unit test stubs""" @@ -28,25 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> HasOnlyReadOnly: """Test HasOnlyReadOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.has_only_read_only.HasOnlyReadOnly() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `HasOnlyReadOnly` + """ + model = HasOnlyReadOnly() # noqa: E501 + if include_optional: return HasOnlyReadOnly( - bar = '', + bar = '', foo = '' ) - else : + else: return HasOnlyReadOnly( ) + """ def testHasOnlyReadOnly(self): """Test HasOnlyReadOnly""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py index 21c52053ea22..4f36cde5f8b5 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_health_check_result.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.health_check_result import HealthCheckResult # noqa: E501 -from petstore_api.rest import ApiException class TestHealthCheckResult(unittest.TestCase): """HealthCheckResult unit test stubs""" @@ -28,24 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> HealthCheckResult: """Test HealthCheckResult include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.health_check_result.HealthCheckResult() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `HealthCheckResult` + """ + model = HealthCheckResult() # noqa: E501 + if include_optional: return HealthCheckResult( nullable_message = '' ) - else : + else: return HealthCheckResult( ) + """ def testHealthCheckResult(self): """Test HealthCheckResult""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_import_test_datetime_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_import_test_datetime_api.py index 82e7781c0821..3cf93fb8c672 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_import_test_datetime_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_import_test_datetime_api.py @@ -21,10 +21,10 @@ class TestImportTestDatetimeApi(unittest.TestCase): """ImportTestDatetimeApi unit test stubs""" def setUp(self) -> None: - self.api = ImportTestDatetimeApi() # noqa: E501 + self.api = ImportTestDatetimeApi() def tearDown(self) -> None: - pass + self.api.api_client.close() def test_import_test_return_datetime(self) -> None: """Test case for import_test_return_datetime diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py index 8a63b70d5524..1ba15fd984da 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_inner_dict_with_property.py @@ -3,23 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.inner_dict_with_property import InnerDictWithProperty # noqa: E501 -from petstore_api.rest import ApiException class TestInnerDictWithProperty(unittest.TestCase): """InnerDictWithProperty unit test stubs""" @@ -30,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InnerDictWithProperty: """Test InnerDictWithProperty include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InnerDictWithProperty` """ - model = petstore_api.models.inner_dict_with_property.InnerDictWithProperty() # noqa: E501 - if include_optional : + model = InnerDictWithProperty() # noqa: E501 + if include_optional: return InnerDictWithProperty( a_property = None ) - else : + else: return InnerDictWithProperty( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py index 0de76602cb69..41bf80d02cb5 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_int_or_string.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.int_or_string import IntOrString # noqa: E501 -from petstore_api.rest import ApiException class TestIntOrString(unittest.TestCase): """IntOrString unit test stubs""" @@ -28,18 +26,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IntOrString: """Test IntOrString include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IntOrString` """ - model = petstore_api.models.int_or_string.IntOrString() # noqa: E501 - if include_optional : + model = IntOrString() # noqa: E501 + if include_optional: return IntOrString( ) - else : + else: return IntOrString( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py index 31ad486f5c03..2f88aa7935ad 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_of_array_of_model.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel # noqa: E501 -from petstore_api.rest import ApiException class TestMapOfArrayOfModel(unittest.TestCase): """MapOfArrayOfModel unit test stubs""" @@ -28,15 +26,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MapOfArrayOfModel: """Test MapOfArrayOfModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MapOfArrayOfModel` """ - model = petstore_api.models.map_of_array_of_model.MapOfArrayOfModel() # noqa: E501 - if include_optional : + model = MapOfArrayOfModel() # noqa: E501 + if include_optional: return MapOfArrayOfModel( shop_id_to_org_online_lip_map = { 'key' : [ @@ -46,7 +44,7 @@ def make_instance(self, include_optional): ] } ) - else : + else: return MapOfArrayOfModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py index 5e11fed312ad..8aedbfa8f665 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_map_test.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.map_test import MapTest # noqa: E501 -from petstore_api.rest import ApiException class TestMapTest(unittest.TestCase): """MapTest unit test stubs""" @@ -28,38 +26,40 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MapTest: """Test MapTest include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.map_test.MapTest() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `MapTest` + """ + model = MapTest() # noqa: E501 + if include_optional: return MapTest( map_map_of_string = { 'key' : { 'key' : '' } - }, + }, map_of_enum_string = { 'UPPER' : 'UPPER' - }, + }, direct_map = { 'key' : True - }, + }, indirect_map = { 'key' : True } ) - else : + else: return MapTest( ) + """ def testMapTest(self): """Test MapTest""" - # TODO - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py index d217b1143656..12a96998a561 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_mixed_properties_and_additional_properties_class.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass # noqa: E501 -from petstore_api.rest import ApiException class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): """MixedPropertiesAndAdditionalPropertiesClass unit test stubs""" @@ -28,30 +26,33 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MixedPropertiesAndAdditionalPropertiesClass: """Test MixedPropertiesAndAdditionalPropertiesClass include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `MixedPropertiesAndAdditionalPropertiesClass` + """ + model = MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 + if include_optional: return MixedPropertiesAndAdditionalPropertiesClass( - uuid = '', - date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + uuid = '', + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), map = { 'key' : petstore_api.models.animal.Animal( class_name = '', color = 'red', ) } ) - else : + else: return MixedPropertiesAndAdditionalPropertiesClass( ) + """ def testMixedPropertiesAndAdditionalPropertiesClass(self): """Test MixedPropertiesAndAdditionalPropertiesClass""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py index f7e9677e0074..f5e65f1aca4e 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model200_response.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.model200_response import Model200Response # noqa: E501 -from petstore_api.rest import ApiException class TestModel200Response(unittest.TestCase): """Model200Response unit test stubs""" @@ -28,25 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Model200Response: """Test Model200Response include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.model200_response.Model200Response() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Model200Response` + """ + model = Model200Response() # noqa: E501 + if include_optional: return Model200Response( - name = 56, - _class = '' + name = 56, + var_class = '' ) - else : + else: return Model200Response( ) + """ def testModel200Response(self): """Test Model200Response""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py index b0f9d9c4f7f9..e011892fb0b3 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_model_return.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.model_return import ModelReturn # noqa: E501 -from petstore_api.rest import ApiException class TestModelReturn(unittest.TestCase): """ModelReturn unit test stubs""" @@ -28,24 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ModelReturn: """Test ModelReturn include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.model_return.ModelReturn() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ModelReturn` + """ + model = ModelReturn() # noqa: E501 + if include_optional: return ModelReturn( - _return = 56 + var_return = 56 ) - else : + else: return ModelReturn( ) + """ def testModelReturn(self): """Test ModelReturn""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py index bbf11fd231ea..be7ddc8461d1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_name.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.name import Name # noqa: E501 -from petstore_api.rest import ApiException class TestName(unittest.TestCase): """Name unit test stubs""" @@ -28,28 +26,31 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Name: """Test Name include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.name.Name() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Name` + """ + model = Name() # noqa: E501 + if include_optional: return Name( - name = 56, - snake_case = 56, - _property = '', - _123_number = 56 + name = 56, + snake_case = 56, + var_property = '', + var_123_number = 56 ) - else : + else: return Name( name = 56, ) + """ def testName(self): """Test Name""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py index 7aa59f46bbd8..b1170db23c4d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_class.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.nullable_class import NullableClass # noqa: E501 -from petstore_api.rest import ApiException class TestNullableClass(unittest.TestCase): """NullableClass unit test stubs""" @@ -28,50 +26,52 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NullableClass: """Test NullableClass include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.nullable_class.NullableClass() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `NullableClass` + """ + model = NullableClass() # noqa: E501 + if include_optional: return NullableClass( required_integer_prop = 56, - integer_prop = 56, - number_prop = 1.337, - boolean_prop = True, - string_prop = '', - date_prop = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - datetime_prop = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + integer_prop = 56, + number_prop = 1.337, + boolean_prop = True, + string_prop = '', + date_prop = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + datetime_prop = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), array_nullable_prop = [ None - ], + ], array_and_items_nullable_prop = [ None - ], + ], array_items_nullable = [ None - ], + ], object_nullable_prop = { 'key' : None - }, + }, object_and_items_nullable_prop = { 'key' : None - }, + }, object_items_nullable = { 'key' : None } ) - else : + else: return NullableClass( - required_integer_prop = 56 + required_integer_prop = 56, ) + """ def testNullableClass(self): """Test NullableClass""" - # TODO - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py index 34129457b1d7..aa34b84e7973 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_nullable_property.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.nullable_property import NullableProperty # noqa: E501 -from petstore_api.rest import ApiException class TestNullableProperty(unittest.TestCase): """NullableProperty unit test stubs""" @@ -28,20 +26,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NullableProperty: """Test NullableProperty include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `NullableProperty` """ - model = petstore_api.models.nullable_property.NullableProperty() # noqa: E501 - if include_optional : + model = NullableProperty() # noqa: E501 + if include_optional: return NullableProperty( - id = 56, + id = 56, name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>' ) - else : + else: return NullableProperty( id = 56, name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>', diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py index 776946c3d774..cfc8c5c778c4 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_number_only.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.number_only import NumberOnly # noqa: E501 -from petstore_api.rest import ApiException class TestNumberOnly(unittest.TestCase): """NumberOnly unit test stubs""" @@ -28,24 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NumberOnly: """Test NumberOnly include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.number_only.NumberOnly() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `NumberOnly` + """ + model = NumberOnly() # noqa: E501 + if include_optional: return NumberOnly( just_number = 1.337 ) - else : + else: return NumberOnly( ) + """ def testNumberOnly(self): """Test NumberOnly""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py index f1f354cad251..d080b21afb32 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_to_test_additional_properties.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties # noqa: E501 -from petstore_api.rest import ApiException class TestObjectToTestAdditionalProperties(unittest.TestCase): """ObjectToTestAdditionalProperties unit test stubs""" @@ -28,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ObjectToTestAdditionalProperties: """Test ObjectToTestAdditionalProperties include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ObjectToTestAdditionalProperties` """ - model = petstore_api.models.object_to_test_additional_properties.ObjectToTestAdditionalProperties() # noqa: E501 - if include_optional : + model = ObjectToTestAdditionalProperties() # noqa: E501 + if include_optional: return ObjectToTestAdditionalProperties( var_property = True ) - else : + else: return ObjectToTestAdditionalProperties( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py index e0cbf3e98a51..5f04c63a3cb3 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_object_with_deprecated_fields.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields # noqa: E501 -from petstore_api.rest import ApiException class TestObjectWithDeprecatedFields(unittest.TestCase): """ObjectWithDeprecatedFields unit test stubs""" @@ -28,30 +26,33 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ObjectWithDeprecatedFields: """Test ObjectWithDeprecatedFields include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.object_with_deprecated_fields.ObjectWithDeprecatedFields() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ObjectWithDeprecatedFields` + """ + model = ObjectWithDeprecatedFields() # noqa: E501 + if include_optional: return ObjectWithDeprecatedFields( - uuid = '', - id = 1.337, + uuid = '', + id = 1.337, deprecated_ref = petstore_api.models.deprecated_object.DeprecatedObject( - name = '', ), + name = '', ), bars = [ 'bar' ] ) - else : + else: return ObjectWithDeprecatedFields( ) + """ def testObjectWithDeprecatedFields(self): """Test ObjectWithDeprecatedFields""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py index ed959c1479c2..3db614a16caf 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_one_of_enum_string.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.one_of_enum_string import OneOfEnumString # noqa: E501 -from petstore_api.rest import ApiException class TestOneOfEnumString(unittest.TestCase): """OneOfEnumString unit test stubs""" @@ -28,18 +26,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OneOfEnumString: """Test OneOfEnumString include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `OneOfEnumString` """ - model = petstore_api.models.one_of_enum_string.OneOfEnumString() # noqa: E501 - if include_optional : + model = OneOfEnumString() # noqa: E501 + if include_optional: return OneOfEnumString( ) - else : + else: return OneOfEnumString( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py index d6ec36f83a0d..3334ed8f949a 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_order.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.order import Order # noqa: E501 -from petstore_api.rest import ApiException class TestOrder(unittest.TestCase): """Order unit test stubs""" @@ -28,29 +26,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Order: """Test Order include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.order.Order() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Order` + """ + model = Order() # noqa: E501 + if include_optional: return Order( - id = 56, - pet_id = 56, - quantity = 56, - ship_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - status = 'placed', + id = 56, + pet_id = 56, + quantity = 56, + ship_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + status = 'placed', complete = True ) - else : + else: return Order( ) + """ def testOrder(self): """Test Order""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py index c6fd58849377..7df32d8c6725 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_composite.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.outer_composite import OuterComposite # noqa: E501 -from petstore_api.rest import ApiException class TestOuterComposite(unittest.TestCase): """OuterComposite unit test stubs""" @@ -28,26 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OuterComposite: """Test OuterComposite include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.outer_composite.OuterComposite() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `OuterComposite` + """ + model = OuterComposite() # noqa: E501 + if include_optional: return OuterComposite( - my_number = 1.337, - my_string = '', + my_number = 1.337, + my_string = '', my_boolean = True ) - else : + else: return OuterComposite( ) + """ def testOuterComposite(self): """Test OuterComposite""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py index aa195260019e..5da04a9a45c0 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.outer_enum import OuterEnum # noqa: E501 -from petstore_api.rest import ApiException class TestOuterEnum(unittest.TestCase): """OuterEnum unit test stubs""" @@ -30,7 +28,7 @@ def tearDown(self): def testOuterEnum(self): """Test OuterEnum""" - inst = OuterEnum("placed") + # inst = OuterEnum() if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py index f8fba3bd79ad..df6499565fdb 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_default_value.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue # noqa: E501 -from petstore_api.rest import ApiException class TestOuterEnumDefaultValue(unittest.TestCase): """OuterEnumDefaultValue unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py index ce1e47c61b14..7b89b806ba24 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.outer_enum_integer import OuterEnumInteger # noqa: E501 -from petstore_api.rest import ApiException class TestOuterEnumInteger(unittest.TestCase): """OuterEnumInteger unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py index f0b707fca778..532616fdee1f 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_enum_integer_default_value.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue # noqa: E501 -from petstore_api.rest import ApiException class TestOuterEnumIntegerDefaultValue(unittest.TestCase): """OuterEnumIntegerDefaultValue unit test stubs""" @@ -28,23 +26,9 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): - """Test OuterEnumIntegerDefaultValue - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = petstore_api.models.outer_enum_integer_default_value.OuterEnumIntegerDefaultValue() # noqa: E501 - if include_optional : - return OuterEnumIntegerDefaultValue( - ) - else : - return OuterEnumIntegerDefaultValue( - ) - def testOuterEnumIntegerDefaultValue(self): """Test OuterEnumIntegerDefaultValue""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst = OuterEnumIntegerDefaultValue() if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py index 35258d5d74ac..27e518b00593 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_outer_object_with_enum_property.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty # noqa: E501 -from petstore_api.rest import ApiException class TestOuterObjectWithEnumProperty(unittest.TestCase): """OuterObjectWithEnumProperty unit test stubs""" @@ -28,20 +26,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OuterObjectWithEnumProperty: """Test OuterObjectWithEnumProperty include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.outer_object_with_enum_property.OuterObjectWithEnumProperty() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `OuterObjectWithEnumProperty` + """ + model = OuterObjectWithEnumProperty() # noqa: E501 + if include_optional: return OuterObjectWithEnumProperty( + str_value = 'placed', value = 2 ) - else : + else: return OuterObjectWithEnumProperty( value = 2, ) + """ def testOuterObjectWithEnumProperty(self): """Test OuterObjectWithEnumProperty""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py index 2a74505f08a1..ea206970c9cf 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.parent import Parent # noqa: E501 -from petstore_api.rest import ApiException class TestParent(unittest.TestCase): """Parent unit test stubs""" @@ -28,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Parent: """Test Parent include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Parent` """ - model = petstore_api.models.parent.Parent() # noqa: E501 - if include_optional : + model = Parent() # noqa: E501 + if include_optional: return Parent( optional_dict = { 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( a_property = petstore_api.models.a_property.aProperty(), ) } ) - else : + else: return Parent( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py index 25b769e3d390..2c668a7047a8 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_parent_with_optional_dict.py @@ -3,23 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict # noqa: E501 -from petstore_api.rest import ApiException class TestParentWithOptionalDict(unittest.TestCase): """ParentWithOptionalDict unit test stubs""" @@ -30,22 +26,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ParentWithOptionalDict: """Test ParentWithOptionalDict include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ParentWithOptionalDict` """ - model = petstore_api.models.parent_with_optional_dict.ParentWithOptionalDict() # noqa: E501 - if include_optional : + model = ParentWithOptionalDict() # noqa: E501 + if include_optional: return ParentWithOptionalDict( optional_dict = { 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( a_property = petstore_api.models.a_property.aProperty(), ) } ) - else : + else: return ParentWithOptionalDict( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py index 6d3fd2f35b04..f89e6cdf4b40 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.pet import Pet # noqa: E501 -from petstore_api.rest import ApiException class TestPet(unittest.TestCase): """Pet unit test stubs""" @@ -28,41 +26,44 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Pet: """Test Pet include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.pet.Pet() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Pet` + """ + model = Pet() # noqa: E501 + if include_optional: return Pet( - id = 56, + id = 56, category = petstore_api.models.category.Category( id = 56, - name = 'default-name', ), - name = 'doggie', + name = 'default-name', ), + name = 'doggie', photo_urls = [ '' - ], + ], tags = [ petstore_api.models.tag.Tag( id = 56, name = '', ) - ], + ], status = 'available' ) - else : + else: return Pet( name = 'doggie', photo_urls = [ '' ], ) + """ def testPet(self): """Test Pet""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py index 77665df879f1..e65100ff31ff 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pet_api.py @@ -3,88 +3,86 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api from petstore_api.api.pet_api import PetApi # noqa: E501 -from petstore_api.rest import ApiException class TestPetApi(unittest.TestCase): """PetApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.pet_api.PetApi() # noqa: E501 + def setUp(self) -> None: + self.api = PetApi() - def tearDown(self): - pass + def tearDown(self) -> None: + self.api.api_client.close() - def test_add_pet(self): + def test_add_pet(self) -> None: """Test case for add_pet Add a new pet to the store # noqa: E501 """ pass - def test_delete_pet(self): + def test_delete_pet(self) -> None: """Test case for delete_pet Deletes a pet # noqa: E501 """ pass - def test_find_pets_by_status(self): + def test_find_pets_by_status(self) -> None: """Test case for find_pets_by_status Finds Pets by status # noqa: E501 """ pass - def test_find_pets_by_tags(self): + def test_find_pets_by_tags(self) -> None: """Test case for find_pets_by_tags Finds Pets by tags # noqa: E501 """ pass - def test_get_pet_by_id(self): + def test_get_pet_by_id(self) -> None: """Test case for get_pet_by_id Find pet by ID # noqa: E501 """ pass - def test_update_pet(self): + def test_update_pet(self) -> None: """Test case for update_pet Update an existing pet # noqa: E501 """ pass - def test_update_pet_with_form(self): + def test_update_pet_with_form(self) -> None: """Test case for update_pet_with_form Updates a pet in the store with form data # noqa: E501 """ pass - def test_upload_file(self): + def test_upload_file(self) -> None: """Test case for upload_file uploads an image # noqa: E501 """ pass - def test_upload_file_with_required_file(self): + def test_upload_file_with_required_file(self) -> None: """Test case for upload_file_with_required_file uploads an image (required) # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py index 95e99f35a738..cd3f112aabc5 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pig.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.pig import Pig # noqa: E501 -from petstore_api.rest import ApiException class TestPig(unittest.TestCase): """Pig unit test stubs""" @@ -28,6 +26,28 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional) -> Pig: + """Test Pig + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `Pig` + """ + model = Pig() # noqa: E501 + if include_optional: + return Pig( + class_name = '', + color = '', + size = 56 + ) + else: + return Pig( + class_name = '', + color = '', + size = 56, + ) + """ + def testPig(self): """Test Pig""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py index 04ab956f191d..a869945b3204 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_property_name_collision.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.property_name_collision import PropertyNameCollision # noqa: E501 -from petstore_api.rest import ApiException class TestPropertyNameCollision(unittest.TestCase): """PropertyNameCollision unit test stubs""" @@ -28,21 +26,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PropertyNameCollision: """Test PropertyNameCollision include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PropertyNameCollision` """ - model = petstore_api.models.property_name_collision.PropertyNameCollision() # noqa: E501 - if include_optional : + model = PropertyNameCollision() # noqa: E501 + if include_optional: return PropertyNameCollision( - underscoreType = '', - type = '', - typeWithUnderscore = '' + underscore_type = '', + type = '', + type_with_underscore = '' ) - else : + else: return PropertyNameCollision( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py index 310e4b1aebbe..1026a73205d4 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_read_only_first.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.read_only_first import ReadOnlyFirst # noqa: E501 -from petstore_api.rest import ApiException class TestReadOnlyFirst(unittest.TestCase): """ReadOnlyFirst unit test stubs""" @@ -28,25 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ReadOnlyFirst: """Test ReadOnlyFirst include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.read_only_first.ReadOnlyFirst() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ReadOnlyFirst` + """ + model = ReadOnlyFirst() # noqa: E501 + if include_optional: return ReadOnlyFirst( - bar = '', + bar = '', baz = '' ) - else : + else: return ReadOnlyFirst( ) + """ def testReadOnlyFirst(self): """Test ReadOnlyFirst""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_circular_all_of_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_circular_all_of_ref.py index 3b9a26f72d82..c1ef0d1b7db1 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_circular_all_of_ref.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_circular_all_of_ref.py @@ -36,13 +36,10 @@ def make_instance(self, include_optional) -> SecondCircularAllOfRef: model = SecondCircularAllOfRef() # noqa: E501 if include_optional: return SecondCircularAllOfRef( + name = '', circular_all_of_ref = [ - petstore_api.models.circular_all_of_ref.CircularAllOfRef( - second_circular_all_of_ref = [ - petstore_api.models.second_circular_all_of_ref.SecondCircularAllOfRef() - ], ) - ], - name = '' + petstore_api.models.circular_all_of_ref.CircularAllOfRef() + ] ) else: return SecondCircularAllOfRef( diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py index 782892fd4e17..44194f94544f 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_second_ref.py @@ -3,23 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.second_ref import SecondRef # noqa: E501 -from petstore_api.rest import ApiException class TestSecondRef(unittest.TestCase): """SecondRef unit test stubs""" @@ -30,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SecondRef: """Test SecondRef include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SecondRef` """ - model = petstore_api.models.second_ref.SecondRef() # noqa: E501 - if include_optional : + model = SecondRef() # noqa: E501 + if include_optional: return SecondRef( - category = '', + category = '', circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( size = 56, nested = petstore_api.models.first_ref.FirstRef( @@ -48,7 +44,7 @@ def make_instance(self, include_optional): self_ref = petstore_api.models.second_ref.SecondRef( category = '', ), ), ) ) - else : + else: return SecondRef( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py index b3dd7ada2b2a..8c23008b26ed 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_self_reference_model.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.self_reference_model import SelfReferenceModel # noqa: E501 -from petstore_api.rest import ApiException class TestSelfReferenceModel(unittest.TestCase): """SelfReferenceModel unit test stubs""" @@ -28,17 +26,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SelfReferenceModel: """Test SelfReferenceModel include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SelfReferenceModel` """ - model = petstore_api.models.self_reference_model.SelfReferenceModel() # noqa: E501 - if include_optional : + model = SelfReferenceModel() # noqa: E501 + if include_optional: return SelfReferenceModel( - size = 56, + size = 56, nested = petstore_api.models.dummy_model.Dummy-Model( category = '', self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( @@ -46,7 +44,7 @@ def make_instance(self, include_optional): nested = petstore_api.models.dummy_model.Dummy-Model( category = '', ), ), ) ) - else : + else: return SelfReferenceModel( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py index 888a1a7b6da3..f5642b8376b0 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_single_ref_type.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.single_ref_type import SingleRefType # noqa: E501 -from petstore_api.rest import ApiException class TestSingleRefType(unittest.TestCase): """SingleRefType unit test stubs""" @@ -28,23 +26,9 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): - """Test SingleRefType - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = petstore_api.models.single_ref_type.SingleRefType() # noqa: E501 - if include_optional : - return SingleRefType( - ) - else : - return SingleRefType( - ) - def testSingleRefType(self): """Test SingleRefType""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst = SingleRefType() if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py index 028f55599e49..ee5baab13095 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_character_enum.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.special_character_enum import SpecialCharacterEnum # noqa: E501 -from petstore_api.rest import ApiException class TestSpecialCharacterEnum(unittest.TestCase): """SpecialCharacterEnum unit test stubs""" diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py index eb487cd42fc1..12ec90a9067f 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_model_name.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.special_model_name import SpecialModelName # noqa: E501 -from petstore_api.rest import ApiException class TestSpecialModelName(unittest.TestCase): """SpecialModelName unit test stubs""" @@ -28,24 +26,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpecialModelName: """Test SpecialModelName include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.special_model_name.SpecialModelName() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `SpecialModelName` + """ + model = SpecialModelName() # noqa: E501 + if include_optional: return SpecialModelName( special_property_name = 56 ) - else : + else: return SpecialModelName( ) + """ def testSpecialModelName(self): """Test SpecialModelName""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py index 1f4287871a8e..afaf0996b74c 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_special_name.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.special_name import SpecialName # noqa: E501 -from petstore_api.rest import ApiException class TestSpecialName(unittest.TestCase): """SpecialName unit test stubs""" @@ -28,23 +26,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpecialName: """Test SpecialName include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpecialName` """ - model = petstore_api.models.special_name.SpecialName() # noqa: E501 - if include_optional : + model = SpecialName() # noqa: E501 + if include_optional: return SpecialName( - var_property = 56, + var_property = 56, var_async = petstore_api.models.category.Category( id = 56, - name = 'default-name', ), - status = 'available' + name = 'default-name', ), + var_schema = 'available' ) - else : + else: return SpecialName( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py index 81848d24a67e..eaf61a726d99 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_store_api.py @@ -3,53 +3,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: \" \\ # noqa: E501 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api from petstore_api.api.store_api import StoreApi # noqa: E501 -from petstore_api.rest import ApiException class TestStoreApi(unittest.TestCase): """StoreApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.store_api.StoreApi() # noqa: E501 + def setUp(self) -> None: + self.api = StoreApi() - def tearDown(self): - pass + def tearDown(self) -> None: + self.api.api_client.close() - def test_delete_order(self): + def test_delete_order(self) -> None: """Test case for delete_order Delete purchase order by ID # noqa: E501 """ pass - def test_get_inventory(self): + def test_get_inventory(self) -> None: """Test case for get_inventory Returns pet inventories by status # noqa: E501 """ pass - def test_get_order_by_id(self): + def test_get_order_by_id(self) -> None: """Test case for get_order_by_id Find purchase order by ID # noqa: E501 """ pass - def test_place_order(self): + def test_place_order(self) -> None: """Test case for place_order Place an order for a pet # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py index 9680300032f1..d5ce3fb8a0cf 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tag.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.tag import Tag # noqa: E501 -from petstore_api.rest import ApiException class TestTag(unittest.TestCase): """Tag unit test stubs""" @@ -28,25 +26,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Tag: """Test Tag include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.tag.Tag() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Tag` + """ + model = Tag() # noqa: E501 + if include_optional: return Tag( - id = 56, + id = 56, name = '' ) - else : + else: return Tag( ) + """ def testTag(self): """Test Tag""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py index 83c91cea1a0d..7aab61a46066 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_tiger.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest import datetime -import petstore_api from petstore_api.models.tiger import Tiger # noqa: E501 -from petstore_api.rest import ApiException class TestTiger(unittest.TestCase): """Tiger unit test stubs""" @@ -28,19 +26,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Tiger: """Test Tiger include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Tiger` """ - model = petstore_api.models.tiger.Tiger() # noqa: E501 - if include_optional : + model = Tiger() # noqa: E501 + if include_optional: return Tiger( skill = '' ) - else : + else: return Tiger( ) """ diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py index 174c8e06be5d..a1ce46e87a19 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.user import User # noqa: E501 -from petstore_api.rest import ApiException class TestUser(unittest.TestCase): """User unit test stubs""" @@ -28,31 +26,34 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> User: """Test User include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.user.User() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `User` + """ + model = User() # noqa: E501 + if include_optional: return User( - id = 56, - username = '', - first_name = '', - last_name = '', - email = '', - password = '', - phone = '', + id = 56, + username = '', + first_name = '', + last_name = '', + email = '', + password = '', + phone = '', user_status = 56 ) - else : + else: return User( ) + """ def testUser(self): """Test User""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py index 6df730fba2b1..a7067583c748 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_user_api.py @@ -3,81 +3,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: \" \\ # noqa: E501 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api from petstore_api.api.user_api import UserApi # noqa: E501 -from petstore_api.rest import ApiException class TestUserApi(unittest.TestCase): """UserApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.user_api.UserApi() # noqa: E501 + def setUp(self) -> None: + self.api = UserApi() - def tearDown(self): - pass + def tearDown(self) -> None: + self.api.api_client.close() - def test_create_user(self): + def test_create_user(self) -> None: """Test case for create_user Create user # noqa: E501 """ pass - def test_create_users_with_array_input(self): + def test_create_users_with_array_input(self) -> None: """Test case for create_users_with_array_input Creates list of users with given input array # noqa: E501 """ pass - def test_create_users_with_list_input(self): + def test_create_users_with_list_input(self) -> None: """Test case for create_users_with_list_input Creates list of users with given input array # noqa: E501 """ pass - def test_delete_user(self): + def test_delete_user(self) -> None: """Test case for delete_user Delete user # noqa: E501 """ pass - def test_get_user_by_name(self): + def test_get_user_by_name(self) -> None: """Test case for get_user_by_name Get user by user name # noqa: E501 """ pass - def test_login_user(self): + def test_login_user(self) -> None: """Test case for login_user Logs user into the system # noqa: E501 """ pass - def test_logout_user(self): + def test_logout_user(self) -> None: """Test case for logout_user Logs out current logged in user session # noqa: E501 """ pass - def test_update_user(self): + def test_update_user(self) -> None: """Test case for update_user Updated user # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py index 994004dd7ab7..43c4a69a29bb 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_with_nested_one_of.py @@ -3,21 +3,19 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest import datetime -import petstore_api from petstore_api.models.with_nested_one_of import WithNestedOneOf # noqa: E501 -from petstore_api.rest import ApiException class TestWithNestedOneOf(unittest.TestCase): """WithNestedOneOf unit test stubs""" @@ -28,25 +26,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> WithNestedOneOf: """Test WithNestedOneOf include_option is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.with_nested_one_of.WithNestedOneOf() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `WithNestedOneOf` + """ + model = WithNestedOneOf() # noqa: E501 + if include_optional: return WithNestedOneOf( - size = 56, - nested_pig = None + size = 56, + nested_pig = None, + nested_oneof_enum_string = None ) - else : + else: return WithNestedOneOf( ) + """ def testWithNestedOneOf(self): """Test WithNestedOneOf""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/petstore_api/exceptions.py b/samples/openapi3/client/petstore/python/petstore_api/exceptions.py index 0cb484becbdb..195e150623d2 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/exceptions.py +++ b/samples/openapi3/client/petstore/python/petstore_api/exceptions.py @@ -150,6 +150,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -188,6 +195,16 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/samples/openapi3/client/petstore/python/test/test_additional_properties_any_type.py b/samples/openapi3/client/petstore/python/test/test_additional_properties_any_type.py index c2c9c7c58069..48603ddb4033 100644 --- a/samples/openapi3/client/petstore/python/test/test_additional_properties_any_type.py +++ b/samples/openapi3/client/petstore/python/test/test_additional_properties_any_type.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.additional_properties_any_type import AdditionalPropertiesAnyType class TestAdditionalPropertiesAnyType(unittest.TestCase): """AdditionalPropertiesAnyType unit test stubs""" @@ -28,19 +25,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AdditionalPropertiesAnyType: """Test AdditionalPropertiesAnyType - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesAnyType` """ - model = petstore_api.models.additional_properties_any_type.AdditionalPropertiesAnyType() # noqa: E501 - if include_optional : + model = AdditionalPropertiesAnyType() + if include_optional: return AdditionalPropertiesAnyType( name = '' ) - else : + else: return AdditionalPropertiesAnyType( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_additional_properties_class.py b/samples/openapi3/client/petstore/python/test/test_additional_properties_class.py index e3b48bedd571..0261c8f4a004 100644 --- a/samples/openapi3/client/petstore/python/test/test_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python/test/test_additional_properties_class.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.additional_properties_class import AdditionalPropertiesClass # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.additional_properties_class import AdditionalPropertiesClass class TestAdditionalPropertiesClass(unittest.TestCase): """AdditionalPropertiesClass unit test stubs""" @@ -28,26 +25,26 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AdditionalPropertiesClass: """Test AdditionalPropertiesClass - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesClass` """ - model = petstore_api.models.additional_properties_class.AdditionalPropertiesClass() # noqa: E501 - if include_optional : + model = AdditionalPropertiesClass() + if include_optional: return AdditionalPropertiesClass( map_property = { 'key' : '' - }, + }, map_of_map_property = { 'key' : { 'key' : '' } } ) - else : + else: return AdditionalPropertiesClass( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_additional_properties_object.py b/samples/openapi3/client/petstore/python/test/test_additional_properties_object.py index b68a8fda5790..8b0dccef5647 100644 --- a/samples/openapi3/client/petstore/python/test/test_additional_properties_object.py +++ b/samples/openapi3/client/petstore/python/test/test_additional_properties_object.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.additional_properties_object import AdditionalPropertiesObject # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.additional_properties_object import AdditionalPropertiesObject class TestAdditionalPropertiesObject(unittest.TestCase): """AdditionalPropertiesObject unit test stubs""" @@ -28,19 +25,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AdditionalPropertiesObject: """Test AdditionalPropertiesObject - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesObject` """ - model = petstore_api.models.additional_properties_object.AdditionalPropertiesObject() # noqa: E501 - if include_optional : + model = AdditionalPropertiesObject() + if include_optional: return AdditionalPropertiesObject( name = '' ) - else : + else: return AdditionalPropertiesObject( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python/test/test_additional_properties_with_description_only.py index d5166dfe1342..698f5f8d8994 100644 --- a/samples/openapi3/client/petstore/python/test/test_additional_properties_with_description_only.py +++ b/samples/openapi3/client/petstore/python/test/test_additional_properties_with_description_only.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.additional_properties_with_description_only import AdditionalPropertiesWithDescriptionOnly class TestAdditionalPropertiesWithDescriptionOnly(unittest.TestCase): """AdditionalPropertiesWithDescriptionOnly unit test stubs""" @@ -28,19 +25,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AdditionalPropertiesWithDescriptionOnly: """Test AdditionalPropertiesWithDescriptionOnly - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AdditionalPropertiesWithDescriptionOnly` """ - model = petstore_api.models.additional_properties_with_description_only.AdditionalPropertiesWithDescriptionOnly() # noqa: E501 - if include_optional : + model = AdditionalPropertiesWithDescriptionOnly() + if include_optional: return AdditionalPropertiesWithDescriptionOnly( name = '' ) - else : + else: return AdditionalPropertiesWithDescriptionOnly( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_all_of_super_model.py b/samples/openapi3/client/petstore/python/test/test_all_of_super_model.py index dfc6d444ba7a..0b37180a54c1 100644 --- a/samples/openapi3/client/petstore/python/test/test_all_of_super_model.py +++ b/samples/openapi3/client/petstore/python/test/test_all_of_super_model.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> AllOfSuperModel: """Test AllOfSuperModel - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AllOfSuperModel` diff --git a/samples/openapi3/client/petstore/python/test/test_all_of_with_single_ref.py b/samples/openapi3/client/petstore/python/test/test_all_of_with_single_ref.py index ee761ef82d0a..ff147a1bc4e5 100644 --- a/samples/openapi3/client/petstore/python/test/test_all_of_with_single_ref.py +++ b/samples/openapi3/client/petstore/python/test/test_all_of_with_single_ref.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.all_of_with_single_ref import AllOfWithSingleRef class TestAllOfWithSingleRef(unittest.TestCase): """AllOfWithSingleRef unit test stubs""" @@ -28,25 +25,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AllOfWithSingleRef: """Test AllOfWithSingleRef - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.all_of_with_single_ref.AllOfWithSingleRef() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `AllOfWithSingleRef` + """ + model = AllOfWithSingleRef() + if include_optional: return AllOfWithSingleRef( - username = '', - single_ref_type = None + username = '', + single_ref_type = 'admin' ) - else : + else: return AllOfWithSingleRef( ) + """ def testAllOfWithSingleRef(self): """Test AllOfWithSingleRef""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_animal.py b/samples/openapi3/client/petstore/python/test/test_animal.py index 75d9ddf51887..4ea318679b61 100644 --- a/samples/openapi3/client/petstore/python/test/test_animal.py +++ b/samples/openapi3/client/petstore/python/test/test_animal.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.animal import Animal # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.animal import Animal class TestAnimal(unittest.TestCase): """Animal unit test stubs""" @@ -28,26 +25,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Animal: """Test Animal - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.animal.Animal() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Animal` + """ + model = Animal() + if include_optional: return Animal( - className = '', + class_name = '', color = 'red' ) - else : + else: return Animal( - className = '', + class_name = '', ) + """ def testAnimal(self): """Test Animal""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_another_fake_api.py b/samples/openapi3/client/petstore/python/test/test_another_fake_api.py index d95798cfc5a4..d1b73d979ffc 100644 --- a/samples/openapi3/client/petstore/python/test/test_another_fake_api.py +++ b/samples/openapi3/client/petstore/python/test/test_another_fake_api.py @@ -3,35 +3,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: \" \\ # noqa: E501 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api -from petstore_api.api.another_fake_api import AnotherFakeApi # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.api.another_fake_api import AnotherFakeApi class TestAnotherFakeApi(unittest.TestCase): """AnotherFakeApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.another_fake_api.AnotherFakeApi() # noqa: E501 + def setUp(self) -> None: + self.api = AnotherFakeApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_call_123_test_special_tags(self): + def test_call_123_test_special_tags(self) -> None: """Test case for call_123_test_special_tags - To test special tags # noqa: E501 + To test special tags """ pass diff --git a/samples/openapi3/client/petstore/python/test/test_any_of_color.py b/samples/openapi3/client/petstore/python/test/test_any_of_color.py index 2a97cfef7526..f6092af623a7 100644 --- a/samples/openapi3/client/petstore/python/test/test_any_of_color.py +++ b/samples/openapi3/client/petstore/python/test/test_any_of_color.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.any_of_color import AnyOfColor # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.any_of_color import AnyOfColor class TestAnyOfColor(unittest.TestCase): """AnyOfColor unit test stubs""" @@ -28,18 +25,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> AnyOfColor: """Test AnyOfColor - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `AnyOfColor` """ - model = petstore_api.models.any_of_color.AnyOfColor() # noqa: E501 - if include_optional : + model = AnyOfColor() + if include_optional: return AnyOfColor( ) - else : + else: return AnyOfColor( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_any_of_pig.py b/samples/openapi3/client/petstore/python/test/test_any_of_pig.py index f041e5f9d6f7..e69d8f25900a 100644 --- a/samples/openapi3/client/petstore/python/test/test_any_of_pig.py +++ b/samples/openapi3/client/petstore/python/test/test_any_of_pig.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.any_of_pig import AnyOfPig # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.any_of_pig import AnyOfPig class TestAnyOfPig(unittest.TestCase): """AnyOfPig unit test stubs""" @@ -28,6 +25,28 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional) -> AnyOfPig: + """Test AnyOfPig + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `AnyOfPig` + """ + model = AnyOfPig() + if include_optional: + return AnyOfPig( + class_name = '', + color = '', + size = 56 + ) + else: + return AnyOfPig( + class_name = '', + color = '', + size = 56, + ) + """ + def testAnyOfPig(self): """Test AnyOfPig""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python/test/test_array_of_array_of_model.py b/samples/openapi3/client/petstore/python/test/test_array_of_array_of_model.py index 1072a19255de..a96ea540171c 100644 --- a/samples/openapi3/client/petstore/python/test/test_array_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python/test/test_array_of_array_of_model.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel class TestArrayOfArrayOfModel(unittest.TestCase): """ArrayOfArrayOfModel unit test stubs""" @@ -28,17 +25,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ArrayOfArrayOfModel: """Test ArrayOfArrayOfModel - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ArrayOfArrayOfModel` """ - model = petstore_api.models.array_of_array_of_model.ArrayOfArrayOfModel() # noqa: E501 - if include_optional : + model = ArrayOfArrayOfModel() + if include_optional: return ArrayOfArrayOfModel( - shop_id_to_org_online_lip_map = [ + another_property = [ [ petstore_api.models.tag.Tag( id = 56, @@ -46,7 +43,7 @@ def make_instance(self, include_optional): ] ] ) - else : + else: return ArrayOfArrayOfModel( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python/test/test_array_of_array_of_number_only.py index 001b4e565737..bd89ba2188dd 100644 --- a/samples/openapi3/client/petstore/python/test/test_array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python/test/test_array_of_array_of_number_only.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly class TestArrayOfArrayOfNumberOnly(unittest.TestCase): """ArrayOfArrayOfNumberOnly unit test stubs""" @@ -28,13 +25,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ArrayOfArrayOfNumberOnly: """Test ArrayOfArrayOfNumberOnly - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.array_of_array_of_number_only.ArrayOfArrayOfNumberOnly() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ArrayOfArrayOfNumberOnly` + """ + model = ArrayOfArrayOfNumberOnly() + if include_optional: return ArrayOfArrayOfNumberOnly( array_array_number = [ [ @@ -42,14 +41,15 @@ def make_instance(self, include_optional): ] ] ) - else : + else: return ArrayOfArrayOfNumberOnly( ) + """ def testArrayOfArrayOfNumberOnly(self): """Test ArrayOfArrayOfNumberOnly""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_array_of_number_only.py b/samples/openapi3/client/petstore/python/test/test_array_of_number_only.py index a35703ae0dac..f67af039fcef 100644 --- a/samples/openapi3/client/petstore/python/test/test_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python/test/test_array_of_number_only.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.array_of_number_only import ArrayOfNumberOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.array_of_number_only import ArrayOfNumberOnly class TestArrayOfNumberOnly(unittest.TestCase): """ArrayOfNumberOnly unit test stubs""" @@ -28,26 +25,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ArrayOfNumberOnly: """Test ArrayOfNumberOnly - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.array_of_number_only.ArrayOfNumberOnly() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ArrayOfNumberOnly` + """ + model = ArrayOfNumberOnly() + if include_optional: return ArrayOfNumberOnly( array_number = [ 1.337 ] ) - else : + else: return ArrayOfNumberOnly( ) + """ def testArrayOfNumberOnly(self): """Test ArrayOfNumberOnly""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_array_test.py b/samples/openapi3/client/petstore/python/test/test_array_test.py index 8327e415adcd..21ce90c4c2ca 100644 --- a/samples/openapi3/client/petstore/python/test/test_array_test.py +++ b/samples/openapi3/client/petstore/python/test/test_array_test.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.array_test import ArrayTest # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.array_test import ArrayTest class TestArrayTest(unittest.TestCase): """ArrayTest unit test stubs""" @@ -28,22 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ArrayTest: """Test ArrayTest - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.array_test.ArrayTest() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ArrayTest` + """ + model = ArrayTest() + if include_optional: return ArrayTest( array_of_string = [ '' - ], + ], + array_of_nullable_float = [ + 1.337 + ], array_array_of_integer = [ [ 56 ] - ], + ], array_array_of_model = [ [ petstore_api.models.read_only_first.ReadOnlyFirst( @@ -52,14 +54,15 @@ def make_instance(self, include_optional): ] ] ) - else : + else: return ArrayTest( ) + """ def testArrayTest(self): """Test ArrayTest""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_base_discriminator.py b/samples/openapi3/client/petstore/python/test/test_base_discriminator.py index 61c40f7f6809..05ed4b3d4da3 100644 --- a/samples/openapi3/client/petstore/python/test/test_base_discriminator.py +++ b/samples/openapi3/client/petstore/python/test/test_base_discriminator.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> BaseDiscriminator: """Test BaseDiscriminator - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `BaseDiscriminator` diff --git a/samples/openapi3/client/petstore/python/test/test_basque_pig.py b/samples/openapi3/client/petstore/python/test/test_basque_pig.py index 26e2a845a95c..f79d16cd8585 100644 --- a/samples/openapi3/client/petstore/python/test/test_basque_pig.py +++ b/samples/openapi3/client/petstore/python/test/test_basque_pig.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.basque_pig import BasquePig # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.basque_pig import BasquePig class TestBasquePig(unittest.TestCase): """BasquePig unit test stubs""" @@ -28,27 +25,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> BasquePig: """Test BasquePig - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.basque_pig.BasquePig() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `BasquePig` + """ + model = BasquePig() + if include_optional: return BasquePig( - class_name = '', + class_name = '', color = '' ) - else : + else: return BasquePig( class_name = '', color = '', ) + """ def testBasquePig(self): """Test BasquePig""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_bathing.py b/samples/openapi3/client/petstore/python/test/test_bathing.py index 583bdcbb09ec..f2b6a75a95a4 100644 --- a/samples/openapi3/client/petstore/python/test/test_bathing.py +++ b/samples/openapi3/client/petstore/python/test/test_bathing.py @@ -13,7 +13,6 @@ import unittest -import datetime from petstore_api.models.bathing import Bathing @@ -28,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> Bathing: """Test Bathing - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Bathing` diff --git a/samples/openapi3/client/petstore/python/test/test_capitalization.py b/samples/openapi3/client/petstore/python/test/test_capitalization.py index c7a9721dbc00..6e8f95b7acfd 100644 --- a/samples/openapi3/client/petstore/python/test/test_capitalization.py +++ b/samples/openapi3/client/petstore/python/test/test_capitalization.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.capitalization import Capitalization # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.capitalization import Capitalization class TestCapitalization(unittest.TestCase): """Capitalization unit test stubs""" @@ -28,29 +25,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Capitalization: """Test Capitalization - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.capitalization.Capitalization() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Capitalization` + """ + model = Capitalization() + if include_optional: return Capitalization( - small_camel = '', - capital_camel = '', - small_snake = '', - capital_snake = '', - sca_eth_flow_points = '', + small_camel = '', + capital_camel = '', + small_snake = '', + capital_snake = '', + sca_eth_flow_points = '', att_name = '' ) - else : + else: return Capitalization( ) + """ def testCapitalization(self): """Test Capitalization""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_cat.py b/samples/openapi3/client/petstore/python/test/test_cat.py index e04566b1aafd..15034d82ed3b 100644 --- a/samples/openapi3/client/petstore/python/test/test_cat.py +++ b/samples/openapi3/client/petstore/python/test/test_cat.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.cat import Cat # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.cat import Cat class TestCat(unittest.TestCase): """Cat unit test stubs""" @@ -28,6 +25,23 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional) -> Cat: + """Test Cat + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `Cat` + """ + model = Cat() + if include_optional: + return Cat( + declawed = True + ) + else: + return Cat( + ) + """ + def testCat(self): """Test Cat""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python/test/test_category.py b/samples/openapi3/client/petstore/python/test/test_category.py index 14848fcebcd2..014917bf17f4 100644 --- a/samples/openapi3/client/petstore/python/test/test_category.py +++ b/samples/openapi3/client/petstore/python/test/test_category.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.category import Category # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.category import Category class TestCategory(unittest.TestCase): """Category unit test stubs""" @@ -28,21 +25,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Category: """Test Category - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.category.Category() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Category` + """ + model = Category() + if include_optional: return Category( - id = 56, + id = 56, name = 'default-name' ) - else : + else: return Category( name = 'default-name', ) + """ def testCategory(self): """Test Category""" diff --git a/samples/openapi3/client/petstore/python/test/test_circular_all_of_ref.py b/samples/openapi3/client/petstore/python/test/test_circular_all_of_ref.py index 767c758a733b..9d81ff91b15a 100644 --- a/samples/openapi3/client/petstore/python/test/test_circular_all_of_ref.py +++ b/samples/openapi3/client/petstore/python/test/test_circular_all_of_ref.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> CircularAllOfRef: """Test CircularAllOfRef - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CircularAllOfRef` @@ -35,16 +35,10 @@ def make_instance(self, include_optional) -> CircularAllOfRef: model = CircularAllOfRef() if include_optional: return CircularAllOfRef( + name = '', second_circular_all_of_ref = [ - petstore_api.models.second_circular_all_of_ref.SecondCircularAllOfRef( - circular_all_of_ref = [ - petstore_api.models.circular_all_of_ref.CircularAllOfRef( - second_circular_all_of_ref = [ - petstore_api.models.second_circular_all_of_ref.SecondCircularAllOfRef() - ], ) - ], ) - ], - name = '' + petstore_api.models.second_circular_all_of_ref.SecondCircularAllOfRef() + ] ) else: return CircularAllOfRef( diff --git a/samples/openapi3/client/petstore/python/test/test_circular_reference_model.py b/samples/openapi3/client/petstore/python/test/test_circular_reference_model.py index f734d3fc0ff6..18148b2b7d1a 100644 --- a/samples/openapi3/client/petstore/python/test/test_circular_reference_model.py +++ b/samples/openapi3/client/petstore/python/test/test_circular_reference_model.py @@ -3,23 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.circular_reference_model import CircularReferenceModel # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.circular_reference_model import CircularReferenceModel class TestCircularReferenceModel(unittest.TestCase): """CircularReferenceModel unit test stubs""" @@ -30,17 +25,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CircularReferenceModel: """Test CircularReferenceModel - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CircularReferenceModel` """ - model = petstore_api.models.circular_reference_model.CircularReferenceModel() # noqa: E501 - if include_optional : + model = CircularReferenceModel() + if include_optional: return CircularReferenceModel( - size = 56, + size = 56, nested = petstore_api.models.first_ref.FirstRef( category = '', self_ref = petstore_api.models.second_ref.SecondRef( @@ -50,7 +45,7 @@ def make_instance(self, include_optional): nested = petstore_api.models.first_ref.FirstRef( category = '', ), ), ), ) ) - else : + else: return CircularReferenceModel( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_class_model.py b/samples/openapi3/client/petstore/python/test/test_class_model.py index 511843f2dcfd..1826cbf53983 100644 --- a/samples/openapi3/client/petstore/python/test/test_class_model.py +++ b/samples/openapi3/client/petstore/python/test/test_class_model.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.class_model import ClassModel # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.class_model import ClassModel class TestClassModel(unittest.TestCase): """ClassModel unit test stubs""" @@ -28,24 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ClassModel: """Test ClassModel - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.class_model.ClassModel() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ClassModel` + """ + model = ClassModel() + if include_optional: return ClassModel( - _class = '' + var_class = '' ) - else : + else: return ClassModel( ) + """ def testClassModel(self): """Test ClassModel""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_client.py b/samples/openapi3/client/petstore/python/test/test_client.py index 9209bb2c3f03..1586543c171c 100644 --- a/samples/openapi3/client/petstore/python/test/test_client.py +++ b/samples/openapi3/client/petstore/python/test/test_client.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.client import Client # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.client import Client class TestClient(unittest.TestCase): """Client unit test stubs""" @@ -28,24 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Client: """Test Client - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.client.Client() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Client` + """ + model = Client() + if include_optional: return Client( client = '' ) - else : + else: return Client( ) + """ def testClient(self): """Test Client""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_color.py b/samples/openapi3/client/petstore/python/test/test_color.py index 9a7aabfea253..2ebb0ec04dee 100644 --- a/samples/openapi3/client/petstore/python/test/test_color.py +++ b/samples/openapi3/client/petstore/python/test/test_color.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.color import Color # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.color import Color class TestColor(unittest.TestCase): """Color unit test stubs""" @@ -28,18 +25,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Color: """Test Color - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Color` """ - model = petstore_api.models.color.Color() # noqa: E501 - if include_optional : + model = Color() + if include_optional: return Color( ) - else : + else: return Color( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_creature.py b/samples/openapi3/client/petstore/python/test/test_creature.py index 66b3e088cbbf..eab8f68f3a57 100644 --- a/samples/openapi3/client/petstore/python/test/test_creature.py +++ b/samples/openapi3/client/petstore/python/test/test_creature.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.creature import Creature # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.creature import Creature class TestCreature(unittest.TestCase): """Creature unit test stubs""" @@ -28,21 +25,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Creature: """Test Creature - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Creature` """ - model = petstore_api.models.creature.Creature() # noqa: E501 - if include_optional : + model = Creature() + if include_optional: return Creature( info = petstore_api.models.creature_info.CreatureInfo( - name = '', ), + name = '', ), type = '' ) - else : + else: return Creature( info = petstore_api.models.creature_info.CreatureInfo( name = '', ), diff --git a/samples/openapi3/client/petstore/python/test/test_creature_info.py b/samples/openapi3/client/petstore/python/test/test_creature_info.py index 0a85d5ffe7b2..d645563a4791 100644 --- a/samples/openapi3/client/petstore/python/test/test_creature_info.py +++ b/samples/openapi3/client/petstore/python/test/test_creature_info.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.creature_info import CreatureInfo # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.creature_info import CreatureInfo class TestCreatureInfo(unittest.TestCase): """CreatureInfo unit test stubs""" @@ -28,19 +25,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> CreatureInfo: """Test CreatureInfo - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `CreatureInfo` """ - model = petstore_api.models.creature_info.CreatureInfo() # noqa: E501 - if include_optional : + model = CreatureInfo() + if include_optional: return CreatureInfo( name = '' ) - else : + else: return CreatureInfo( name = '', ) diff --git a/samples/openapi3/client/petstore/python/test/test_danish_pig.py b/samples/openapi3/client/petstore/python/test/test_danish_pig.py index 0d850ae94f41..1dc992542c41 100644 --- a/samples/openapi3/client/petstore/python/test/test_danish_pig.py +++ b/samples/openapi3/client/petstore/python/test/test_danish_pig.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.danish_pig import DanishPig # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.danish_pig import DanishPig class TestDanishPig(unittest.TestCase): """DanishPig unit test stubs""" @@ -28,27 +25,30 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DanishPig: """Test DanishPig - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.danish_pig.DanishPig() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `DanishPig` + """ + model = DanishPig() + if include_optional: return DanishPig( - class_name = '', + class_name = '', size = 56 ) - else : + else: return DanishPig( class_name = '', size = 56, ) + """ def testDanishPig(self): """Test DanishPig""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_default_api.py b/samples/openapi3/client/petstore/python/test/test_default_api.py index 50e7c57bd0bf..eb421a8edc1b 100644 --- a/samples/openapi3/client/petstore/python/test/test_default_api.py +++ b/samples/openapi3/client/petstore/python/test/test_default_api.py @@ -3,32 +3,30 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api -from petstore_api.api.default_api import DefaultApi # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.api.default_api import DefaultApi class TestDefaultApi(unittest.TestCase): """DefaultApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.default_api.DefaultApi() # noqa: E501 + def setUp(self) -> None: + self.api = DefaultApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_foo_get(self): + def test_foo_get(self) -> None: """Test case for foo_get """ diff --git a/samples/openapi3/client/petstore/python/test/test_deprecated_object.py b/samples/openapi3/client/petstore/python/test/test_deprecated_object.py index 50257271cd72..e63842997ae6 100644 --- a/samples/openapi3/client/petstore/python/test/test_deprecated_object.py +++ b/samples/openapi3/client/petstore/python/test/test_deprecated_object.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.deprecated_object import DeprecatedObject # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.deprecated_object import DeprecatedObject class TestDeprecatedObject(unittest.TestCase): """DeprecatedObject unit test stubs""" @@ -28,24 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DeprecatedObject: """Test DeprecatedObject - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.deprecated_object.DeprecatedObject() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `DeprecatedObject` + """ + model = DeprecatedObject() + if include_optional: return DeprecatedObject( name = '' ) - else : + else: return DeprecatedObject( ) + """ def testDeprecatedObject(self): """Test DeprecatedObject""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_discriminator_all_of_sub.py b/samples/openapi3/client/petstore/python/test/test_discriminator_all_of_sub.py index 15941f4f854a..f52f3d33f13c 100644 --- a/samples/openapi3/client/petstore/python/test/test_discriminator_all_of_sub.py +++ b/samples/openapi3/client/petstore/python/test/test_discriminator_all_of_sub.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> DiscriminatorAllOfSub: """Test DiscriminatorAllOfSub - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DiscriminatorAllOfSub` diff --git a/samples/openapi3/client/petstore/python/test/test_discriminator_all_of_super.py b/samples/openapi3/client/petstore/python/test/test_discriminator_all_of_super.py index 503d6b3c558c..830fa0a829a1 100644 --- a/samples/openapi3/client/petstore/python/test/test_discriminator_all_of_super.py +++ b/samples/openapi3/client/petstore/python/test/test_discriminator_all_of_super.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> DiscriminatorAllOfSuper: """Test DiscriminatorAllOfSuper - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DiscriminatorAllOfSuper` diff --git a/samples/openapi3/client/petstore/python/test/test_dog.py b/samples/openapi3/client/petstore/python/test/test_dog.py index af75161287e1..c11f61c99c04 100644 --- a/samples/openapi3/client/petstore/python/test/test_dog.py +++ b/samples/openapi3/client/petstore/python/test/test_dog.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.dog import Dog # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.dog import Dog class TestDog(unittest.TestCase): """Dog unit test stubs""" @@ -28,6 +25,23 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional) -> Dog: + """Test Dog + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `Dog` + """ + model = Dog() + if include_optional: + return Dog( + breed = '' + ) + else: + return Dog( + ) + """ + def testDog(self): """Test Dog""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python/test/test_dummy_model.py b/samples/openapi3/client/petstore/python/test/test_dummy_model.py index d6562c58bc2d..8b276ec140b0 100644 --- a/samples/openapi3/client/petstore/python/test/test_dummy_model.py +++ b/samples/openapi3/client/petstore/python/test/test_dummy_model.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.dummy_model import DummyModel # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.dummy_model import DummyModel class TestDummyModel(unittest.TestCase): """DummyModel unit test stubs""" @@ -28,23 +25,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> DummyModel: """Test DummyModel - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `DummyModel` """ - model = petstore_api.models.dummy_model.DummyModel() # noqa: E501 - if include_optional : + model = DummyModel() + if include_optional: return DummyModel( - category = '', + category = '', self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( size = 56, nested = petstore_api.models.dummy_model.Dummy-Model( category = '', ), ) ) - else : + else: return DummyModel( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_enum_arrays.py b/samples/openapi3/client/petstore/python/test/test_enum_arrays.py index 52cc98601bc0..f3d731b3f59c 100644 --- a/samples/openapi3/client/petstore/python/test/test_enum_arrays.py +++ b/samples/openapi3/client/petstore/python/test/test_enum_arrays.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.enum_arrays import EnumArrays # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.enum_arrays import EnumArrays class TestEnumArrays(unittest.TestCase): """EnumArrays unit test stubs""" @@ -28,22 +25,25 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> EnumArrays: """Test EnumArrays - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.enum_arrays.EnumArrays() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `EnumArrays` + """ + model = EnumArrays() + if include_optional: return EnumArrays( - just_symbol = '>=', + just_symbol = '>=', array_enum = [ 'fish' ] ) - else : + else: return EnumArrays( ) + """ def testEnumArrays(self): """Test EnumArrays""" diff --git a/samples/openapi3/client/petstore/python/test/test_enum_class.py b/samples/openapi3/client/petstore/python/test/test_enum_class.py index 9d7a81272cd2..5730ded0ad30 100644 --- a/samples/openapi3/client/petstore/python/test/test_enum_class.py +++ b/samples/openapi3/client/petstore/python/test/test_enum_class.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.enum_class import EnumClass # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.enum_class import EnumClass class TestEnumClass(unittest.TestCase): """EnumClass unit test stubs""" diff --git a/samples/openapi3/client/petstore/python/test/test_enum_serialization.py b/samples/openapi3/client/petstore/python/test/test_enum_serialization.py deleted file mode 100644 index aca0106b36b9..000000000000 --- a/samples/openapi3/client/petstore/python/test/test_enum_serialization.py +++ /dev/null @@ -1,33 +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: \" \\ - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import unittest - -from petstore_api.models.enum_serialization import EnumSerialization - -class TestEnumSerialization(unittest.TestCase): - """EnumSerialization unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def testEnumSerialization(self): - """Test EnumSerialization""" - # inst = EnumSerialization() - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_enum_string1.py b/samples/openapi3/client/petstore/python/test/test_enum_string1.py index 9dbe9eb44fb8..e6a858841203 100644 --- a/samples/openapi3/client/petstore/python/test/test_enum_string1.py +++ b/samples/openapi3/client/petstore/python/test/test_enum_string1.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.enum_string1 import EnumString1 # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.enum_string1 import EnumString1 class TestEnumString1(unittest.TestCase): """EnumString1 unit test stubs""" diff --git a/samples/openapi3/client/petstore/python/test/test_enum_string2.py b/samples/openapi3/client/petstore/python/test/test_enum_string2.py index 4ec0ffcd86c7..6a52c081d3ca 100644 --- a/samples/openapi3/client/petstore/python/test/test_enum_string2.py +++ b/samples/openapi3/client/petstore/python/test/test_enum_string2.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.enum_string2 import EnumString2 # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.enum_string2 import EnumString2 class TestEnumString2(unittest.TestCase): """EnumString2 unit test stubs""" diff --git a/samples/openapi3/client/petstore/python/test/test_enum_test.py b/samples/openapi3/client/petstore/python/test/test_enum_test.py index afb342ae9341..5f2f59e6c62b 100644 --- a/samples/openapi3/client/petstore/python/test/test_enum_test.py +++ b/samples/openapi3/client/petstore/python/test/test_enum_test.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.enum_test import EnumTest # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.enum_test import EnumTest class TestEnumTest(unittest.TestCase): """EnumTest unit test stubs""" @@ -28,27 +25,35 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> EnumTest: """Test EnumTest - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.enum_test.EnumTest() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `EnumTest` + """ + model = EnumTest() + if include_optional: return EnumTest( - enum_string = 'UPPER', - enum_string_required = 'UPPER', - enum_integer = 1, - enum_number = 1.1, - outer_enum = 'placed', - outer_enum_integer = 2, - outer_enum_default_value = 'placed', - outer_enum_integer_default_value = 0 + enum_string = 'UPPER', + enum_string_required = 'UPPER', + enum_integer_default = 1, + enum_integer = 1, + enum_number = 1.1, + enum_number_vendor_ext = 42, + enum_string_vendor_ext = 'FOO', + enum_string_single_member = 'abc', + enum_integer_single_member = 100, + outer_enum = 'placed', + outer_enum_integer = 2, + outer_enum_default_value = 'placed', + outer_enum_integer_default_value = -1 ) - else : + else: return EnumTest( enum_string_required = 'UPPER', ) + """ def testEnumTest(self): """Test EnumTest""" diff --git a/samples/openapi3/client/petstore/python/test/test_fake_api.py b/samples/openapi3/client/petstore/python/test/test_fake_api.py index 9a7dfbb96439..11920b00480e 100644 --- a/samples/openapi3/client/petstore/python/test/test_fake_api.py +++ b/samples/openapi3/client/petstore/python/test/test_fake_api.py @@ -3,145 +3,277 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -try: - from unittest.mock import patch -except ImportError: - from mock import patch -import petstore_api -from petstore_api.api.fake_api import FakeApi # noqa: E501 +from petstore_api.api.fake_api import FakeApi class TestFakeApi(unittest.TestCase): """FakeApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.fake_api.FakeApi() # noqa: E501 + def setUp(self) -> None: + self.api = FakeApi() + + def tearDown(self) -> None: + pass + + def test_fake_any_type_request_body(self) -> None: + """Test case for fake_any_type_request_body - def tearDown(self): + test any type request body + """ pass - def test_fake_health_get(self): + def test_fake_enum_ref_query_parameter(self) -> None: + """Test case for fake_enum_ref_query_parameter + + test enum reference query parameter + """ + pass + + def test_fake_health_get(self) -> None: """Test case for fake_health_get - Health check endpoint # noqa: E501 + Health check endpoint """ pass - def test_fake_http_signature_test(self): + def test_fake_http_signature_test(self) -> None: """Test case for fake_http_signature_test - test http signature authentication # noqa: E501 + test http signature authentication """ pass - def test_fake_outer_boolean_serialize(self): + def test_fake_outer_boolean_serialize(self) -> None: """Test case for fake_outer_boolean_serialize """ pass - def test_fake_outer_composite_serialize(self): + def test_fake_outer_composite_serialize(self) -> None: """Test case for fake_outer_composite_serialize """ pass - def test_fake_outer_number_serialize(self): + def test_fake_outer_number_serialize(self) -> None: """Test case for fake_outer_number_serialize """ pass - def test_fake_outer_string_serialize(self): + def test_fake_outer_string_serialize(self) -> None: """Test case for fake_outer_string_serialize """ pass - def test_test_body_with_file_schema(self): + def test_fake_property_enum_integer_serialize(self) -> None: + """Test case for fake_property_enum_integer_serialize + + """ + pass + + def test_fake_ref_enum_string(self) -> None: + """Test case for fake_ref_enum_string + + test ref to enum string + """ + pass + + def test_fake_return_boolean(self) -> None: + """Test case for fake_return_boolean + + test returning boolean + """ + pass + + def test_fake_return_byte_like_json(self) -> None: + """Test case for fake_return_byte_like_json + + test byte like json + """ + pass + + def test_fake_return_enum(self) -> None: + """Test case for fake_return_enum + + test returning enum + """ + pass + + def test_fake_return_enum_like_json(self) -> None: + """Test case for fake_return_enum_like_json + + test enum like json + """ + pass + + def test_fake_return_float(self) -> None: + """Test case for fake_return_float + + test returning float + """ + pass + + def test_fake_return_int(self) -> None: + """Test case for fake_return_int + + test returning int + """ + pass + + def test_fake_return_list_of_objects(self) -> None: + """Test case for fake_return_list_of_objects + + test returning list of objects + """ + pass + + def test_fake_return_str_like_json(self) -> None: + """Test case for fake_return_str_like_json + + test str like json + """ + pass + + def test_fake_return_string(self) -> None: + """Test case for fake_return_string + + test returning string + """ + pass + + def test_fake_uuid_example(self) -> None: + """Test case for fake_uuid_example + + test uuid example + """ + pass + + def test_test_additional_properties_reference(self) -> None: + """Test case for test_additional_properties_reference + + test referenced additionalProperties + """ + pass + + def test_test_body_with_binary(self) -> None: + """Test case for test_body_with_binary + + """ + pass + + def test_test_body_with_file_schema(self) -> None: """Test case for test_body_with_file_schema """ pass - def test_test_body_with_query_params(self): + def test_test_body_with_query_params(self) -> None: """Test case for test_body_with_query_params """ pass - def test_test_client_model(self): + def test_test_client_model(self) -> None: """Test case for test_client_model - To test \"client\" model # noqa: E501 + To test \"client\" model """ pass - def test_test_endpoint_parameters(self): + def test_test_date_time_query_parameter(self) -> None: + """Test case for test_date_time_query_parameter + + """ + pass + + def test_test_empty_and_non_empty_responses(self) -> None: + """Test case for test_empty_and_non_empty_responses + + test empty and non-empty responses + """ + pass + + def test_test_endpoint_parameters(self) -> None: """Test case for test_endpoint_parameters - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 """ pass - def test_test_enum_parameters(self): - """Test case for test_enum_parameters + def test_test_error_responses_with_model(self) -> None: + """Test case for test_error_responses_with_model - To test enum parameters # noqa: E501 + test error responses with model """ pass - def test_test_group_parameters(self): + def test_test_group_parameters(self) -> None: """Test case for test_group_parameters - Fake endpoint to test group parameters (optional) # noqa: E501 + Fake endpoint to test group parameters (optional) """ pass - def test_test_inline_additional_properties(self): + def test_test_inline_additional_properties(self) -> None: """Test case for test_inline_additional_properties - test inline additionalProperties # noqa: E501 + test inline additionalProperties + """ + pass + + def test_test_inline_freeform_additional_properties(self) -> None: + """Test case for test_inline_freeform_additional_properties + + test inline free-form additionalProperties """ pass - def test_test_json_form_data(self): + def test_test_json_form_data(self) -> None: """Test case for test_json_form_data - test json serialization of form data # noqa: E501 + test json serialization of form data """ pass - def test_test_query_parameter_collection_format(self): + def test_test_object_for_multipart_requests(self) -> None: + """Test case for test_object_for_multipart_requests + + """ + pass + + def test_test_query_parameter_collection_format(self) -> None: """Test case for test_query_parameter_collection_format """ pass - @unittest.skip("TODO: MagicMock error") - def test_headers_parameter(self): - """Test case for the _headers are passed by the user + def test_test_string_map_reference(self) -> None: + """Test case for test_string_map_reference + + test referenced string map + """ + pass + + def test_upload_file_with_additional_properties(self) -> None: + """Test case for upload_file_with_additional_properties - To test any optional parameter # noqa: E501 + uploads a file and additional properties using multipart/form-data """ - api = petstore_api.api.PetApi() - with patch("petstore_api.api_client.ApiClient.call_api") as mock_method: - value_headers = {"Header1": "value1"} - api.find_pets_by_status(["available"], _headers=value_headers) - args, _ = mock_method.call_args - self.assertEqual(args, ('GET', '/pet/findByStatus', {}, [('status', ['available'])], {'Accept': 'application/json', 'Header1': 'value1'}) -) + pass + if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python/test/test_fake_classname_tags123_api.py index 881dcba0d25a..9282bf7150cb 100644 --- a/samples/openapi3/client/petstore/python/test/test_fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python/test/test_fake_classname_tags123_api.py @@ -2,33 +2,34 @@ """ OpenAPI Petstore - 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 + + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api -from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.api.fake_classname_tags123_api import FakeClassnameTags123Api class TestFakeClassnameTags123Api(unittest.TestCase): """FakeClassnameTags123Api unit test stubs""" - def setUp(self): - self.api = petstore_api.api.fake_classname_tags123_api.FakeClassnameTags123Api() # noqa: E501 + def setUp(self) -> None: + self.api = FakeClassnameTags123Api() - def tearDown(self): + def tearDown(self) -> None: pass - def test_test_classname(self): + def test_test_classname(self) -> None: """Test case for test_classname - To test class name in snake case # noqa: E501 + + To test class name in snake case """ pass diff --git a/samples/openapi3/client/petstore/python/test/test_feeding.py b/samples/openapi3/client/petstore/python/test/test_feeding.py index a0cdfc8f3460..fc9d904716ee 100644 --- a/samples/openapi3/client/petstore/python/test/test_feeding.py +++ b/samples/openapi3/client/petstore/python/test/test_feeding.py @@ -13,7 +13,6 @@ import unittest -import datetime from petstore_api.models.feeding import Feeding @@ -28,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> Feeding: """Test Feeding - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Feeding` diff --git a/samples/openapi3/client/petstore/python/test/test_file.py b/samples/openapi3/client/petstore/python/test/test_file.py index 3c9b91972d91..d050f5982464 100644 --- a/samples/openapi3/client/petstore/python/test/test_file.py +++ b/samples/openapi3/client/petstore/python/test/test_file.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.file import File # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.file import File class TestFile(unittest.TestCase): """File unit test stubs""" @@ -28,24 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> File: """Test File - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.file.File() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `File` + """ + model = File() + if include_optional: return File( source_uri = '' ) - else : + else: return File( ) + """ def testFile(self): """Test File""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_file_schema_test_class.py b/samples/openapi3/client/petstore/python/test/test_file_schema_test_class.py index 2834ddc05413..ebbf1f587051 100644 --- a/samples/openapi3/client/petstore/python/test/test_file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python/test/test_file_schema_test_class.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.file_schema_test_class import FileSchemaTestClass # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.file_schema_test_class import FileSchemaTestClass class TestFileSchemaTestClass(unittest.TestCase): """FileSchemaTestClass unit test stubs""" @@ -28,29 +25,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FileSchemaTestClass: """Test FileSchemaTestClass - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.file_schema_test_class.FileSchemaTestClass() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `FileSchemaTestClass` + """ + model = FileSchemaTestClass() + if include_optional: return FileSchemaTestClass( file = petstore_api.models.file.File( - source_uri = '', ), + source_uri = '', ), files = [ petstore_api.models.file.File( source_uri = '', ) ] ) - else : + else: return FileSchemaTestClass( ) + """ def testFileSchemaTestClass(self): """Test FileSchemaTestClass""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_first_ref.py b/samples/openapi3/client/petstore/python/test/test_first_ref.py index bcec1c0334bf..38520ad2e63b 100644 --- a/samples/openapi3/client/petstore/python/test/test_first_ref.py +++ b/samples/openapi3/client/petstore/python/test/test_first_ref.py @@ -3,23 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.first_ref import FirstRef # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.first_ref import FirstRef class TestFirstRef(unittest.TestCase): """FirstRef unit test stubs""" @@ -30,17 +25,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FirstRef: """Test FirstRef - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `FirstRef` """ - model = petstore_api.models.first_ref.FirstRef() # noqa: E501 - if include_optional : + model = FirstRef() + if include_optional: return FirstRef( - category = '', + category = '', self_ref = petstore_api.models.second_ref.SecondRef( category = '', circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( @@ -48,7 +43,7 @@ def make_instance(self, include_optional): nested = petstore_api.models.first_ref.FirstRef( category = '', ), ), ) ) - else : + else: return FirstRef( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_foo.py b/samples/openapi3/client/petstore/python/test/test_foo.py index f592b1c37018..430ee19bf695 100644 --- a/samples/openapi3/client/petstore/python/test/test_foo.py +++ b/samples/openapi3/client/petstore/python/test/test_foo.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.foo import Foo # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.foo import Foo class TestFoo(unittest.TestCase): """Foo unit test stubs""" @@ -28,24 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Foo: """Test Foo - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.foo.Foo() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Foo` + """ + model = Foo() + if include_optional: return Foo( bar = 'bar' ) - else : + else: return Foo( ) + """ def testFoo(self): """Test Foo""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_foo_get_default_response.py b/samples/openapi3/client/petstore/python/test/test_foo_get_default_response.py index d2cadc258d8e..c5524b88d2bb 100644 --- a/samples/openapi3/client/petstore/python/test/test_foo_get_default_response.py +++ b/samples/openapi3/client/petstore/python/test/test_foo_get_default_response.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.foo_get_default_response import FooGetDefaultResponse # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.foo_get_default_response import FooGetDefaultResponse class TestFooGetDefaultResponse(unittest.TestCase): """FooGetDefaultResponse unit test stubs""" @@ -28,25 +25,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FooGetDefaultResponse: """Test FooGetDefaultResponse - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.foo_get_default_response.FooGetDefaultResponse() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `FooGetDefaultResponse` + """ + model = FooGetDefaultResponse() + if include_optional: return FooGetDefaultResponse( string = petstore_api.models.foo.Foo( bar = 'bar', ) ) - else : + else: return FooGetDefaultResponse( ) + """ def testFooGetDefaultResponse(self): """Test FooGetDefaultResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_format_test.py b/samples/openapi3/client/petstore/python/test/test_format_test.py index e236e5b7e670..8cde3f67815c 100644 --- a/samples/openapi3/client/petstore/python/test/test_format_test.py +++ b/samples/openapi3/client/petstore/python/test/test_format_test.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.format_test import FormatTest # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.format_test import FormatTest class TestFormatTest(unittest.TestCase): """FormatTest unit test stubs""" @@ -28,44 +25,46 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> FormatTest: """Test FormatTest - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.format_test.FormatTest() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `FormatTest` + """ + model = FormatTest() + if include_optional: return FormatTest( - integer = 10, - int32 = 20, - int64 = 56, - number = 132.1, - float = 54.3, - double = 67.8, - decimal = 1, - string = 'a', - byte = bytes("someting", 'utf-8'), - binary = bytes(b'blah'), + integer = 10, + int32 = 20, + int64 = 56, + number = 32.1, + var_float = 54.3, + double = 67.8, + decimal = 1, + string = 'a', + string_with_double_quote_pattern = 'this is \"something\"', + byte = 'YQ==', + binary = bytes(b'blah'), var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', - password = '0123456789', - pattern_with_digits = '0480728880', + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + uuid = '72f98069-206d-4f12-9f12-3d1e525a8e84', + password = '0123456789', + pattern_with_digits = '0480728880', pattern_with_digits_and_delimiter = 'image_480' ) - else : + else: return FormatTest( - number = 122.1, - byte = bytes("someting", 'utf-8'), - date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + number = 32.1, + var_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), password = '0123456789', ) + """ def testFormatTest(self): """Test FormatTest""" - inst_req_only = self.make_instance(include_optional=False) - # TODO - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_has_only_read_only.py b/samples/openapi3/client/petstore/python/test/test_has_only_read_only.py index 2a8d2df6a0f8..59013015dc71 100644 --- a/samples/openapi3/client/petstore/python/test/test_has_only_read_only.py +++ b/samples/openapi3/client/petstore/python/test/test_has_only_read_only.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.has_only_read_only import HasOnlyReadOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.has_only_read_only import HasOnlyReadOnly class TestHasOnlyReadOnly(unittest.TestCase): """HasOnlyReadOnly unit test stubs""" @@ -28,25 +25,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> HasOnlyReadOnly: """Test HasOnlyReadOnly - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.has_only_read_only.HasOnlyReadOnly() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `HasOnlyReadOnly` + """ + model = HasOnlyReadOnly() + if include_optional: return HasOnlyReadOnly( - bar = '', + bar = '', foo = '' ) - else : + else: return HasOnlyReadOnly( ) + """ def testHasOnlyReadOnly(self): """Test HasOnlyReadOnly""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_health_check_result.py b/samples/openapi3/client/petstore/python/test/test_health_check_result.py index 21c52053ea22..a50444e6d877 100644 --- a/samples/openapi3/client/petstore/python/test/test_health_check_result.py +++ b/samples/openapi3/client/petstore/python/test/test_health_check_result.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.health_check_result import HealthCheckResult # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.health_check_result import HealthCheckResult class TestHealthCheckResult(unittest.TestCase): """HealthCheckResult unit test stubs""" @@ -28,24 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> HealthCheckResult: """Test HealthCheckResult - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.health_check_result.HealthCheckResult() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `HealthCheckResult` + """ + model = HealthCheckResult() + if include_optional: return HealthCheckResult( nullable_message = '' ) - else : + else: return HealthCheckResult( ) + """ def testHealthCheckResult(self): """Test HealthCheckResult""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_info.py b/samples/openapi3/client/petstore/python/test/test_info.py index e1fce9f9c1ec..47075061d9a9 100644 --- a/samples/openapi3/client/petstore/python/test/test_info.py +++ b/samples/openapi3/client/petstore/python/test/test_info.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> Info: """Test Info - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Info` diff --git a/samples/openapi3/client/petstore/python/test/test_inner_dict_with_property.py b/samples/openapi3/client/petstore/python/test/test_inner_dict_with_property.py index 8a63b70d5524..1f80e90e29dd 100644 --- a/samples/openapi3/client/petstore/python/test/test_inner_dict_with_property.py +++ b/samples/openapi3/client/petstore/python/test/test_inner_dict_with_property.py @@ -3,23 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.inner_dict_with_property import InnerDictWithProperty # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.inner_dict_with_property import InnerDictWithProperty class TestInnerDictWithProperty(unittest.TestCase): """InnerDictWithProperty unit test stubs""" @@ -30,19 +25,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> InnerDictWithProperty: """Test InnerDictWithProperty - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InnerDictWithProperty` """ - model = petstore_api.models.inner_dict_with_property.InnerDictWithProperty() # noqa: E501 - if include_optional : + model = InnerDictWithProperty() + if include_optional: return InnerDictWithProperty( a_property = None ) - else : + else: return InnerDictWithProperty( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_input_all_of.py b/samples/openapi3/client/petstore/python/test/test_input_all_of.py index 7ca8140d4d40..212f59bea795 100644 --- a/samples/openapi3/client/petstore/python/test/test_input_all_of.py +++ b/samples/openapi3/client/petstore/python/test/test_input_all_of.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> InputAllOf: """Test InputAllOf - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `InputAllOf` diff --git a/samples/openapi3/client/petstore/python/test/test_int_or_string.py b/samples/openapi3/client/petstore/python/test/test_int_or_string.py index 0de76602cb69..a649aac24694 100644 --- a/samples/openapi3/client/petstore/python/test/test_int_or_string.py +++ b/samples/openapi3/client/petstore/python/test/test_int_or_string.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.int_or_string import IntOrString # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.int_or_string import IntOrString class TestIntOrString(unittest.TestCase): """IntOrString unit test stubs""" @@ -28,18 +25,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> IntOrString: """Test IntOrString - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `IntOrString` """ - model = petstore_api.models.int_or_string.IntOrString() # noqa: E501 - if include_optional : + model = IntOrString() + if include_optional: return IntOrString( ) - else : + else: return IntOrString( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_list_class.py b/samples/openapi3/client/petstore/python/test/test_list_class.py index ac14bf3b3986..7da7d021f776 100644 --- a/samples/openapi3/client/petstore/python/test/test_list_class.py +++ b/samples/openapi3/client/petstore/python/test/test_list_class.py @@ -13,9 +13,8 @@ import unittest -import datetime -from petstore_api.models.list_class import ListClass # noqa: E501 +from petstore_api.models.list_class import ListClass class TestListClass(unittest.TestCase): """ListClass unit test stubs""" @@ -28,12 +27,12 @@ def tearDown(self): def make_instance(self, include_optional) -> ListClass: """Test ListClass - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ListClass` """ - model = ListClass() # noqa: E501 + model = ListClass() if include_optional: return ListClass( var_123_list = '' diff --git a/samples/openapi3/client/petstore/python/test/test_map_of_array_of_model.py b/samples/openapi3/client/petstore/python/test/test_map_of_array_of_model.py index 31ad486f5c03..2d5637f8f34b 100644 --- a/samples/openapi3/client/petstore/python/test/test_map_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python/test/test_map_of_array_of_model.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel class TestMapOfArrayOfModel(unittest.TestCase): """MapOfArrayOfModel unit test stubs""" @@ -28,15 +25,15 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MapOfArrayOfModel: """Test MapOfArrayOfModel - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `MapOfArrayOfModel` """ - model = petstore_api.models.map_of_array_of_model.MapOfArrayOfModel() # noqa: E501 - if include_optional : + model = MapOfArrayOfModel() + if include_optional: return MapOfArrayOfModel( shop_id_to_org_online_lip_map = { 'key' : [ @@ -46,7 +43,7 @@ def make_instance(self, include_optional): ] } ) - else : + else: return MapOfArrayOfModel( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_map_test.py b/samples/openapi3/client/petstore/python/test/test_map_test.py index 5e11fed312ad..6d15e3d0b344 100644 --- a/samples/openapi3/client/petstore/python/test/test_map_test.py +++ b/samples/openapi3/client/petstore/python/test/test_map_test.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.map_test import MapTest # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.map_test import MapTest class TestMapTest(unittest.TestCase): """MapTest unit test stubs""" @@ -28,38 +25,40 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MapTest: """Test MapTest - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.map_test.MapTest() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `MapTest` + """ + model = MapTest() + if include_optional: return MapTest( map_map_of_string = { 'key' : { 'key' : '' } - }, + }, map_of_enum_string = { 'UPPER' : 'UPPER' - }, + }, direct_map = { 'key' : True - }, + }, indirect_map = { 'key' : True } ) - else : + else: return MapTest( ) + """ def testMapTest(self): """Test MapTest""" - # TODO - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py index 5e6437ad0585..33d884c768ba 100644 --- a/samples/openapi3/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python/test/test_mixed_properties_and_additional_properties_class.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass class TestMixedPropertiesAndAdditionalPropertiesClass(unittest.TestCase): """MixedPropertiesAndAdditionalPropertiesClass unit test stubs""" @@ -28,30 +25,33 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> MixedPropertiesAndAdditionalPropertiesClass: """Test MixedPropertiesAndAdditionalPropertiesClass - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.mixed_properties_and_additional_properties_class.MixedPropertiesAndAdditionalPropertiesClass() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `MixedPropertiesAndAdditionalPropertiesClass` + """ + model = MixedPropertiesAndAdditionalPropertiesClass() + if include_optional: return MixedPropertiesAndAdditionalPropertiesClass( - uuid = '', - date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + uuid = '', + date_time = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), map = { 'key' : petstore_api.models.animal.Animal( - className = '', + class_name = '', color = 'red', ) } ) - else : + else: return MixedPropertiesAndAdditionalPropertiesClass( ) + """ def testMixedPropertiesAndAdditionalPropertiesClass(self): """Test MixedPropertiesAndAdditionalPropertiesClass""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_model200_response.py b/samples/openapi3/client/petstore/python/test/test_model200_response.py index f7e9677e0074..007f8a623959 100644 --- a/samples/openapi3/client/petstore/python/test/test_model200_response.py +++ b/samples/openapi3/client/petstore/python/test/test_model200_response.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.model200_response import Model200Response # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.model200_response import Model200Response class TestModel200Response(unittest.TestCase): """Model200Response unit test stubs""" @@ -28,25 +25,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Model200Response: """Test Model200Response - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.model200_response.Model200Response() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Model200Response` + """ + model = Model200Response() + if include_optional: return Model200Response( - name = 56, - _class = '' + name = 56, + var_class = '' ) - else : + else: return Model200Response( ) + """ def testModel200Response(self): """Test Model200Response""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_model_api_response.py b/samples/openapi3/client/petstore/python/test/test_model_api_response.py index f37f34084401..beca8e34434f 100644 --- a/samples/openapi3/client/petstore/python/test/test_model_api_response.py +++ b/samples/openapi3/client/petstore/python/test/test_model_api_response.py @@ -13,7 +13,6 @@ import unittest -import datetime from petstore_api.models.model_api_response import ModelApiResponse @@ -28,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> ModelApiResponse: """Test ModelApiResponse - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ModelApiResponse` diff --git a/samples/openapi3/client/petstore/python/test/test_model_field.py b/samples/openapi3/client/petstore/python/test/test_model_field.py index 315823b80622..eb8dee7981c3 100644 --- a/samples/openapi3/client/petstore/python/test/test_model_field.py +++ b/samples/openapi3/client/petstore/python/test/test_model_field.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> ModelField: """Test ModelField - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ModelField` @@ -35,7 +35,7 @@ def make_instance(self, include_optional) -> ModelField: model = ModelField() if include_optional: return ModelField( - dummy = '' + var_field = '' ) else: return ModelField( diff --git a/samples/openapi3/client/petstore/python/test/test_model_return.py b/samples/openapi3/client/petstore/python/test/test_model_return.py index b0f9d9c4f7f9..2c2afa1d43bb 100644 --- a/samples/openapi3/client/petstore/python/test/test_model_return.py +++ b/samples/openapi3/client/petstore/python/test/test_model_return.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.model_return import ModelReturn # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.model_return import ModelReturn class TestModelReturn(unittest.TestCase): """ModelReturn unit test stubs""" @@ -28,24 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ModelReturn: """Test ModelReturn - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.model_return.ModelReturn() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ModelReturn` + """ + model = ModelReturn() + if include_optional: return ModelReturn( - _return = 56 + var_return = 56 ) - else : + else: return ModelReturn( ) + """ def testModelReturn(self): """Test ModelReturn""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_name.py b/samples/openapi3/client/petstore/python/test/test_name.py index bbf11fd231ea..db4e9cf37e94 100644 --- a/samples/openapi3/client/petstore/python/test/test_name.py +++ b/samples/openapi3/client/petstore/python/test/test_name.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.name import Name # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.name import Name class TestName(unittest.TestCase): """Name unit test stubs""" @@ -28,28 +25,31 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Name: """Test Name - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.name.Name() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Name` + """ + model = Name() + if include_optional: return Name( - name = 56, - snake_case = 56, - _property = '', - _123_number = 56 + name = 56, + snake_case = 56, + var_property = '', + var_123_number = 56 ) - else : + else: return Name( name = 56, ) + """ def testName(self): """Test Name""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_nullable_class.py b/samples/openapi3/client/petstore/python/test/test_nullable_class.py index 7aa59f46bbd8..ecf5363b4ac7 100644 --- a/samples/openapi3/client/petstore/python/test/test_nullable_class.py +++ b/samples/openapi3/client/petstore/python/test/test_nullable_class.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.nullable_class import NullableClass # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.nullable_class import NullableClass class TestNullableClass(unittest.TestCase): """NullableClass unit test stubs""" @@ -28,50 +25,52 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NullableClass: """Test NullableClass - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.nullable_class.NullableClass() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `NullableClass` + """ + model = NullableClass() + if include_optional: return NullableClass( required_integer_prop = 56, - integer_prop = 56, - number_prop = 1.337, - boolean_prop = True, - string_prop = '', - date_prop = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), - datetime_prop = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + integer_prop = 56, + number_prop = 1.337, + boolean_prop = True, + string_prop = '', + date_prop = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(), + datetime_prop = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), array_nullable_prop = [ None - ], + ], array_and_items_nullable_prop = [ None - ], + ], array_items_nullable = [ None - ], + ], object_nullable_prop = { 'key' : None - }, + }, object_and_items_nullable_prop = { 'key' : None - }, + }, object_items_nullable = { 'key' : None } ) - else : + else: return NullableClass( - required_integer_prop = 56 + required_integer_prop = 56, ) + """ def testNullableClass(self): """Test NullableClass""" - # TODO - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_nullable_property.py b/samples/openapi3/client/petstore/python/test/test_nullable_property.py index 34129457b1d7..52bdc7874ed6 100644 --- a/samples/openapi3/client/petstore/python/test/test_nullable_property.py +++ b/samples/openapi3/client/petstore/python/test/test_nullable_property.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.nullable_property import NullableProperty # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.nullable_property import NullableProperty class TestNullableProperty(unittest.TestCase): """NullableProperty unit test stubs""" @@ -28,20 +25,20 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NullableProperty: """Test NullableProperty - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `NullableProperty` """ - model = petstore_api.models.nullable_property.NullableProperty() # noqa: E501 - if include_optional : + model = NullableProperty() + if include_optional: return NullableProperty( - id = 56, + id = 56, name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>' ) - else : + else: return NullableProperty( id = 56, name = 'AUR,rZ#UM/?R,Fp^l6$ARjbhJk C>', diff --git a/samples/openapi3/client/petstore/python/test/test_number_only.py b/samples/openapi3/client/petstore/python/test/test_number_only.py index 776946c3d774..78d7c5cff926 100644 --- a/samples/openapi3/client/petstore/python/test/test_number_only.py +++ b/samples/openapi3/client/petstore/python/test/test_number_only.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.number_only import NumberOnly # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.number_only import NumberOnly class TestNumberOnly(unittest.TestCase): """NumberOnly unit test stubs""" @@ -28,24 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> NumberOnly: """Test NumberOnly - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.number_only.NumberOnly() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `NumberOnly` + """ + model = NumberOnly() + if include_optional: return NumberOnly( just_number = 1.337 ) - else : + else: return NumberOnly( ) + """ def testNumberOnly(self): """Test NumberOnly""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python/test/test_object_to_test_additional_properties.py index f1f354cad251..62c9c5058656 100644 --- a/samples/openapi3/client/petstore/python/test/test_object_to_test_additional_properties.py +++ b/samples/openapi3/client/petstore/python/test/test_object_to_test_additional_properties.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.object_to_test_additional_properties import ObjectToTestAdditionalProperties class TestObjectToTestAdditionalProperties(unittest.TestCase): """ObjectToTestAdditionalProperties unit test stubs""" @@ -28,19 +25,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ObjectToTestAdditionalProperties: """Test ObjectToTestAdditionalProperties - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ObjectToTestAdditionalProperties` """ - model = petstore_api.models.object_to_test_additional_properties.ObjectToTestAdditionalProperties() # noqa: E501 - if include_optional : + model = ObjectToTestAdditionalProperties() + if include_optional: return ObjectToTestAdditionalProperties( var_property = True ) - else : + else: return ObjectToTestAdditionalProperties( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python/test/test_object_with_deprecated_fields.py index e0cbf3e98a51..bf6bf779339c 100644 --- a/samples/openapi3/client/petstore/python/test/test_object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python/test/test_object_with_deprecated_fields.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.object_with_deprecated_fields import ObjectWithDeprecatedFields class TestObjectWithDeprecatedFields(unittest.TestCase): """ObjectWithDeprecatedFields unit test stubs""" @@ -28,30 +25,33 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ObjectWithDeprecatedFields: """Test ObjectWithDeprecatedFields - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.object_with_deprecated_fields.ObjectWithDeprecatedFields() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ObjectWithDeprecatedFields` + """ + model = ObjectWithDeprecatedFields() + if include_optional: return ObjectWithDeprecatedFields( - uuid = '', - id = 1.337, + uuid = '', + id = 1.337, deprecated_ref = petstore_api.models.deprecated_object.DeprecatedObject( - name = '', ), + name = '', ), bars = [ 'bar' ] ) - else : + else: return ObjectWithDeprecatedFields( ) + """ def testObjectWithDeprecatedFields(self): """Test ObjectWithDeprecatedFields""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_one_of_enum_string.py b/samples/openapi3/client/petstore/python/test/test_one_of_enum_string.py index ed959c1479c2..0434db164a7e 100644 --- a/samples/openapi3/client/petstore/python/test/test_one_of_enum_string.py +++ b/samples/openapi3/client/petstore/python/test/test_one_of_enum_string.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.one_of_enum_string import OneOfEnumString # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.one_of_enum_string import OneOfEnumString class TestOneOfEnumString(unittest.TestCase): """OneOfEnumString unit test stubs""" @@ -28,18 +25,18 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OneOfEnumString: """Test OneOfEnumString - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `OneOfEnumString` """ - model = petstore_api.models.one_of_enum_string.OneOfEnumString() # noqa: E501 - if include_optional : + model = OneOfEnumString() + if include_optional: return OneOfEnumString( ) - else : + else: return OneOfEnumString( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_order.py b/samples/openapi3/client/petstore/python/test/test_order.py index d6ec36f83a0d..a9b4980702da 100644 --- a/samples/openapi3/client/petstore/python/test/test_order.py +++ b/samples/openapi3/client/petstore/python/test/test_order.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.order import Order # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.order import Order class TestOrder(unittest.TestCase): """Order unit test stubs""" @@ -28,29 +25,32 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Order: """Test Order - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.order.Order() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Order` + """ + model = Order() + if include_optional: return Order( - id = 56, - pet_id = 56, - quantity = 56, - ship_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), - status = 'placed', + id = 56, + pet_id = 56, + quantity = 56, + ship_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), + status = 'placed', complete = True ) - else : + else: return Order( ) + """ def testOrder(self): """Test Order""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_outer_composite.py b/samples/openapi3/client/petstore/python/test/test_outer_composite.py index c6fd58849377..5024f1c483aa 100644 --- a/samples/openapi3/client/petstore/python/test/test_outer_composite.py +++ b/samples/openapi3/client/petstore/python/test/test_outer_composite.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.outer_composite import OuterComposite # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.outer_composite import OuterComposite class TestOuterComposite(unittest.TestCase): """OuterComposite unit test stubs""" @@ -28,26 +25,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OuterComposite: """Test OuterComposite - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.outer_composite.OuterComposite() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `OuterComposite` + """ + model = OuterComposite() + if include_optional: return OuterComposite( - my_number = 1.337, - my_string = '', + my_number = 1.337, + my_string = '', my_boolean = True ) - else : + else: return OuterComposite( ) + """ def testOuterComposite(self): """Test OuterComposite""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_outer_enum.py b/samples/openapi3/client/petstore/python/test/test_outer_enum.py index aa195260019e..2f82ecc94ba1 100644 --- a/samples/openapi3/client/petstore/python/test/test_outer_enum.py +++ b/samples/openapi3/client/petstore/python/test/test_outer_enum.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.outer_enum import OuterEnum # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.outer_enum import OuterEnum class TestOuterEnum(unittest.TestCase): """OuterEnum unit test stubs""" @@ -30,7 +27,7 @@ def tearDown(self): def testOuterEnum(self): """Test OuterEnum""" - inst = OuterEnum("placed") + # inst = OuterEnum() if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_outer_enum_default_value.py b/samples/openapi3/client/petstore/python/test/test_outer_enum_default_value.py index f8fba3bd79ad..2a7ff27a8245 100644 --- a/samples/openapi3/client/petstore/python/test/test_outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python/test/test_outer_enum_default_value.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue class TestOuterEnumDefaultValue(unittest.TestCase): """OuterEnumDefaultValue unit test stubs""" diff --git a/samples/openapi3/client/petstore/python/test/test_outer_enum_integer.py b/samples/openapi3/client/petstore/python/test/test_outer_enum_integer.py index ce1e47c61b14..d74dcb0981a9 100644 --- a/samples/openapi3/client/petstore/python/test/test_outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python/test/test_outer_enum_integer.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.outer_enum_integer import OuterEnumInteger # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.outer_enum_integer import OuterEnumInteger class TestOuterEnumInteger(unittest.TestCase): """OuterEnumInteger unit test stubs""" diff --git a/samples/openapi3/client/petstore/python/test/test_outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python/test/test_outer_enum_integer_default_value.py index f0b707fca778..230db8cb8176 100644 --- a/samples/openapi3/client/petstore/python/test/test_outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python/test/test_outer_enum_integer_default_value.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue class TestOuterEnumIntegerDefaultValue(unittest.TestCase): """OuterEnumIntegerDefaultValue unit test stubs""" @@ -28,23 +25,9 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): - """Test OuterEnumIntegerDefaultValue - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = petstore_api.models.outer_enum_integer_default_value.OuterEnumIntegerDefaultValue() # noqa: E501 - if include_optional : - return OuterEnumIntegerDefaultValue( - ) - else : - return OuterEnumIntegerDefaultValue( - ) - def testOuterEnumIntegerDefaultValue(self): """Test OuterEnumIntegerDefaultValue""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst = OuterEnumIntegerDefaultValue() if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python/test/test_outer_object_with_enum_property.py index 35258d5d74ac..a1c896ae6610 100644 --- a/samples/openapi3/client/petstore/python/test/test_outer_object_with_enum_property.py +++ b/samples/openapi3/client/petstore/python/test/test_outer_object_with_enum_property.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.outer_object_with_enum_property import OuterObjectWithEnumProperty class TestOuterObjectWithEnumProperty(unittest.TestCase): """OuterObjectWithEnumProperty unit test stubs""" @@ -28,20 +25,24 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> OuterObjectWithEnumProperty: """Test OuterObjectWithEnumProperty - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.outer_object_with_enum_property.OuterObjectWithEnumProperty() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `OuterObjectWithEnumProperty` + """ + model = OuterObjectWithEnumProperty() + if include_optional: return OuterObjectWithEnumProperty( + str_value = 'placed', value = 2 ) - else : + else: return OuterObjectWithEnumProperty( value = 2, ) + """ def testOuterObjectWithEnumProperty(self): """Test OuterObjectWithEnumProperty""" diff --git a/samples/openapi3/client/petstore/python/test/test_parent.py b/samples/openapi3/client/petstore/python/test/test_parent.py index 2a74505f08a1..ea1242c24f4e 100644 --- a/samples/openapi3/client/petstore/python/test/test_parent.py +++ b/samples/openapi3/client/petstore/python/test/test_parent.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.parent import Parent # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.parent import Parent class TestParent(unittest.TestCase): """Parent unit test stubs""" @@ -28,22 +25,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Parent: """Test Parent - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Parent` """ - model = petstore_api.models.parent.Parent() # noqa: E501 - if include_optional : + model = Parent() + if include_optional: return Parent( optional_dict = { 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( a_property = petstore_api.models.a_property.aProperty(), ) } ) - else : + else: return Parent( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_parent_with_optional_dict.py b/samples/openapi3/client/petstore/python/test/test_parent_with_optional_dict.py index 25b769e3d390..7cc74f9e98ec 100644 --- a/samples/openapi3/client/petstore/python/test/test_parent_with_optional_dict.py +++ b/samples/openapi3/client/petstore/python/test/test_parent_with_optional_dict.py @@ -3,23 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict class TestParentWithOptionalDict(unittest.TestCase): """ParentWithOptionalDict unit test stubs""" @@ -30,22 +25,22 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ParentWithOptionalDict: """Test ParentWithOptionalDict - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `ParentWithOptionalDict` """ - model = petstore_api.models.parent_with_optional_dict.ParentWithOptionalDict() # noqa: E501 - if include_optional : + model = ParentWithOptionalDict() + if include_optional: return ParentWithOptionalDict( optional_dict = { 'key' : petstore_api.models.inner_dict_with_property.InnerDictWithProperty( a_property = petstore_api.models.a_property.aProperty(), ) } ) - else : + else: return ParentWithOptionalDict( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_pet.py b/samples/openapi3/client/petstore/python/test/test_pet.py index de97fcf848b5..3edc400fafcb 100644 --- a/samples/openapi3/client/petstore/python/test/test_pet.py +++ b/samples/openapi3/client/petstore/python/test/test_pet.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.pet import Pet # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.pet import Pet class TestPet(unittest.TestCase): """Pet unit test stubs""" @@ -28,41 +25,44 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Pet: """Test Pet - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.pet.Pet() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Pet` + """ + model = Pet() + if include_optional: return Pet( - id = 56, + id = 56, category = petstore_api.models.category.Category( id = 56, - name = 'default-name', ), - name = 'doggie', - photoUrls = [ + name = 'default-name', ), + name = 'doggie', + photo_urls = [ '' - ], + ], tags = [ petstore_api.models.tag.Tag( id = 56, name = '', ) - ], + ], status = 'available' ) - else : + else: return Pet( name = 'doggie', - photoUrls = [ + photo_urls = [ '' ], ) + """ def testPet(self): """Test Pet""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_pet_api.py b/samples/openapi3/client/petstore/python/test/test_pet_api.py index 77665df879f1..4cf869d36a26 100644 --- a/samples/openapi3/client/petstore/python/test/test_pet_api.py +++ b/samples/openapi3/client/petstore/python/test/test_pet_api.py @@ -3,91 +3,89 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api -from petstore_api.api.pet_api import PetApi # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.api.pet_api import PetApi class TestPetApi(unittest.TestCase): """PetApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.pet_api.PetApi() # noqa: E501 + def setUp(self) -> None: + self.api = PetApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_add_pet(self): + def test_add_pet(self) -> None: """Test case for add_pet - Add a new pet to the store # noqa: E501 + Add a new pet to the store """ pass - def test_delete_pet(self): + def test_delete_pet(self) -> None: """Test case for delete_pet - Deletes a pet # noqa: E501 + Deletes a pet """ pass - def test_find_pets_by_status(self): + def test_find_pets_by_status(self) -> None: """Test case for find_pets_by_status - Finds Pets by status # noqa: E501 + Finds Pets by status """ pass - def test_find_pets_by_tags(self): + def test_find_pets_by_tags(self) -> None: """Test case for find_pets_by_tags - Finds Pets by tags # noqa: E501 + Finds Pets by tags """ pass - def test_get_pet_by_id(self): + def test_get_pet_by_id(self) -> None: """Test case for get_pet_by_id - Find pet by ID # noqa: E501 + Find pet by ID """ pass - def test_update_pet(self): + def test_update_pet(self) -> None: """Test case for update_pet - Update an existing pet # noqa: E501 + Update an existing pet """ pass - def test_update_pet_with_form(self): + def test_update_pet_with_form(self) -> None: """Test case for update_pet_with_form - Updates a pet in the store with form data # noqa: E501 + Updates a pet in the store with form data """ pass - def test_upload_file(self): + def test_upload_file(self) -> None: """Test case for upload_file - uploads an image # noqa: E501 + uploads an image """ pass - def test_upload_file_with_required_file(self): + def test_upload_file_with_required_file(self) -> None: """Test case for upload_file_with_required_file - uploads an image (required) # noqa: E501 + uploads an image (required) """ pass diff --git a/samples/openapi3/client/petstore/python/test/test_pig.py b/samples/openapi3/client/petstore/python/test/test_pig.py index 95e99f35a738..c336579232b0 100644 --- a/samples/openapi3/client/petstore/python/test/test_pig.py +++ b/samples/openapi3/client/petstore/python/test/test_pig.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.pig import Pig # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.pig import Pig class TestPig(unittest.TestCase): """Pig unit test stubs""" @@ -28,6 +25,28 @@ def setUp(self): def tearDown(self): pass + def make_instance(self, include_optional) -> Pig: + """Test Pig + include_optional is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `Pig` + """ + model = Pig() + if include_optional: + return Pig( + class_name = '', + color = '', + size = 56 + ) + else: + return Pig( + class_name = '', + color = '', + size = 56, + ) + """ + def testPig(self): """Test Pig""" # inst_req_only = self.make_instance(include_optional=False) diff --git a/samples/openapi3/client/petstore/python/test/test_poop_cleaning.py b/samples/openapi3/client/petstore/python/test/test_poop_cleaning.py index 4c94fddca97a..5a12f965aefe 100644 --- a/samples/openapi3/client/petstore/python/test/test_poop_cleaning.py +++ b/samples/openapi3/client/petstore/python/test/test_poop_cleaning.py @@ -13,7 +13,6 @@ import unittest -import datetime from petstore_api.models.poop_cleaning import PoopCleaning @@ -28,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> PoopCleaning: """Test PoopCleaning - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PoopCleaning` diff --git a/samples/openapi3/client/petstore/python/test/test_primitive_string.py b/samples/openapi3/client/petstore/python/test/test_primitive_string.py index 8b9ccf59893b..67ec90914d0f 100644 --- a/samples/openapi3/client/petstore/python/test/test_primitive_string.py +++ b/samples/openapi3/client/petstore/python/test/test_primitive_string.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> PrimitiveString: """Test PrimitiveString - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PrimitiveString` diff --git a/samples/openapi3/client/petstore/python/test/test_property_map.py b/samples/openapi3/client/petstore/python/test/test_property_map.py index 3934a29432ed..2f2fed72a136 100644 --- a/samples/openapi3/client/petstore/python/test/test_property_map.py +++ b/samples/openapi3/client/petstore/python/test/test_property_map.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> PropertyMap: """Test PropertyMap - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PropertyMap` diff --git a/samples/openapi3/client/petstore/python/test/test_property_name_collision.py b/samples/openapi3/client/petstore/python/test/test_property_name_collision.py index 04ab956f191d..ab7919c7e6a9 100644 --- a/samples/openapi3/client/petstore/python/test/test_property_name_collision.py +++ b/samples/openapi3/client/petstore/python/test/test_property_name_collision.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.property_name_collision import PropertyNameCollision # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.property_name_collision import PropertyNameCollision class TestPropertyNameCollision(unittest.TestCase): """PropertyNameCollision unit test stubs""" @@ -28,21 +25,21 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> PropertyNameCollision: """Test PropertyNameCollision - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `PropertyNameCollision` """ - model = petstore_api.models.property_name_collision.PropertyNameCollision() # noqa: E501 - if include_optional : + model = PropertyNameCollision() + if include_optional: return PropertyNameCollision( - underscoreType = '', - type = '', - typeWithUnderscore = '' + underscore_type = '', + type = '', + type_with_underscore = '' ) - else : + else: return PropertyNameCollision( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_read_only_first.py b/samples/openapi3/client/petstore/python/test/test_read_only_first.py index 310e4b1aebbe..ec7a1aa24140 100644 --- a/samples/openapi3/client/petstore/python/test/test_read_only_first.py +++ b/samples/openapi3/client/petstore/python/test/test_read_only_first.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.read_only_first import ReadOnlyFirst # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.read_only_first import ReadOnlyFirst class TestReadOnlyFirst(unittest.TestCase): """ReadOnlyFirst unit test stubs""" @@ -28,25 +25,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> ReadOnlyFirst: """Test ReadOnlyFirst - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.read_only_first.ReadOnlyFirst() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `ReadOnlyFirst` + """ + model = ReadOnlyFirst() + if include_optional: return ReadOnlyFirst( - bar = '', + bar = '', baz = '' ) - else : + else: return ReadOnlyFirst( ) + """ def testReadOnlyFirst(self): """Test ReadOnlyFirst""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_second_circular_all_of_ref.py b/samples/openapi3/client/petstore/python/test/test_second_circular_all_of_ref.py index 5e6d12f756bd..21d9005a5e82 100644 --- a/samples/openapi3/client/petstore/python/test/test_second_circular_all_of_ref.py +++ b/samples/openapi3/client/petstore/python/test/test_second_circular_all_of_ref.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> SecondCircularAllOfRef: """Test SecondCircularAllOfRef - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SecondCircularAllOfRef` @@ -35,13 +35,10 @@ def make_instance(self, include_optional) -> SecondCircularAllOfRef: model = SecondCircularAllOfRef() if include_optional: return SecondCircularAllOfRef( + name = '', circular_all_of_ref = [ - petstore_api.models.circular_all_of_ref.CircularAllOfRef( - second_circular_all_of_ref = [ - petstore_api.models.second_circular_all_of_ref.SecondCircularAllOfRef() - ], ) - ], - name = '' + petstore_api.models.circular_all_of_ref.CircularAllOfRef() + ] ) else: return SecondCircularAllOfRef( diff --git a/samples/openapi3/client/petstore/python/test/test_second_ref.py b/samples/openapi3/client/petstore/python/test/test_second_ref.py index 782892fd4e17..f6117988c198 100644 --- a/samples/openapi3/client/petstore/python/test/test_second_ref.py +++ b/samples/openapi3/client/petstore/python/test/test_second_ref.py @@ -3,23 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" - +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.second_ref import SecondRef # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.second_ref import SecondRef class TestSecondRef(unittest.TestCase): """SecondRef unit test stubs""" @@ -30,17 +25,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SecondRef: """Test SecondRef - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SecondRef` """ - model = petstore_api.models.second_ref.SecondRef() # noqa: E501 - if include_optional : + model = SecondRef() + if include_optional: return SecondRef( - category = '', + category = '', circular_ref = petstore_api.models.circular_reference_model.Circular-Reference-Model( size = 56, nested = petstore_api.models.first_ref.FirstRef( @@ -48,7 +43,7 @@ def make_instance(self, include_optional): self_ref = petstore_api.models.second_ref.SecondRef( category = '', ), ), ) ) - else : + else: return SecondRef( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_self_reference_model.py b/samples/openapi3/client/petstore/python/test/test_self_reference_model.py index b3dd7ada2b2a..018bcd195b64 100644 --- a/samples/openapi3/client/petstore/python/test/test_self_reference_model.py +++ b/samples/openapi3/client/petstore/python/test/test_self_reference_model.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.self_reference_model import SelfReferenceModel # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.self_reference_model import SelfReferenceModel class TestSelfReferenceModel(unittest.TestCase): """SelfReferenceModel unit test stubs""" @@ -28,17 +25,17 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SelfReferenceModel: """Test SelfReferenceModel - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SelfReferenceModel` """ - model = petstore_api.models.self_reference_model.SelfReferenceModel() # noqa: E501 - if include_optional : + model = SelfReferenceModel() + if include_optional: return SelfReferenceModel( - size = 56, + size = 56, nested = petstore_api.models.dummy_model.Dummy-Model( category = '', self_ref = petstore_api.models.self_reference_model.Self-Reference-Model( @@ -46,7 +43,7 @@ def make_instance(self, include_optional): nested = petstore_api.models.dummy_model.Dummy-Model( category = '', ), ), ) ) - else : + else: return SelfReferenceModel( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_single_ref_type.py b/samples/openapi3/client/petstore/python/test/test_single_ref_type.py index 888a1a7b6da3..630b1c137087 100644 --- a/samples/openapi3/client/petstore/python/test/test_single_ref_type.py +++ b/samples/openapi3/client/petstore/python/test/test_single_ref_type.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.single_ref_type import SingleRefType # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.single_ref_type import SingleRefType class TestSingleRefType(unittest.TestCase): """SingleRefType unit test stubs""" @@ -28,23 +25,9 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): - """Test SingleRefType - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = petstore_api.models.single_ref_type.SingleRefType() # noqa: E501 - if include_optional : - return SingleRefType( - ) - else : - return SingleRefType( - ) - def testSingleRefType(self): """Test SingleRefType""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst = SingleRefType() if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_special_character_enum.py b/samples/openapi3/client/petstore/python/test/test_special_character_enum.py index 028f55599e49..464808e61b09 100644 --- a/samples/openapi3/client/petstore/python/test/test_special_character_enum.py +++ b/samples/openapi3/client/petstore/python/test/test_special_character_enum.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.special_character_enum import SpecialCharacterEnum # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.special_character_enum import SpecialCharacterEnum class TestSpecialCharacterEnum(unittest.TestCase): """SpecialCharacterEnum unit test stubs""" diff --git a/samples/openapi3/client/petstore/python/test/test_special_model_name.py b/samples/openapi3/client/petstore/python/test/test_special_model_name.py index eb487cd42fc1..e913fa28f51e 100644 --- a/samples/openapi3/client/petstore/python/test/test_special_model_name.py +++ b/samples/openapi3/client/petstore/python/test/test_special_model_name.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.special_model_name import SpecialModelName # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.special_model_name import SpecialModelName class TestSpecialModelName(unittest.TestCase): """SpecialModelName unit test stubs""" @@ -28,24 +25,27 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpecialModelName: """Test SpecialModelName - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.special_model_name.SpecialModelName() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `SpecialModelName` + """ + model = SpecialModelName() + if include_optional: return SpecialModelName( special_property_name = 56 ) - else : + else: return SpecialModelName( ) + """ def testSpecialModelName(self): """Test SpecialModelName""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_special_name.py b/samples/openapi3/client/petstore/python/test/test_special_name.py index 1f4287871a8e..153768c98984 100644 --- a/samples/openapi3/client/petstore/python/test/test_special_name.py +++ b/samples/openapi3/client/petstore/python/test/test_special_name.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.special_name import SpecialName # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.special_name import SpecialName class TestSpecialName(unittest.TestCase): """SpecialName unit test stubs""" @@ -28,23 +25,23 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> SpecialName: """Test SpecialName - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `SpecialName` """ - model = petstore_api.models.special_name.SpecialName() # noqa: E501 - if include_optional : + model = SpecialName() + if include_optional: return SpecialName( - var_property = 56, + var_property = 56, var_async = petstore_api.models.category.Category( id = 56, - name = 'default-name', ), - status = 'available' + name = 'default-name', ), + var_schema = 'available' ) - else : + else: return SpecialName( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_store_api.py b/samples/openapi3/client/petstore/python/test/test_store_api.py index 81848d24a67e..603b0f7bc57c 100644 --- a/samples/openapi3/client/petstore/python/test/test_store_api.py +++ b/samples/openapi3/client/petstore/python/test/test_store_api.py @@ -3,56 +3,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: \" \\ # noqa: E501 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api -from petstore_api.api.store_api import StoreApi # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.api.store_api import StoreApi class TestStoreApi(unittest.TestCase): """StoreApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.store_api.StoreApi() # noqa: E501 + def setUp(self) -> None: + self.api = StoreApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_delete_order(self): + def test_delete_order(self) -> None: """Test case for delete_order - Delete purchase order by ID # noqa: E501 + Delete purchase order by ID """ pass - def test_get_inventory(self): + def test_get_inventory(self) -> None: """Test case for get_inventory - Returns pet inventories by status # noqa: E501 + Returns pet inventories by status """ pass - def test_get_order_by_id(self): + def test_get_order_by_id(self) -> None: """Test case for get_order_by_id - Find purchase order by ID # noqa: E501 + Find purchase order by ID """ pass - def test_place_order(self): + def test_place_order(self) -> None: """Test case for place_order - Place an order for a pet # noqa: E501 + Place an order for a pet """ pass diff --git a/samples/openapi3/client/petstore/python/test/test_tag.py b/samples/openapi3/client/petstore/python/test/test_tag.py index 9680300032f1..92061e615e28 100644 --- a/samples/openapi3/client/petstore/python/test/test_tag.py +++ b/samples/openapi3/client/petstore/python/test/test_tag.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.tag import Tag # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.tag import Tag class TestTag(unittest.TestCase): """Tag unit test stubs""" @@ -28,25 +25,28 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Tag: """Test Tag - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.tag.Tag() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `Tag` + """ + model = Tag() + if include_optional: return Tag( - id = 56, + id = 56, name = '' ) - else : + else: return Tag( ) + """ def testTag(self): """Test Tag""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_task.py b/samples/openapi3/client/petstore/python/test/test_task.py index bbbc14a39928..0044da80776b 100644 --- a/samples/openapi3/client/petstore/python/test/test_task.py +++ b/samples/openapi3/client/petstore/python/test/test_task.py @@ -13,7 +13,6 @@ import unittest -import datetime from petstore_api.models.task import Task @@ -28,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> Task: """Test Task - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Task` diff --git a/samples/openapi3/client/petstore/python/test/test_task_activity.py b/samples/openapi3/client/petstore/python/test/test_task_activity.py index 2d56d9c5ad3e..bd25e5887ac4 100644 --- a/samples/openapi3/client/petstore/python/test/test_task_activity.py +++ b/samples/openapi3/client/petstore/python/test/test_task_activity.py @@ -13,7 +13,6 @@ import unittest -import datetime from petstore_api.models.task_activity import TaskActivity @@ -28,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> TaskActivity: """Test TaskActivity - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TaskActivity` diff --git a/samples/openapi3/client/petstore/python/test/test_test_error_responses_with_model400_response.py b/samples/openapi3/client/petstore/python/test/test_test_error_responses_with_model400_response.py index 35db7ba74fb7..72d243b82fc4 100644 --- a/samples/openapi3/client/petstore/python/test/test_test_error_responses_with_model400_response.py +++ b/samples/openapi3/client/petstore/python/test/test_test_error_responses_with_model400_response.py @@ -13,7 +13,6 @@ import unittest -import datetime from petstore_api.models.test_error_responses_with_model400_response import TestErrorResponsesWithModel400Response @@ -28,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> TestErrorResponsesWithModel400Response: """Test TestErrorResponsesWithModel400Response - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestErrorResponsesWithModel400Response` diff --git a/samples/openapi3/client/petstore/python/test/test_test_error_responses_with_model404_response.py b/samples/openapi3/client/petstore/python/test/test_test_error_responses_with_model404_response.py index e9c97c0f484b..fff790172b14 100644 --- a/samples/openapi3/client/petstore/python/test/test_test_error_responses_with_model404_response.py +++ b/samples/openapi3/client/petstore/python/test/test_test_error_responses_with_model404_response.py @@ -13,7 +13,6 @@ import unittest -import datetime from petstore_api.models.test_error_responses_with_model404_response import TestErrorResponsesWithModel404Response @@ -28,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> TestErrorResponsesWithModel404Response: """Test TestErrorResponsesWithModel404Response - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestErrorResponsesWithModel404Response` diff --git a/samples/openapi3/client/petstore/python/test/test_test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python/test/test_test_inline_freeform_additional_properties_request.py index 5c40397bc913..add42258580a 100644 --- a/samples/openapi3/client/petstore/python/test/test_test_inline_freeform_additional_properties_request.py +++ b/samples/openapi3/client/petstore/python/test/test_test_inline_freeform_additional_properties_request.py @@ -13,9 +13,8 @@ import unittest -import datetime -from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest # noqa: E501 +from petstore_api.models.test_inline_freeform_additional_properties_request import TestInlineFreeformAdditionalPropertiesRequest class TestTestInlineFreeformAdditionalPropertiesRequest(unittest.TestCase): """TestInlineFreeformAdditionalPropertiesRequest unit test stubs""" @@ -28,12 +27,12 @@ def tearDown(self): def make_instance(self, include_optional) -> TestInlineFreeformAdditionalPropertiesRequest: """Test TestInlineFreeformAdditionalPropertiesRequest - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestInlineFreeformAdditionalPropertiesRequest` """ - model = TestInlineFreeformAdditionalPropertiesRequest() # noqa: E501 + model = TestInlineFreeformAdditionalPropertiesRequest() if include_optional: return TestInlineFreeformAdditionalPropertiesRequest( some_property = '' diff --git a/samples/openapi3/client/petstore/python/test/test_test_model_with_enum_default.py b/samples/openapi3/client/petstore/python/test/test_test_model_with_enum_default.py index 7d2029d0af92..e58802b59de7 100644 --- a/samples/openapi3/client/petstore/python/test/test_test_model_with_enum_default.py +++ b/samples/openapi3/client/petstore/python/test/test_test_model_with_enum_default.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> TestModelWithEnumDefault: """Test TestModelWithEnumDefault - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestModelWithEnumDefault` diff --git a/samples/openapi3/client/petstore/python/test/test_test_object_for_multipart_requests_request_marker.py b/samples/openapi3/client/petstore/python/test/test_test_object_for_multipart_requests_request_marker.py index 3c831caad5a0..585a39c8fe6b 100644 --- a/samples/openapi3/client/petstore/python/test/test_test_object_for_multipart_requests_request_marker.py +++ b/samples/openapi3/client/petstore/python/test/test_test_object_for_multipart_requests_request_marker.py @@ -27,7 +27,7 @@ def tearDown(self): def make_instance(self, include_optional) -> TestObjectForMultipartRequestsRequestMarker: """Test TestObjectForMultipartRequestsRequestMarker - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `TestObjectForMultipartRequestsRequestMarker` diff --git a/samples/openapi3/client/petstore/python/test/test_tiger.py b/samples/openapi3/client/petstore/python/test/test_tiger.py index 83c91cea1a0d..2d153c1749c3 100644 --- a/samples/openapi3/client/petstore/python/test/test_tiger.py +++ b/samples/openapi3/client/petstore/python/test/test_tiger.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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 OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. -""" +""" # noqa: E501 import unittest -import datetime -import petstore_api -from petstore_api.models.tiger import Tiger # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.tiger import Tiger class TestTiger(unittest.TestCase): """Tiger unit test stubs""" @@ -28,19 +25,19 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> Tiger: """Test Tiger - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `Tiger` """ - model = petstore_api.models.tiger.Tiger() # noqa: E501 - if include_optional : + model = Tiger() + if include_optional: return Tiger( skill = '' ) - else : + else: return Tiger( ) """ diff --git a/samples/openapi3/client/petstore/python/test/test_unnamed_dict_with_additional_model_list_properties.py b/samples/openapi3/client/petstore/python/test/test_unnamed_dict_with_additional_model_list_properties.py index 64854cb7ee97..874af4e78f8b 100644 --- a/samples/openapi3/client/petstore/python/test/test_unnamed_dict_with_additional_model_list_properties.py +++ b/samples/openapi3/client/petstore/python/test/test_unnamed_dict_with_additional_model_list_properties.py @@ -13,9 +13,8 @@ import unittest -import datetime -from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties # noqa: E501 +from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties class TestUnnamedDictWithAdditionalModelListProperties(unittest.TestCase): """UnnamedDictWithAdditionalModelListProperties unit test stubs""" @@ -28,12 +27,12 @@ def tearDown(self): def make_instance(self, include_optional) -> UnnamedDictWithAdditionalModelListProperties: """Test UnnamedDictWithAdditionalModelListProperties - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `UnnamedDictWithAdditionalModelListProperties` """ - model = UnnamedDictWithAdditionalModelListProperties() # noqa: E501 + model = UnnamedDictWithAdditionalModelListProperties() if include_optional: return UnnamedDictWithAdditionalModelListProperties( dict_property = { diff --git a/samples/openapi3/client/petstore/python/test/test_unnamed_dict_with_additional_string_list_properties.py b/samples/openapi3/client/petstore/python/test/test_unnamed_dict_with_additional_string_list_properties.py index 832dc0c32d2a..e0a94bc92dc1 100644 --- a/samples/openapi3/client/petstore/python/test/test_unnamed_dict_with_additional_string_list_properties.py +++ b/samples/openapi3/client/petstore/python/test/test_unnamed_dict_with_additional_string_list_properties.py @@ -13,9 +13,8 @@ import unittest -import datetime -from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties # noqa: E501 +from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties class TestUnnamedDictWithAdditionalStringListProperties(unittest.TestCase): """UnnamedDictWithAdditionalStringListProperties unit test stubs""" @@ -28,12 +27,12 @@ def tearDown(self): def make_instance(self, include_optional) -> UnnamedDictWithAdditionalStringListProperties: """Test UnnamedDictWithAdditionalStringListProperties - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ # uncomment below to create an instance of `UnnamedDictWithAdditionalStringListProperties` """ - model = UnnamedDictWithAdditionalStringListProperties() # noqa: E501 + model = UnnamedDictWithAdditionalStringListProperties() if include_optional: return UnnamedDictWithAdditionalStringListProperties( dict_property = { diff --git a/samples/openapi3/client/petstore/python/test/test_user.py b/samples/openapi3/client/petstore/python/test/test_user.py index 174c8e06be5d..19c320733220 100644 --- a/samples/openapi3/client/petstore/python/test/test_user.py +++ b/samples/openapi3/client/petstore/python/test/test_user.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.user import User # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.user import User class TestUser(unittest.TestCase): """User unit test stubs""" @@ -28,31 +25,34 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> User: """Test User - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.user.User() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `User` + """ + model = User() + if include_optional: return User( - id = 56, - username = '', - first_name = '', - last_name = '', - email = '', - password = '', - phone = '', + id = 56, + username = '', + first_name = '', + last_name = '', + email = '', + password = '', + phone = '', user_status = 56 ) - else : + else: return User( ) + """ def testUser(self): """Test User""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_user_api.py b/samples/openapi3/client/petstore/python/test/test_user_api.py index 6df730fba2b1..6b17c42093e2 100644 --- a/samples/openapi3/client/petstore/python/test/test_user_api.py +++ b/samples/openapi3/client/petstore/python/test/test_user_api.py @@ -3,84 +3,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: \" \\ # noqa: E501 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import petstore_api -from petstore_api.api.user_api import UserApi # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.api.user_api import UserApi class TestUserApi(unittest.TestCase): """UserApi unit test stubs""" - def setUp(self): - self.api = petstore_api.api.user_api.UserApi() # noqa: E501 + def setUp(self) -> None: + self.api = UserApi() - def tearDown(self): + def tearDown(self) -> None: pass - def test_create_user(self): + def test_create_user(self) -> None: """Test case for create_user - Create user # noqa: E501 + Create user """ pass - def test_create_users_with_array_input(self): + def test_create_users_with_array_input(self) -> None: """Test case for create_users_with_array_input - Creates list of users with given input array # noqa: E501 + Creates list of users with given input array """ pass - def test_create_users_with_list_input(self): + def test_create_users_with_list_input(self) -> None: """Test case for create_users_with_list_input - Creates list of users with given input array # noqa: E501 + Creates list of users with given input array """ pass - def test_delete_user(self): + def test_delete_user(self) -> None: """Test case for delete_user - Delete user # noqa: E501 + Delete user """ pass - def test_get_user_by_name(self): + def test_get_user_by_name(self) -> None: """Test case for get_user_by_name - Get user by user name # noqa: E501 + Get user by user name """ pass - def test_login_user(self): + def test_login_user(self) -> None: """Test case for login_user - Logs user into the system # noqa: E501 + Logs user into the system """ pass - def test_logout_user(self): + def test_logout_user(self) -> None: """Test case for logout_user - Logs out current logged in user session # noqa: E501 + Logs out current logged in user session """ pass - def test_update_user(self): + def test_update_user(self) -> None: """Test case for update_user - Updated user # noqa: E501 + Updated user """ pass diff --git a/samples/openapi3/client/petstore/python/test/test_with_nested_one_of.py b/samples/openapi3/client/petstore/python/test/test_with_nested_one_of.py index 994004dd7ab7..6d8fd35bfc08 100644 --- a/samples/openapi3/client/petstore/python/test/test_with_nested_one_of.py +++ b/samples/openapi3/client/petstore/python/test/test_with_nested_one_of.py @@ -3,21 +3,18 @@ """ OpenAPI Petstore - 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 + 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://openapi-generator.tech -""" + Generated by OpenAPI Generator (https://openapi-generator.tech) + Do not edit the class manually. +""" # noqa: E501 -from __future__ import absolute_import import unittest -import datetime -import petstore_api -from petstore_api.models.with_nested_one_of import WithNestedOneOf # noqa: E501 -from petstore_api.rest import ApiException +from petstore_api.models.with_nested_one_of import WithNestedOneOf class TestWithNestedOneOf(unittest.TestCase): """WithNestedOneOf unit test stubs""" @@ -28,25 +25,29 @@ def setUp(self): def tearDown(self): pass - def make_instance(self, include_optional): + def make_instance(self, include_optional) -> WithNestedOneOf: """Test WithNestedOneOf - include_option is a boolean, when False only required + include_optional is a boolean, when False only required params are included, when True both required and optional params are included """ - # model = petstore_api.models.with_nested_one_of.WithNestedOneOf() # noqa: E501 - if include_optional : + # uncomment below to create an instance of `WithNestedOneOf` + """ + model = WithNestedOneOf() + if include_optional: return WithNestedOneOf( - size = 56, - nested_pig = None + size = 56, + nested_pig = None, + nested_oneof_enum_string = None ) - else : + else: return WithNestedOneOf( ) + """ def testWithNestedOneOf(self): """Test WithNestedOneOf""" - #inst_req_only = self.make_instance(include_optional=False) - #inst_req_and_optional = self.make_instance(include_optional=True) + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main() diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/package.json b/samples/openapi3/client/petstore/typescript/builds/browser/package.json index 7f477ac29fd7..dec266f420ca 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/browser/package.json @@ -33,11 +33,9 @@ }, "dependencies": { "whatwg-fetch": "^3.0.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } 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 ea8d9cce8ca6..f88431483262 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json @@ -32,11 +32,9 @@ }, "dependencies": { "whatwg-fetch": "^3.0.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json index a18e68426adc..899339bc1315 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package.json @@ -35,11 +35,9 @@ "@types/node-fetch": "^2.5.7", "@types/node": "*", "form-data": "^2.5.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json index a18e68426adc..899339bc1315 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json @@ -35,11 +35,9 @@ "@types/node-fetch": "^2.5.7", "@types/node": "*", "form-data": "^2.5.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json index 1118902e6673..6ca00c504c56 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json @@ -37,11 +37,9 @@ "@types/node": "*", "form-data": "^2.5.0", "inversify": "^6.0.1", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json index aac146f24362..1da818423668 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json @@ -33,11 +33,9 @@ "dependencies": { "@types/jquery": "^3.3.29", "jquery": "^3.4.1", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/package.json b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/package.json index ea853317fbd4..000e9c5844c4 100644 --- a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/package.json @@ -32,11 +32,9 @@ }, "dependencies": { "whatwg-fetch": "^3.0.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } 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 a18e68426adc..899339bc1315 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json @@ -35,11 +35,9 @@ "@types/node-fetch": "^2.5.7", "@types/node": "*", "form-data": "^2.5.0", - "es6-promise": "^4.2.4", - "url-parse": "^1.4.3" + "es6-promise": "^4.2.4" }, "devDependencies": { - "typescript": "^4.0", - "@types/url-parse": "1.4.4" + "typescript": "^4.0" } } diff --git a/samples/server/petstore/java-inflector/.openapi-generator/VERSION b/samples/server/petstore/java-inflector/.openapi-generator/VERSION index 757e67400401..884119126398 100644 --- a/samples/server/petstore/java-inflector/.openapi-generator/VERSION +++ b/samples/server/petstore/java-inflector/.openapi-generator/VERSION @@ -1 +1 @@ -7.0.0-SNAPSHOT \ No newline at end of file +7.11.0-SNAPSHOT diff --git a/samples/server/petstore/java-inflector/pom.xml b/samples/server/petstore/java-inflector/pom.xml index acd13679ba6b..6cdeb7eaa66e 100644 --- a/samples/server/petstore/java-inflector/pom.xml +++ b/samples/server/petstore/java-inflector/pom.xml @@ -162,7 +162,7 @@ 1.0.0 1.0.14 9.2.9.v20150224 - 1.2.10 + 1.5.13 1.3.5 4.13.2 1.6.3 diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/controllers/StringUtil.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/controllers/StringUtil.java index c53c2d62b08c..a6b07c1a90e4 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/controllers/StringUtil.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/controllers/StringUtil.java @@ -1,6 +1,6 @@ package org.openapitools.controllers; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesAnyType.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesAnyType.java index 45349a0d1ff2..99664c1f9fcc 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesAnyType.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesAnyType.java @@ -12,7 +12,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class AdditionalPropertiesAnyType extends HashMap { @JsonProperty("name") private String name; @@ -44,12 +44,12 @@ public boolean equals(Object o) { return false; } AdditionalPropertiesAnyType additionalPropertiesAnyType = (AdditionalPropertiesAnyType) o; - return Objects.equals(name, additionalPropertiesAnyType.name); + return super.equals(o) && Objects.equals(name, additionalPropertiesAnyType.name); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(super.hashCode(), name); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesArray.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesArray.java index e5f8a37caac8..6306e4130717 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesArray.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesArray.java @@ -13,7 +13,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class AdditionalPropertiesArray extends HashMap { @JsonProperty("name") private String name; @@ -45,12 +45,12 @@ public boolean equals(Object o) { return false; } AdditionalPropertiesArray additionalPropertiesArray = (AdditionalPropertiesArray) o; - return Objects.equals(name, additionalPropertiesArray.name); + return super.equals(o) && Objects.equals(name, additionalPropertiesArray.name); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(super.hashCode(), name); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesBoolean.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesBoolean.java index e6a70ee6675e..1cbed4f4c10c 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesBoolean.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesBoolean.java @@ -12,7 +12,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class AdditionalPropertiesBoolean extends HashMap { @JsonProperty("name") private String name; @@ -44,12 +44,12 @@ public boolean equals(Object o) { return false; } AdditionalPropertiesBoolean additionalPropertiesBoolean = (AdditionalPropertiesBoolean) o; - return Objects.equals(name, additionalPropertiesBoolean.name); + return super.equals(o) && Objects.equals(name, additionalPropertiesBoolean.name); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(super.hashCode(), name); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index b0fe5955c311..b5afd7e852d7 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -14,7 +14,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class AdditionalPropertiesClass { @JsonProperty("map_string") private Map mapString = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesInteger.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesInteger.java index 769a33533def..f2fb063f62d8 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesInteger.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesInteger.java @@ -12,7 +12,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class AdditionalPropertiesInteger extends HashMap { @JsonProperty("name") private String name; @@ -44,12 +44,12 @@ public boolean equals(Object o) { return false; } AdditionalPropertiesInteger additionalPropertiesInteger = (AdditionalPropertiesInteger) o; - return Objects.equals(name, additionalPropertiesInteger.name); + return super.equals(o) && Objects.equals(name, additionalPropertiesInteger.name); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(super.hashCode(), name); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesNumber.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesNumber.java index fba5c58a6ca2..ccb2d261e4e9 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesNumber.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesNumber.java @@ -13,7 +13,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class AdditionalPropertiesNumber extends HashMap { @JsonProperty("name") private String name; @@ -45,12 +45,12 @@ public boolean equals(Object o) { return false; } AdditionalPropertiesNumber additionalPropertiesNumber = (AdditionalPropertiesNumber) o; - return Objects.equals(name, additionalPropertiesNumber.name); + return super.equals(o) && Objects.equals(name, additionalPropertiesNumber.name); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(super.hashCode(), name); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesObject.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesObject.java index 7ff74d023e40..88c7c039f57d 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesObject.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesObject.java @@ -12,7 +12,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class AdditionalPropertiesObject extends HashMap { @JsonProperty("name") private String name; @@ -44,12 +44,12 @@ public boolean equals(Object o) { return false; } AdditionalPropertiesObject additionalPropertiesObject = (AdditionalPropertiesObject) o; - return Objects.equals(name, additionalPropertiesObject.name); + return super.equals(o) && Objects.equals(name, additionalPropertiesObject.name); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(super.hashCode(), name); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesString.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesString.java index 82b785f68dfd..f77e44c517cf 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesString.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/AdditionalPropertiesString.java @@ -12,7 +12,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class AdditionalPropertiesString extends HashMap { @JsonProperty("name") private String name; @@ -44,12 +44,12 @@ public boolean equals(Object o) { return false; } AdditionalPropertiesString additionalPropertiesString = (AdditionalPropertiesString) o; - return Objects.equals(name, additionalPropertiesString.name); + return super.equals(o) && Objects.equals(name, additionalPropertiesString.name); } @Override public int hashCode() { - return Objects.hash(name); + return Objects.hash(super.hashCode(), name); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Animal.java index 83a35cb8fb16..002b00d3a80d 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Animal.java @@ -13,7 +13,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Animal { @JsonProperty("className") private String className; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index 51d1f66b6e28..5c3837046340 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -7,13 +7,14 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class ArrayOfArrayOfNumberOnly { @JsonProperty("ArrayArrayNumber") private List> arrayArrayNumber = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java index 3d43be02811f..93a8a90b57be 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -7,13 +7,14 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class ArrayOfNumberOnly { @JsonProperty("ArrayNumber") private List arrayNumber = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayTest.java index 2d2bb7e9736f..0ba51572d37a 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ArrayTest.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.openapitools.model.ReadOnlyFirst; @@ -13,7 +14,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class ArrayTest { @JsonProperty("array_of_string") private List arrayOfString = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/BigCat.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/BigCat.java index 1066d414917d..9baf3d2b6013 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/BigCat.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/BigCat.java @@ -12,7 +12,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class BigCat extends Cat { /** * Gets or Sets kind @@ -79,12 +79,12 @@ public boolean equals(Object o) { return false; } BigCat bigCat = (BigCat) o; - return Objects.equals(kind, bigCat.kind); + return super.equals(o) && Objects.equals(kind, bigCat.kind); } @Override public int hashCode() { - return Objects.hash(kind); + return Objects.hash(super.hashCode(), kind); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Capitalization.java index 8de335e5ae00..741418db50d5 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Capitalization.java @@ -10,7 +10,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Capitalization { @JsonProperty("smallCamel") private String smallCamel; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Cat.java index c2128a55abf5..57616b9e4d6f 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Cat.java @@ -11,7 +11,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Cat extends Animal { @JsonProperty("declawed") private Boolean declawed; @@ -43,12 +43,12 @@ public boolean equals(Object o) { return false; } Cat cat = (Cat) o; - return Objects.equals(declawed, cat.declawed); + return super.equals(o) && Objects.equals(declawed, cat.declawed); } @Override public int hashCode() { - return Objects.hash(declawed); + return Objects.hash(super.hashCode(), declawed); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Category.java index 3e3d692f4525..dc5edf5e7eff 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Category.java @@ -10,7 +10,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Category { @JsonProperty("id") private Long id; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ClassModel.java index b17b14c15b88..7cc32987ca6d 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ClassModel.java @@ -13,7 +13,7 @@ **/ @ApiModel(description = "Model for testing model with \"_class\" property") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class ClassModel { @JsonProperty("_class") private String propertyClass; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Client.java index 1e55f2ce1d60..a29d7c4b53b0 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Client.java @@ -10,7 +10,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Client { @JsonProperty("client") private String client; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Dog.java index d0309bdf1336..0f1096efe644 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Dog.java @@ -11,7 +11,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Dog extends Animal { @JsonProperty("breed") private String breed; @@ -43,12 +43,12 @@ public boolean equals(Object o) { return false; } Dog dog = (Dog) o; - return Objects.equals(breed, dog.breed); + return super.equals(o) && Objects.equals(breed, dog.breed); } @Override public int hashCode() { - return Objects.hash(breed); + return Objects.hash(super.hashCode(), breed); } @Override diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/EnumArrays.java index 82b4fec020c4..27db23d26081 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/EnumArrays.java @@ -7,13 +7,14 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class EnumArrays { /** * Gets or Sets justSymbol diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/EnumTest.java index a183df292ef3..446db0765b32 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/EnumTest.java @@ -13,7 +13,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class EnumTest { /** * Gets or Sets enumString diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/FileSchemaTestClass.java index 231e04756dba..fcc31395ca3e 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import org.openapitools.model.ModelFile; @@ -13,7 +14,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class FileSchemaTestClass { @JsonProperty("file") private ModelFile _file; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/FormatTest.java index 0ba9970df741..0857cd103a2f 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/FormatTest.java @@ -15,7 +15,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class FormatTest { @JsonProperty("integer") private Integer integer; @@ -355,7 +355,7 @@ public String toString() { 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(" password: ").append("*").append("\n"); sb.append(" bigDecimal: ").append(toIndentedString(bigDecimal)).append("\n"); sb.append("}"); return sb.toString(); diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 7cd40575db2f..fe5bff2964d6 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -11,7 +11,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class HasOnlyReadOnly { @JsonProperty("bar") private String bar; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/MapTest.java index dad11aaad01b..d4486af22f12 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/MapTest.java @@ -13,7 +13,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class MapTest { @JsonProperty("map_map_of_string") private Map> mapMapOfString = null; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 4533e418bb34..3a3414bbfec1 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -15,7 +15,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") private UUID uuid; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Model200Response.java index 9941883c30be..8e8faa0087c1 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Model200Response.java @@ -14,7 +14,7 @@ **/ @ApiModel(description = "Model for testing model name starting with number") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Model200Response { @JsonProperty("name") private Integer name; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelApiResponse.java index 62f6a501f1ac..c09a3e85b04d 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -11,7 +11,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class ModelApiResponse { @JsonProperty("code") private Integer code; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelFile.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelFile.java index 7073df37eaf5..483bb5b6d147 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelFile.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelFile.java @@ -14,7 +14,7 @@ **/ @ApiModel(description = "Must be named `File` for test.") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class ModelFile { @JsonProperty("sourceURI") private String sourceURI; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelList.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelList.java index 5ae57a336eb8..a74e3f39d9f5 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelList.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelList.java @@ -3,6 +3,7 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonTypeName; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -10,7 +11,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class ModelList { @JsonProperty("123-list") private String _123list; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelReturn.java index a470e947c815..9dfbf8f802f0 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ModelReturn.java @@ -14,7 +14,7 @@ **/ @ApiModel(description = "Model for testing reserved words") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class ModelReturn { @JsonProperty("return") private Integer _return; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Name.java index 1cac4ce3c50a..683f566c677f 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Name.java @@ -13,7 +13,7 @@ **/ @ApiModel(description = "Model for testing model name same as property name") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Name { @JsonProperty("name") private Integer name; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/NumberOnly.java index 2ba1616189aa..189160727a51 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/NumberOnly.java @@ -11,7 +11,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class NumberOnly { @JsonProperty("JustNumber") private BigDecimal justNumber; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Order.java index 389f6b360de4..49a662e17ce9 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Order.java @@ -12,7 +12,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Order { @JsonProperty("id") private Long id; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/OuterComposite.java index 48c0bdfab327..82ef81a33ac6 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/OuterComposite.java @@ -11,7 +11,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class OuterComposite { @JsonProperty("my_number") private BigDecimal myNumber; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Pet.java index 418e4f1e6923..3f4818170378 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Pet.java @@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; +import java.util.Arrays; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -18,7 +19,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Pet { @JsonProperty("id") private Long id; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index ec126ac7f9ad..f122c7a42c03 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -10,7 +10,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class ReadOnlyFirst { @JsonProperty("bar") private String bar; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/SpecialModelName.java index b34b6dc259fe..0be0cd995cc8 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -11,7 +11,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class SpecialModelName { @JsonProperty("$special[property.name]") private Long $specialPropertyName; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Tag.java index dfe3ec38db06..6bd167aca80d 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/Tag.java @@ -10,7 +10,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class Tag { @JsonProperty("id") private Long id; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/TypeHolderDefault.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/TypeHolderDefault.java index f7557955d241..0e999725b48c 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/TypeHolderDefault.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/TypeHolderDefault.java @@ -7,13 +7,14 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class TypeHolderDefault { @JsonProperty("string_item") private String stringItem = "what"; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/TypeHolderExample.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/TypeHolderExample.java index 5ce6daf8d028..d35c15894480 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/TypeHolderExample.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/TypeHolderExample.java @@ -7,13 +7,14 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class TypeHolderExample { @JsonProperty("string_item") private String stringItem; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/User.java index 3ede0b08956d..68f90e0bf955 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/User.java @@ -10,7 +10,7 @@ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class User { @JsonProperty("id") private Long id; diff --git a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/XmlItem.java b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/XmlItem.java index 816985036ac6..f5cf122ed432 100644 --- a/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/XmlItem.java +++ b/samples/server/petstore/java-inflector/src/gen/java/org/openapitools/model/XmlItem.java @@ -7,13 +7,14 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class XmlItem { @JsonProperty("attribute_string") private String attributeString; diff --git a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/AnotherFakeController.java b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/AnotherFakeController.java index 0391e63f3b66..8d38388de3f1 100644 --- a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/AnotherFakeController.java +++ b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/AnotherFakeController.java @@ -11,8 +11,9 @@ import org.openapitools.model.*; import org.openapitools.model.Client; +import java.util.UUID; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class AnotherFakeController { /** * Uncomment and implement as you see fit. These operations will map @@ -21,7 +22,7 @@ public class AnotherFakeController { **/ /* - public ResponseContext call123testSpecialTags(RequestContext request , Client body) { + public ResponseContext call123testSpecialTags(RequestContext request , UUID uuidTest, Client body) { return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" ); } */ diff --git a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/FakeClassnameTestController.java b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/FakeClassnameTestController.java index 84ba2a5b5768..9ef9a4bee76a 100644 --- a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/FakeClassnameTestController.java +++ b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/FakeClassnameTestController.java @@ -12,7 +12,7 @@ import org.openapitools.model.Client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class FakeClassnameTestController { /** * Uncomment and implement as you see fit. These operations will map diff --git a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/FakeController.java b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/FakeController.java index d3be134a7bf4..0736578041e5 100644 --- a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/FakeController.java +++ b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/FakeController.java @@ -15,13 +15,14 @@ import java.util.Date; import java.io.File; import org.openapitools.model.FileSchemaTestClass; +import java.util.List; import java.util.Map; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.OuterComposite; import org.openapitools.model.User; import org.openapitools.model.XmlItem; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class FakeController { /** * Uncomment and implement as you see fit. These operations will map diff --git a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/PetController.java b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/PetController.java index bd5828a2ef49..b35e409b639e 100644 --- a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/PetController.java +++ b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/PetController.java @@ -11,11 +11,12 @@ import org.openapitools.model.*; import java.io.File; +import java.util.List; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.Pet; import java.util.Set; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class PetController { /** * Uncomment and implement as you see fit. These operations will map diff --git a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/StoreController.java b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/StoreController.java index 8e383b935cf3..a53267ee7b29 100644 --- a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/StoreController.java +++ b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/StoreController.java @@ -13,7 +13,7 @@ import java.util.Map; import org.openapitools.model.Order; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class StoreController { /** * Uncomment and implement as you see fit. These operations will map diff --git a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/UserController.java b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/UserController.java index 1eb1c03a981a..3c1c3feee81d 100644 --- a/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/UserController.java +++ b/samples/server/petstore/java-inflector/src/main/java/org/openapitools/controllers/UserController.java @@ -14,7 +14,7 @@ import java.util.List; import org.openapitools.model.User; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.11.0-SNAPSHOT") public class UserController { /** * Uncomment and implement as you see fit. These operations will map diff --git a/samples/server/petstore/java-inflector/src/main/openapi/openapi.yaml b/samples/server/petstore/java-inflector/src/main/openapi/openapi.yaml index 432de96b6f01..ba968087cc27 100644 --- a/samples/server/petstore/java-inflector/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/java-inflector/src/main/openapi/openapi.yaml @@ -47,7 +47,8 @@ paths: - pet x-codegen-request-body-name: body x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json put: operationId: updatePet requestBody: @@ -82,7 +83,8 @@ paths: - pet x-codegen-request-body-name: body x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json /pet/findByStatus: get: description: Multiple status values can be provided with comma separated strings @@ -127,7 +129,9 @@ paths: summary: Finds Pets by status tags: - pet - x-accepts: application/json + x-accepts: + - application/json + - application/xml /pet/findByTags: get: deprecated: true @@ -172,7 +176,9 @@ paths: summary: Finds Pets by tags tags: - pet - x-accepts: application/json + x-accepts: + - application/json + - application/xml /pet/{petId}: delete: operationId: deletePet @@ -202,7 +208,8 @@ paths: summary: Deletes a pet tags: - pet - x-accepts: application/json + x-accepts: + - application/json get: description: Returns a single pet operationId: getPetById @@ -235,7 +242,9 @@ paths: summary: Find pet by ID tags: - pet - x-accepts: application/json + x-accepts: + - application/json + - application/xml post: operationId: updatePetWithForm parameters: @@ -263,7 +272,8 @@ paths: tags: - pet x-content-type: application/x-www-form-urlencoded - x-accepts: application/json + x-accepts: + - application/json /pet/{petId}/uploadImage: post: operationId: uploadFile @@ -295,7 +305,8 @@ paths: tags: - pet x-content-type: multipart/form-data - x-accepts: application/json + x-accepts: + - application/json /store/inventory: get: description: Returns a map of status codes to quantities @@ -315,7 +326,8 @@ paths: summary: Returns pet inventories by status tags: - store - x-accepts: application/json + x-accepts: + - application/json /store/order: post: operationId: placeOrder @@ -344,7 +356,9 @@ paths: - store x-codegen-request-body-name: body x-content-type: '*/*' - x-accepts: application/json + x-accepts: + - application/json + - application/xml /store/order/{order_id}: delete: description: For valid response try integer IDs with value < 1000. Anything @@ -367,7 +381,8 @@ paths: summary: Delete purchase order by ID tags: - store - x-accepts: application/json + x-accepts: + - application/json get: description: For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions @@ -401,7 +416,9 @@ paths: summary: Find purchase order by ID tags: - store - x-accepts: application/json + x-accepts: + - application/json + - application/xml /user: post: description: This can only be done by the logged in user. @@ -422,7 +439,8 @@ paths: - user x-codegen-request-body-name: body x-content-type: '*/*' - x-accepts: application/json + x-accepts: + - application/json /user/createWithArray: post: operationId: createUsersWithArrayInput @@ -444,7 +462,8 @@ paths: - user x-codegen-request-body-name: body x-content-type: '*/*' - x-accepts: application/json + x-accepts: + - application/json /user/createWithList: post: operationId: createUsersWithListInput @@ -466,7 +485,8 @@ paths: - user x-codegen-request-body-name: body x-content-type: '*/*' - x-accepts: application/json + x-accepts: + - application/json /user/login: get: operationId: loginUser @@ -510,7 +530,9 @@ paths: summary: Logs user into the system tags: - user - x-accepts: application/json + x-accepts: + - application/json + - application/xml /user/logout: get: operationId: logoutUser @@ -521,7 +543,8 @@ paths: summary: Logs out current logged in user session tags: - user - x-accepts: application/json + x-accepts: + - application/json /user/{username}: delete: description: This can only be done by the logged in user. @@ -543,7 +566,8 @@ paths: summary: Delete user tags: - user - x-accepts: application/json + x-accepts: + - application/json get: operationId: getUserByName parameters: @@ -572,7 +596,9 @@ paths: summary: Get user by user name tags: - user - x-accepts: application/json + x-accepts: + - application/json + - application/xml put: description: This can only be done by the logged in user. operationId: updateUser @@ -602,7 +628,8 @@ paths: - user x-codegen-request-body-name: body x-content-type: '*/*' - x-accepts: application/json + x-accepts: + - application/json /fake_classname_test: patch: description: To test class name in snake case @@ -628,7 +655,8 @@ paths: - fake_classname_tags 123#$%^ x-codegen-request-body-name: body x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json /fake: delete: description: Fake endpoint to test group parameters (optional) @@ -677,7 +705,8 @@ paths: tags: - fake x-group-parameters: true - x-accepts: application/json + x-accepts: + - application/json get: description: To test enum parameters operationId: testEnumParameters @@ -762,7 +791,8 @@ paths: tags: - fake x-content-type: application/x-www-form-urlencoded - x-accepts: application/json + x-accepts: + - application/json patch: description: To test "client" model operationId: testClientModel @@ -785,7 +815,8 @@ paths: - fake x-codegen-request-body-name: body x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json post: description: |- Fake endpoint for testing various parameters @@ -816,7 +847,8 @@ paths: tags: - fake x-content-type: application/x-www-form-urlencoded - x-accepts: application/json + x-accepts: + - application/json /fake/outer/number: post: description: Test serialization of outer number types @@ -839,7 +871,8 @@ paths: - fake x-codegen-request-body-name: body x-content-type: '*/*' - x-accepts: '*/*' + x-accepts: + - '*/*' /fake/outer/string: post: description: Test serialization of outer string types @@ -862,7 +895,8 @@ paths: - fake x-codegen-request-body-name: body x-content-type: '*/*' - x-accepts: '*/*' + x-accepts: + - '*/*' /fake/outer/boolean: post: description: Test serialization of outer boolean types @@ -885,7 +919,8 @@ paths: - fake x-codegen-request-body-name: body x-content-type: '*/*' - x-accepts: '*/*' + x-accepts: + - '*/*' /fake/outer/composite: post: description: Test serialization of object with outer number type @@ -908,7 +943,8 @@ paths: - fake x-codegen-request-body-name: body x-content-type: '*/*' - x-accepts: '*/*' + x-accepts: + - '*/*' /fake/jsonFormData: get: operationId: testJsonFormData @@ -926,7 +962,8 @@ paths: tags: - fake x-content-type: application/x-www-form-urlencoded - x-accepts: application/json + x-accepts: + - application/json /fake/inline-additionalProperties: post: operationId: testInlineAdditionalProperties @@ -948,7 +985,8 @@ paths: - fake x-codegen-request-body-name: param x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json /fake/body-with-query-params: put: operationId: testBodyWithQueryParams @@ -972,7 +1010,8 @@ paths: - fake x-codegen-request-body-name: body x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json /fake/create_xml_item: post: description: this route creates an XmlItem @@ -1008,11 +1047,20 @@ paths: - fake x-codegen-request-body-name: XmlItem x-content-type: application/xml - x-accepts: 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 + parameters: + - description: to test uuid example value + in: header + name: uuid_test + required: true + schema: + format: uuid + type: string requestBody: content: application/json: @@ -1032,7 +1080,8 @@ paths: - $another-fake? x-codegen-request-body-name: body x-content-type: application/json - x-accepts: 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\ @@ -1052,7 +1101,8 @@ paths: - fake x-codegen-request-body-name: body x-content-type: application/json - x-accepts: application/json + x-accepts: + - application/json /fake/test-query-parameters: put: description: To test the collection format in query parameters @@ -1106,7 +1156,8 @@ paths: description: Success tags: - fake - x-accepts: application/json + x-accepts: + - application/json /fake/{petId}/uploadImageWithRequiredFile: post: operationId: uploadFileWithRequiredFile @@ -1139,7 +1190,8 @@ paths: tags: - pet x-content-type: multipart/form-data - x-accepts: application/json + x-accepts: + - application/json components: schemas: Order: diff --git a/samples/server/petstore/java-microprofile/pom.xml b/samples/server/petstore/java-microprofile/pom.xml index 1182edad8eb0..550d81ab8233 100644 --- a/samples/server/petstore/java-microprofile/pom.xml +++ b/samples/server/petstore/java-microprofile/pom.xml @@ -151,7 +151,7 @@ 1.5.18 9.2.9.v20150224 5.10.2 - 1.4.14 + 1.5.13 3.2.7 2.17.1 2.17.1 diff --git a/samples/server/petstore/java-undertow/pom.xml b/samples/server/petstore/java-undertow/pom.xml index abb0357de8fb..69683a835d30 100644 --- a/samples/server/petstore/java-undertow/pom.xml +++ b/samples/server/petstore/java-undertow/pom.xml @@ -26,7 +26,7 @@ 1.10 1.2 3.1.2 - 1.4.13 + 1.5.13 4.13.2 2.1.0-beta.124 2.3.17.Final diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/pom.xml b/samples/server/petstore/jaxrs-cxf-annotated-base-path/pom.xml index 9e61cf651455..9ab8a5f8b1b7 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/pom.xml +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/pom.xml @@ -226,7 +226,7 @@ for this project used jakarta.validation-api --> 1.5.22 9.2.9.v20150224 4.13.2 - 1.4.14 + 1.5.13 2.0.2 3.5.9 2.17.1 diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/PetApiTest.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/PetApiTest.java index 5fc4823c1c74..d2d6044a259b 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/PetApiTest.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/PetApiTest.java @@ -20,6 +20,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/StoreApiTest.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/StoreApiTest.java index 3f976f3dc7a0..9f41fe1e3e4f 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/StoreApiTest.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/StoreApiTest.java @@ -19,6 +19,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/UserApiTest.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/UserApiTest.java index af395ef11412..534d6b4dd980 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/UserApiTest.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/test/java/org/openapitools/api/UserApiTest.java @@ -19,6 +19,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/pom.xml b/samples/server/petstore/jaxrs-cxf-non-spring-app/pom.xml index eba9703eb696..f799b3d10b55 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/pom.xml +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/pom.xml @@ -226,7 +226,7 @@ for this project used jakarta.validation-api --> 1.5.22 9.2.9.v20150224 4.13.2 - 1.4.14 + 1.5.13 2.0.2 3.5.9 2.17.1 diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/PetApiTest.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/PetApiTest.java index 5fc4823c1c74..d2d6044a259b 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/PetApiTest.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/PetApiTest.java @@ -20,6 +20,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/StoreApiTest.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/StoreApiTest.java index 3f976f3dc7a0..9f41fe1e3e4f 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/StoreApiTest.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/StoreApiTest.java @@ -19,6 +19,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/UserApiTest.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/UserApiTest.java index af395ef11412..534d6b4dd980 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/UserApiTest.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/test/java/org/openapitools/api/UserApiTest.java @@ -19,6 +19,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf/pom.xml b/samples/server/petstore/jaxrs-cxf/pom.xml index 8d20bbb7f1f6..4023565e937a 100644 --- a/samples/server/petstore/jaxrs-cxf/pom.xml +++ b/samples/server/petstore/jaxrs-cxf/pom.xml @@ -226,7 +226,7 @@ for this project used jakarta.validation-api --> 1.5.22 9.2.9.v20150224 4.13.2 - 1.4.14 + 1.5.13 2.0.2 3.5.9 2.17.1 diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/AnotherFakeApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/AnotherFakeApiTest.java index edd0da7797c4..fa47eea6ad29 100644 --- a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/AnotherFakeApiTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/AnotherFakeApiTest.java @@ -19,6 +19,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/FakeApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/FakeApiTest.java index 20839b15e3ca..e489503f215e 100644 --- a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/FakeApiTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/FakeApiTest.java @@ -27,6 +27,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/FakeClassnameTags123ApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/FakeClassnameTags123ApiTest.java index a20299dcb2c2..178dc3bc11c5 100644 --- a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/FakeClassnameTags123ApiTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/FakeClassnameTags123ApiTest.java @@ -18,6 +18,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/PetApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/PetApiTest.java index b5575602cb6a..33ef3a6e2297 100644 --- a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/PetApiTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/PetApiTest.java @@ -21,6 +21,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/StoreApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/StoreApiTest.java index 53eee27fddf3..2783a6210716 100644 --- a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/StoreApiTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/StoreApiTest.java @@ -19,6 +19,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/UserApiTest.java b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/UserApiTest.java index 5b5d67899f75..9ea32cad31ba 100644 --- a/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/UserApiTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/test/java/org/openapitools/api/UserApiTest.java @@ -19,6 +19,7 @@ import org.junit.Before; import static org.junit.Assert.*; +import javax.validation.Valid; import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.client.JAXRSClientFactory; import org.apache.cxf.jaxrs.client.ClientConfiguration; diff --git a/samples/server/petstore/jaxrs-datelib-j8/pom.xml b/samples/server/petstore/jaxrs-datelib-j8/pom.xml index bc26cad95f77..010fc980ec1f 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/pom.xml +++ b/samples/server/petstore/jaxrs-datelib-j8/pom.xml @@ -209,7 +209,7 @@ for this project used jakarta.validation-api --> 2.35 2.17.1 4.13.2 - 1.4.14 + 1.5.13 4.0.4 UTF-8 diff --git a/samples/server/petstore/jaxrs-jersey/pom.xml b/samples/server/petstore/jaxrs-jersey/pom.xml index bb5cad519c6c..8082c0f8955c 100644 --- a/samples/server/petstore/jaxrs-jersey/pom.xml +++ b/samples/server/petstore/jaxrs-jersey/pom.xml @@ -209,7 +209,7 @@ for this project used jakarta.validation-api --> 2.35 2.17.1 4.13.2 - 1.4.14 + 1.5.13 4.0.4 UTF-8 diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/pom.xml b/samples/server/petstore/jaxrs/jersey2-useTags/pom.xml index 27272cdee6b7..9219246ac6d4 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/pom.xml +++ b/samples/server/petstore/jaxrs/jersey2-useTags/pom.xml @@ -209,7 +209,7 @@ for this project used jakarta.validation-api --> 2.35 2.17.1 4.13.2 - 1.4.14 + 1.5.13 4.0.4 UTF-8 diff --git a/samples/server/petstore/jaxrs/jersey2/pom.xml b/samples/server/petstore/jaxrs/jersey2/pom.xml index 12699ccce64f..866617019ac6 100644 --- a/samples/server/petstore/jaxrs/jersey2/pom.xml +++ b/samples/server/petstore/jaxrs/jersey2/pom.xml @@ -209,7 +209,7 @@ for this project used jakarta.validation-api --> 2.35 2.17.1 4.13.2 - 1.4.14 + 1.5.13 4.0.4 UTF-8 diff --git a/samples/server/petstore/jaxrs/jersey3/pom.xml b/samples/server/petstore/jaxrs/jersey3/pom.xml index 5e5457aef78b..dfcda7df9f6e 100644 --- a/samples/server/petstore/jaxrs/jersey3/pom.xml +++ b/samples/server/petstore/jaxrs/jersey3/pom.xml @@ -209,7 +209,7 @@ 3.1.3 2.17.1 4.13.2 - 1.4.14 + 1.5.13 5.0.0 UTF-8 diff --git a/samples/server/petstore/kotlin-server-modelMutable/gradle.properties b/samples/server/petstore/kotlin-server-modelMutable/gradle.properties index fb877a9edd28..1fb076431bba 100644 --- a/samples/server/petstore/kotlin-server-modelMutable/gradle.properties +++ b/samples/server/petstore/kotlin-server-modelMutable/gradle.properties @@ -1,4 +1,4 @@ kotlin.code.style=official ktor_version=3.0.2 kotlin_version=2.0.20 -logback_version=1.4.14 \ No newline at end of file +logback_version=1.5.13 diff --git a/samples/server/petstore/kotlin-server/ktor/gradle.properties b/samples/server/petstore/kotlin-server/ktor/gradle.properties index fb877a9edd28..1fb076431bba 100644 --- a/samples/server/petstore/kotlin-server/ktor/gradle.properties +++ b/samples/server/petstore/kotlin-server/ktor/gradle.properties @@ -1,4 +1,4 @@ kotlin.code.style=official ktor_version=3.0.2 kotlin_version=2.0.20 -logback_version=1.4.14 \ No newline at end of file +logback_version=1.5.13 diff --git a/samples/server/petstore/kotlin-server/ktor2/gradle.properties b/samples/server/petstore/kotlin-server/ktor2/gradle.properties index d507b58c1c87..126ddfe69da1 100644 --- a/samples/server/petstore/kotlin-server/ktor2/gradle.properties +++ b/samples/server/petstore/kotlin-server/ktor2/gradle.properties @@ -1,4 +1,4 @@ kotlin.code.style=official ktor_version=2.3.12 kotlin_version=2.0.20 -logback_version=1.4.14 \ No newline at end of file +logback_version=1.5.13 diff --git a/samples/server/petstore/kotlin-spring-cloud/.openapi-generator/FILES b/samples/server/petstore/kotlin-spring-cloud/.openapi-generator/FILES index cb11aec76f7c..9c277d3ed4a8 100644 --- a/samples/server/petstore/kotlin-spring-cloud/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-spring-cloud/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/api/PetApi.kt diff --git a/samples/server/petstore/kotlin-spring-cloud/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-spring-cloud/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-spring-cloud/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-spring-cloud/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-spring-cloud/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-cloud/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-spring-cloud/gradlew b/samples/server/petstore/kotlin-spring-cloud/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-cloud/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-spring-cloud/gradlew.bat b/samples/server/petstore/kotlin-spring-cloud/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-spring-cloud/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-spring-default/.openapi-generator/FILES b/samples/server/petstore/kotlin-spring-default/.openapi-generator/FILES index 71096b46e211..98932e549209 100644 --- a/samples/server/petstore/kotlin-spring-default/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-spring-default/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-spring-default/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-spring-default/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-spring-default/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-spring-default/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-spring-default/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-default/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-spring-default/gradlew b/samples/server/petstore/kotlin-spring-default/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-spring-default/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-spring-default/gradlew.bat b/samples/server/petstore/kotlin-spring-default/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-spring-default/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-3/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-3/.openapi-generator/FILES index 50a9d2bc75d2..c7afb2eda91e 100644 --- a/samples/server/petstore/kotlin-springboot-3/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-3/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-3/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-3/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-3/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-3/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-3/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-3/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-3/gradlew b/samples/server/petstore/kotlin-springboot-3/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-3/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-3/gradlew.bat b/samples/server/petstore/kotlin-springboot-3/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-3/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-bigdecimal-default/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-bigdecimal-default/.openapi-generator/FILES index ea3a423f92ac..59ebb191c204 100644 --- a/samples/server/petstore/kotlin-springboot-bigdecimal-default/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-bigdecimal-default/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradlew b/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradlew.bat b/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-bigdecimal-default/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/.openapi-generator/FILES index c02ae2405be0..56aa86492b93 100644 --- a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradlew b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradlew.bat b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-delegate-nodefaults/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-delegate/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-delegate/.openapi-generator/FILES index e6abbae22b6b..ba0ea1dfa5db 100644 --- a/samples/server/petstore/kotlin-springboot-delegate/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-delegate/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-delegate/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-delegate/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-delegate/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-delegate/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-delegate/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-delegate/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-delegate/gradlew b/samples/server/petstore/kotlin-springboot-delegate/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-delegate/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-delegate/gradlew.bat b/samples/server/petstore/kotlin-springboot-delegate/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-delegate/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-integer-enum/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-integer-enum/.openapi-generator/FILES index 210f79aeeaa4..97df5ba6fbbc 100644 --- a/samples/server/petstore/kotlin-springboot-integer-enum/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-integer-enum/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/api/ApiUtil.kt diff --git a/samples/server/petstore/kotlin-springboot-integer-enum/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-integer-enum/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-integer-enum/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-integer-enum/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-integer-enum/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-integer-enum/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-integer-enum/gradlew b/samples/server/petstore/kotlin-springboot-integer-enum/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-integer-enum/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-integer-enum/gradlew.bat b/samples/server/petstore/kotlin-springboot-integer-enum/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-integer-enum/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/FILES index 33690582d9ac..f5d17c96d646 100644 --- a/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-modelMutable/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-modelMutable/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-modelMutable/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-modelMutable/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/gradlew b/samples/server/petstore/kotlin-springboot-modelMutable/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-modelMutable/gradlew.bat b/samples/server/petstore/kotlin-springboot-modelMutable/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-modelMutable/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-multipart-request-model/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-multipart-request-model/.openapi-generator/FILES index 0afcf84b1ed1..24c5ef9ccc87 100644 --- a/samples/server/petstore/kotlin-springboot-multipart-request-model/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-multipart-request-model/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-multipart-request-model/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-multipart-request-model/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-multipart-request-model/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-multipart-request-model/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-multipart-request-model/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-multipart-request-model/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-multipart-request-model/gradlew b/samples/server/petstore/kotlin-springboot-multipart-request-model/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-multipart-request-model/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-multipart-request-model/gradlew.bat b/samples/server/petstore/kotlin-springboot-multipart-request-model/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-multipart-request-model/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES index 8a36d40b8756..7b4efc03051a 100644 --- a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-reactive/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-reactive/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-reactive/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-reactive/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-reactive/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-reactive/gradlew b/samples/server/petstore/kotlin-springboot-reactive/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-reactive/gradlew.bat b/samples/server/petstore/kotlin-springboot-reactive/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-request-cookie/.openapi-generator/FILES index 414071701cfa..8583785b48cb 100644 --- a/samples/server/petstore/kotlin-springboot-request-cookie/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-request-cookie/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/SpringDocConfiguration.kt diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-request-cookie/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-request-cookie/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-request-cookie/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-request-cookie/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/gradlew b/samples/server/petstore/kotlin-springboot-request-cookie/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-request-cookie/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-request-cookie/gradlew.bat b/samples/server/petstore/kotlin-springboot-request-cookie/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-request-cookie/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-source-swagger1/.openapi-generator/FILES index b7ad76a5ca4f..939b36d09b88 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger1/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-source-swagger1/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-source-swagger1/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-source-swagger1/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/gradlew b/samples/server/petstore/kotlin-springboot-source-swagger1/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-source-swagger1/gradlew.bat b/samples/server/petstore/kotlin-springboot-source-swagger1/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-source-swagger1/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-source-swagger2/.openapi-generator/FILES index b7ad76a5ca4f..939b36d09b88 100644 --- a/samples/server/petstore/kotlin-springboot-source-swagger2/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-source-swagger2/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-source-swagger2/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-source-swagger2/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/gradlew b/samples/server/petstore/kotlin-springboot-source-swagger2/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-source-swagger2/gradlew.bat b/samples/server/petstore/kotlin-springboot-source-swagger2/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-source-swagger2/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/FILES index 22e30ab6345e..b58d94c8bb28 100644 --- a/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot-springfox/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-springfox/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot-springfox/gradlew b/samples/server/petstore/kotlin-springboot-springfox/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-springfox/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot-springfox/gradlew.bat b/samples/server/petstore/kotlin-springboot-springfox/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-springfox/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/kotlin-springboot/.openapi-generator/FILES b/samples/server/petstore/kotlin-springboot/.openapi-generator/FILES index 50a9d2bc75d2..c7afb2eda91e 100644 --- a/samples/server/petstore/kotlin-springboot/.openapi-generator/FILES +++ b/samples/server/petstore/kotlin-springboot/.openapi-generator/FILES @@ -1,5 +1,9 @@ README.md build.gradle.kts +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +gradlew +gradlew.bat pom.xml settings.gradle src/main/kotlin/org/openapitools/Application.kt diff --git a/samples/server/petstore/kotlin-springboot/gradle/wrapper/gradle-wrapper.jar b/samples/server/petstore/kotlin-springboot/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 000000000000..e6441136f3d4 Binary files /dev/null and b/samples/server/petstore/kotlin-springboot/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/server/petstore/kotlin-springboot/gradle/wrapper/gradle-wrapper.properties b/samples/server/petstore/kotlin-springboot/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..80187ac30432 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/samples/server/petstore/kotlin-springboot/gradlew b/samples/server/petstore/kotlin-springboot/gradlew new file mode 100644 index 000000000000..9d0ce634cb11 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while +APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path +[ -h "$app_path" ] +do +ls=$( ls -ld "$app_path" ) +link=${ls#*' -> '} +case $link in #( +/*) app_path=$link ;; #( +*) app_path=$APP_HOME$link ;; +esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { +echo "$*" +} >&2 + +die () { +echo +echo "$*" +echo +exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( +CYGWIN* ) cygwin=true ;; #( +Darwin* ) darwin=true ;; #( +MSYS* | MINGW* ) msys=true ;; #( +NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then +if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# IBM's JDK on AIX uses strange locations for the executables +JAVACMD=$JAVA_HOME/jre/sh/java +else +JAVACMD=$JAVA_HOME/bin/java +fi +if [ ! -x "$JAVACMD" ] ; then +die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +else +JAVACMD=java +if ! command -v java >/dev/null 2>&1 +then +die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then +case $MAX_FD in #( +max*) +# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +MAX_FD=$( ulimit -H -n ) || +warn "Could not query maximum file descriptor limit" +esac +case $MAX_FD in #( +'' | soft) :;; #( +*) +# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. +# shellcheck disable=SC2039,SC3045 +ulimit -n "$MAX_FD" || +warn "Could not set maximum file descriptor limit to $MAX_FD" +esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then +APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) +CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + +JAVACMD=$( cygpath --unix "$JAVACMD" ) + +# Now convert the arguments - kludge to limit ourselves to /bin/sh +for arg do +if +case $arg in #( +-*) false ;; # don't mess with options #( +/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath +[ -e "$t" ] ;; #( +*) false ;; +esac +then +arg=$( cygpath --path --ignore --mixed "$arg" ) +fi +# Roll the args list around exactly as many times as the number of +# args, so each arg winds up back in the position where it started, but +# possibly modified. +# +# NB: a `for` loop captures its iteration list before it begins, so +# changing the positional parameters here affects neither the number of +# iterations, nor the values presented in `arg`. +shift # remove old arg +set -- "$@" "$arg" # push replacement arg +done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ +"-Dorg.gradle.appname=$APP_BASE_NAME" \ +-classpath "$CLASSPATH" \ +org.gradle.wrapper.GradleWrapperMain \ +"$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then +die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( +printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | +xargs -n1 | +sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | +tr '\n' ' ' +)" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/samples/server/petstore/kotlin-springboot/gradlew.bat b/samples/server/petstore/kotlin-springboot/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/auth.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/auth.rs index cbaba3dca7c6..d2b1481eeb81 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/auth.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/auth.rs @@ -34,7 +34,7 @@ fn dummy_authorization() -> Authorization { // However, if you want to use it anyway this can not be unimplemented, so dummy implementation added. // unimplemented!() Authorization{ - subject: "Dummmy".to_owned(), + subject: "Dummy".to_owned(), scopes: Scopes::Some(BTreeSet::new()), // create an empty scope, as this should not be used issuer: None } diff --git a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs index e9296a9524a5..442c54a8db74 100644 --- a/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/multipart-v3/src/server/mod.rs @@ -363,7 +363,7 @@ impl hyper::service::Service<(Request, C)> for Service where return Ok(Response::builder() .status(StatusCode::INTERNAL_SERVER_ERROR) .body(Body::from("Failed to process message part due an internal error".to_string())) - .expect("Unable to create Internal Server Error response due to an internal errror")) + .expect("Unable to create Internal Server Error response due to an internal error")) }, SaveResult::Error(e) => { return Ok(Response::builder() diff --git a/samples/server/petstore/rust-server/output/no-example-v3/src/auth.rs b/samples/server/petstore/rust-server/output/no-example-v3/src/auth.rs index cbaba3dca7c6..d2b1481eeb81 100644 --- a/samples/server/petstore/rust-server/output/no-example-v3/src/auth.rs +++ b/samples/server/petstore/rust-server/output/no-example-v3/src/auth.rs @@ -34,7 +34,7 @@ fn dummy_authorization() -> Authorization { // However, if you want to use it anyway this can not be unimplemented, so dummy implementation added. // unimplemented!() Authorization{ - subject: "Dummmy".to_owned(), + subject: "Dummy".to_owned(), scopes: Scopes::Some(BTreeSet::new()), // create an empty scope, as this should not be used issuer: None } diff --git a/samples/server/petstore/rust-server/output/openapi-v3/src/auth.rs b/samples/server/petstore/rust-server/output/openapi-v3/src/auth.rs index cbaba3dca7c6..d2b1481eeb81 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/src/auth.rs +++ b/samples/server/petstore/rust-server/output/openapi-v3/src/auth.rs @@ -34,7 +34,7 @@ fn dummy_authorization() -> Authorization { // However, if you want to use it anyway this can not be unimplemented, so dummy implementation added. // unimplemented!() Authorization{ - subject: "Dummmy".to_owned(), + subject: "Dummy".to_owned(), scopes: Scopes::Some(BTreeSet::new()), // create an empty scope, as this should not be used issuer: None } diff --git a/samples/server/petstore/rust-server/output/ops-v3/src/auth.rs b/samples/server/petstore/rust-server/output/ops-v3/src/auth.rs index cbaba3dca7c6..d2b1481eeb81 100644 --- a/samples/server/petstore/rust-server/output/ops-v3/src/auth.rs +++ b/samples/server/petstore/rust-server/output/ops-v3/src/auth.rs @@ -34,7 +34,7 @@ fn dummy_authorization() -> Authorization { // However, if you want to use it anyway this can not be unimplemented, so dummy implementation added. // unimplemented!() Authorization{ - subject: "Dummmy".to_owned(), + subject: "Dummy".to_owned(), scopes: Scopes::Some(BTreeSet::new()), // create an empty scope, as this should not be used issuer: None } diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs index cbaba3dca7c6..d2b1481eeb81 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/auth.rs @@ -34,7 +34,7 @@ fn dummy_authorization() -> Authorization { // However, if you want to use it anyway this can not be unimplemented, so dummy implementation added. // unimplemented!() Authorization{ - subject: "Dummmy".to_owned(), + subject: "Dummy".to_owned(), scopes: Scopes::Some(BTreeSet::new()), // create an empty scope, as this should not be used issuer: None } diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs index b0d83b6a7271..0b0af66381ed 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs @@ -2208,7 +2208,7 @@ impl hyper::service::Service<(Request, C)> for Service where return Ok(Response::builder() .status(StatusCode::INTERNAL_SERVER_ERROR) .body(Body::from("Failed to process message part due an internal error".to_string())) - .expect("Unable to create Internal Server Error response due to an internal errror")) + .expect("Unable to create Internal Server Error response due to an internal error")) }, SaveResult::Error(e) => { return Ok(Response::builder() diff --git a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/auth.rs b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/auth.rs index cbaba3dca7c6..d2b1481eeb81 100644 --- a/samples/server/petstore/rust-server/output/ping-bearer-auth/src/auth.rs +++ b/samples/server/petstore/rust-server/output/ping-bearer-auth/src/auth.rs @@ -34,7 +34,7 @@ fn dummy_authorization() -> Authorization { // However, if you want to use it anyway this can not be unimplemented, so dummy implementation added. // unimplemented!() Authorization{ - subject: "Dummmy".to_owned(), + subject: "Dummy".to_owned(), scopes: Scopes::Some(BTreeSet::new()), // create an empty scope, as this should not be used issuer: None } diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/auth.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/auth.rs index cbaba3dca7c6..d2b1481eeb81 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/auth.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/auth.rs @@ -34,7 +34,7 @@ fn dummy_authorization() -> Authorization { // However, if you want to use it anyway this can not be unimplemented, so dummy implementation added. // unimplemented!() Authorization{ - subject: "Dummmy".to_owned(), + subject: "Dummy".to_owned(), scopes: Scopes::Some(BTreeSet::new()), // create an empty scope, as this should not be used issuer: None }